1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Web/Scripts/2011.3.1115/telerik.splitter.min.js

1 line
7.9 KiB
JavaScript
Raw Normal View History

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