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

1 line
7.3 KiB
JavaScript
Raw Normal View History

2011-06-28 05:01:54 +00:00
(function(f){var i=f.telerik,h=7,a=/^\d+px$/i,d=/^\d+(\.\d+)?%$/i;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,n){var l=f(l),j=l.prev(".t-splitbar"),m=l.next(".t-splitbar"),o=j.add(m),k=l.data("pane");if(arguments.length==1){n=k.collapsed===undefined?false:k.collapsed}o.toggleClass("t-splitbar-draggable-"+this.orientation,n).removeClass("t-splitbar-"+this.orientation+"-hover");j.find(n?".t-expand-next":".t-collapse-next").toggleClass("t-expand-next",!n).toggleClass("t-collapse-next",n);m.find(n?".t-expand-prev":".t-collapse-prev").toggleClass("t-expand-prev",!n).toggleClass("t-collapse-prev",n);k.collapsed=!n;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(this.orientation).catIf(" t-splitbar-draggable-",this.orientation,s&&!n.collapsed&&!o.collapsed).cat("'>").catIconIf("t-collapse-prev",n.collapsible&&!n.collapsed).catIconIf("t-expand-prev",n.collapsible&&n.collapsed).catIconIf("t-resiz