Lidarr/packages/TelerikMvcExtensions.2011.1.../content/Scripts/2011.1.315/telerik.imagebrowser.min.js

1 line
16 KiB
JavaScript
Raw Normal View History

2011-03-30 06:18:35 +00:00
(function(i,o){var n=i.telerik,e=i.telerik.query;n.imageBrowser=function(q,r){this.element=q;this.wrapper=i(q);var t=r.filter||"*.png,*.gif,*.jpg,*.jpeg";var s=r.localization;this.wrapper.append('<div class="t-floatwrap"><div class="t-widget t-combobox t-header t-breadcrumbs"><div class="t-dropdown-wrap t-state-default"><input type="text" class="t-input" /><div class="t-breadcrumbs-wrap"/><span class="t-select t-header"><span class="t-icon t-arrow-down">select</span></span></div></div><div class="t-widget t-combobox t-dropdown-wrap t-search-wrap" /></div>').append(k(s,r.uploadUrl,r.createDirectoryUrl,r.deleteFileUrl||r.deleteDirectoryUrl)).append('<ul id="t-editor-image-list" class="t-reset t-floats t-tiles" />');var u=this.wrapper.find(".t-breadcrumbs");var y=this.wrapper.find(".t-tiles");var v=this.wrapper.find(".t-search-wrap");if(r.uploadUrl){this.wrapper.find(".t-upload input").tUpload({async:{saveUrl:r.uploadUrl,autoUpload:true},multiple:false,onUpload:function(B){var C=new RegExp(("("+t.split(",").join(")|(")+")").replace(/\*\./g,".*."),"i");var A=B.files[0].name;if(C.test(A)){B.data={path:u.val()};y.trigger("t:upload",[{name:A},function(){B.preventDefault()}])}else{B.preventDefault();alert(n.formatString(s.invalidFileType,A,t))}},onError:function(A){A.preventDefault();y.trigger("t:error",[A.files[0]]);var B=A.XMLHttpRequest;if(n.ajaxError(r.element,"error",B,B.statusText)){return}},onSuccess:function(A){y.trigger("t:completeFile",[i.extend(A.response,{path:u.val()})])}})}new n.searchBox(v[0]);new n.fileListView(y[0],{thumbnailUrl:r.thumbUrl,localization:s});var w=new n.dropDown({effects:n.fx.slide.defaults(),onClick:function(A){i(q).find(".t-tiles-arrange a span:first").html(i(A.item).text());w.close();u.trigger("t:change")}});var z=[{Text:s.orderByName,Value:"name"},{Text:s.orderBySize,Value:"size"}];w.dataBind(z);this.wrapper.find(".t-tiles-arrange a").click(function(B){B.preventDefault();var A=i(this);w.open({offset:A.offset(),outerHeight:A.outerHeight(),outerWidth:A.outerWidth(),zIndex:n.getElementZIndex(this)})}).end().delegate(".t-button:not(.t-state-disabled):has(.t-delete)","click",function(){var A=y.find(".t-state-selected");if(A.length&&confirm(n.formatString(s.deleteFile,A.find("strong").text()))){i.ajax({type:"POST",url:A.data("kind")=="f"?r.deleteFileUrl:r.deleteDirectoryUrl,data:{path:A.data("url")},error:function(C,B){if(n.ajaxError(r.element,"error",C,B)){return}},success:function(){y.trigger("t:delete");i(q).find(".t-delete").parent().addClass("t-state-disabled")}})}}).delegate(".t-button:not(.t-state-disabled):has(.t-addfolder)","click",function(){y.trigger("t:createDirectory",[function(A){i.ajax({type:"POST",url:r.createDirectoryUrl,data:{path:u.val(),name:A},error:function(C,B){y.trigger("t:errorDirectory",{name:A});if(n.ajaxError(r.element,"error",C,B)){return}},success:function(){y.trigger("t:completeDirectory",{path:u.val(),name:A})}})}])});i(document.documentElement).bind("mousedown",function(B){var A=w.$element[0];if(!i.contains(A,B.target)){w.close()}});var x=new n.dataSource({error:function(A,C){var B=n.trigger(r.element,"error",{XMLHttpRequest:A,textStatus:C});if(!B){if(C=="error"){if(A.status=="404"){alert(r.localization.directoryNotFound)}else{if(A.status!="0"){alert("Error! The requested URL returned "+A.status+" - "+A.statusText)}}}else{if(C=="timeout"){alert("Error! Server timeout.")}}}},url:r.selectUrl,callback:function(B){i(q).find(".t-delete").parent().addClass("t-state-disabled");if(!u.val()){new n.breadcrumbs(u[0],{path:B.Path,roots:B.ContentPaths})}u.val(B.Path).trigger("t:refresh");var C=i(q).find(".t-tiles-arrange a span:first").text();var A=i.map(z,function(E){if(E.Text==C){return E.Value}})[0];var D=v.val();y.trigger("t:refresh",[B,A,D])}});v.bind("t:change",function(){u.trigger("t:change")});x.get({path:""});y.bind("t:select",function(A){if(A.kind=="d"){x.get({path:A.url})}else{r.apply(A)}}).bind("t:change",function(B){var C=i(q).find(".t-delete").parent().addClass("t-state-disabled");if(B.kind=="f"){var A=B.url;if(r.imageUrl){A=r.imageUrl+"?path="+A}i(q).parent().find