sonarr-repo-only/NzbDrone.Web/Scripts/2011.2.712/telerik.splitter.min.js

1 line
7.5 KiB
JavaScript
Raw Normal View History

(function(f){var i=f.telerik,h=7,a=/^\d+px$/i,d=/^\d+(\.\d+)?%$/i;i.scripts.push("telerik.splitter.js");function b(j){return d.test(j)}function g(j){return a.test(j)}function c(j){return !b(j)&&!g(j)}i.splitter=function(j,k){this.element=j;var m=this.$element=f(j),l=this;f.extend(this,k);var r=this.orientation.toLowerCase()!="vertical"?"horizontal":"vertical",p=this.panes;this.orientation=r;i.bind(this,{load:this.onLoad,expand:this.onExpand,collapse:this.onCollapse,contentLoad:this.onContentLoad,resize:function(s){s.stopPropagation();l.resize.call(l,s);if(f.isFunction(l.onResize)){l.onResize.call(j,s)}}});var n=".t-splitbar-draggable-"+r,o=".t-splitbar .t-icon:not(.t-resize-handle)";var q=function(s){return function(v){var u=f(v.target),t;if(u.closest(".t-splitter")[0]!=j){return}if(u.is(".t-"+s+"-prev")){t=u.parent().prev()}else{t=u.parent().next()}if(!i.trigger(j,s,{pane:t[0]})){l[s](t[0])}}};m.addClass("t-widget").addClass("t-splitter").children().addClass("t-pane").each(f.proxy(function(t,u){var s=f(u);s.data("pane",p?p[t]:{}).toggleClass("t-scrollable",p?p[t].scrollable!==false:true);this.ajaxRequest(s)},this)).end().trigger("resize").delegate(n,"mouseenter",function(){f(this).addClass("t-splitbar-"+r+"-hover")}).delegate(n,"mouseleave",function(){f(this).removeClass("t-splitbar-"+r+"-hover")}).delegate(o,"mouseenter",i.hover).delegate(o,"mouseleave",i.leave).delegate(".t-splitbar .t-collapse-next, .t-splitbar .t-collapse-prev","click",q("collapse")).delegate(".t-splitbar .t-expand-next, .t-splitbar .t-expand-prev","click",q("expand")).delegate(".t-splitbar","dblclick",function(v){var t=f(v.target),u=function(x,w){if(!i.trigger(j,x,{pane:w[0]})){l[x](w[0])}};if(t.closest(".t-splitter")[0]!=j){return}var s=t.children(".t-icon:not(.t-resize-handle)");if(s.length!==1){return}if(s.is(".t-collapse-prev")){u("collapse",t.prev())}else{if(s.is(".t-collapse-next")){u("collapse",t.next())}else{if(s.is(".t-expand-prev")){u("expand",t.prev())}else{if(s.is(".t-expand-next")){u("expand",t.next())}}}}}).parent().closest(".t-splitter").bind("resize",function(){m.trigger("resize")});this.resizing=new i.splitter.PaneResizing(this)};function e(j,k){return function(n,l){var m=f(n).data("pane");if(arguments.length==1){return m[j]}m[j]=l;if(k){this.$element.trigger("resize")}}}i.splitter.prototype={toggle:function(l,o){var l=f(l),j=l.prev(".t-splitbar"),m=l.next(".t-splitbar"),s=l.data("pane"),p=l.prevAll(".t-pane:first").data("pane"),r=l.nextAll(".t-pane:first").data("pane"),q=this.orientation,k="t-splitbar-"+q+"-hover",n="t-splitbar-draggable-"+q;if(arguments.length==1){o=s.collapsed===undefined?false:s.collapsed}j.toggleClass(n,o&&s.resizable!==false&&(!p||p.resizable!==false)).removeClass(k).find(o?".t-expand-next":".t-collapse-next").toggleClass("t-expand-next",!o).toggleClass("t-collapse-next",o);m.toggleClass(n,o&&s.resizable!==false&&(!r||r.resizable!==false)).removeClass(k).find(o?".t-expand-prev":".t-collapse-prev").toggleClass("t-expand-prev",!o).toggleClass("t-collapse-prev",o);s.collapsed=!o;this.$element.trigger("resize")},collapse:function(j){this.toggle(j,false)},expand:function(j){this.toggle(j,true)},size:e("size",true),minSize:e("minSize"),maxSize:e("maxSize"),ajaxOptions:function(j,l){var k=this;return f.extend({type:"POST",dataType:"html",success:function(m){j.html(m);i.trigger(k.element,"contentLoad",{pane:j[0]})}},l)},ajaxRequest:function(m,j){var k=f(m),l=k.data("pane");if(j||l.contentUrl){k.append("<span class='t-icon t-loading t-pane-loading' />");f.ajax(this.ajaxOptions(k,{url:j||l.contentUrl}))}},resize:function(){var v=this.$element,C=v.children(":not(.t-splitbar)"),k=this.orientation=="horizontal",q=v.children(".t-splitbar").length,z=k?"width":"height",D=v[z]();if(q===0){q=C.length-1;for(var l=0;l<q;l++){var j=C.eq(l),n=j.data("pane"),o=j.next().data("pane");if(!o){continue}var s=(n.resizable!==false)&&(o.resizable!==false),t=new i.stringBuilder();t.catIconIf=function(F,E){if(E){this.cat("<div class='t-icon ").cat(F).cat("' />")}return this};t.cat("<div class='t-splitbar t-state-default t-splitbar-").cat(th