sonarr-repo-only/packages/TelerikMvcExtensions.2011.3.../content/Scripts/2011.3.1115/telerik.imagebrowser.min.js

1 line
16 KiB
JavaScript
Raw Normal View History

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