You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sonarr/NzbDrone.Web/Scripts/2010.2.825/telerik.treeview.min.js

1 line
12 KiB

14 years ago
(function(a){var b=a.telerik;b.treeview=function(e,f){this.element=e;var g=a(e);a.extend(this,f);var c=".t-in:not(.t-state-selected,.t-state-disabled)";a(".t-in.t-state-selected",e).live("mouseenter",b.preventDefault);g.delegate(c,"mouseenter",b.hover).delegate(c,"mouseleave",b.leave).delegate(c,"click",b.delegate(this,this.nodeSelect)).delegate("div:not(.t-state-disabled) .t-in","dblclick",b.delegate(this,this.nodeClick)).delegate(":checkbox","click",b.delegate(this,this.checkboxClick)).delegate(".t-plus, .t-minus","click",b.delegate(this,this.nodeClick));if(this.isAjax()){g.find(".t-plus").each(function(){var h=a(this.parentNode);h.parent().data("loaded",h.next(".t-group").length>0)})}if(this.dragAndDrop){b.bind(this,{nodeDragStart:this.onNodeDragStart,nodeDragging:this.onNodeDragging,nodeDragCancelled:this.onNodeDragCancelled,nodeDrop:this.onNodeDrop,nodeDropped:this.onNodeDropped});b.draganddrop(this.element.id,a.extend({useDragClue:true,draggables:a("div:not(.t-state-disabled) .t-in",e)},b.draganddrop.applyContext(b.draganddrop.treeview,this)))}var d=g.find(".t-item > .t-content");if(d.length>0&&a(d[0]).children().length==0){g.find(".t-icon").hide()}b.bind(this,{expand:this.onExpand,collapse:this.onCollapse,select:a.proxy(function(h){if(h.target==this.element&&this.onSelect){this.onSelect(h)}},this),checked:this.onChecked,error:this.onError,load:this.onLoad,dataBinding:this.onDataBinding,dataBound:this.onDataBound})};b.treeview.prototype={expand:function(c){a(c,this.element).each(a.proxy(function(f,g){var e=a(g);var d=e.find("> .t-group, > .t-content");if((d.length>0&&!d.is(":visible"))||this.isAjax()){this.nodeToggle(null,e)}},this))},collapse:function(c){a(c,this.element).each(a.proxy(function(f,g){var e=a(g);var d=e.find("> .t-group, > .t-content");if(d.length>0&&d.is(":visible")){this.nodeToggle(null,e)}},this))},enable:function(c){this.toggle(c,true)},disable:function(c){this.toggle(c,false)},toggle:function(d,c){a(d,this.element).each(a.proxy(function(f,g){var e=a(g);this.collapse(e);e.find("> div > .t-icon").toggleClass("t-state-default",c).toggleClass("t-state-disabled",!c);e.find("> div > .t-in").toggleClass("t-state-default",c).toggleClass("t-state-disabled",!c)},this))},reload:function(d){var c=this;a(d).each(function(){var e=a(this);e.find(".t-group").remove();c.ajaxRequest(e)})},shouldNavigate:function(d){var c=a(d).closest(".t-item").find("> .t-content, > .t-group");var e=a(d).attr("href");return !((e&&(e.charAt(e.length-1)=="#"||e.indexOf("#"+this.element.id+"-")!=-1))||(c.length>0&&c.children().length==0))},nodeSelect:function(f,d){if(!this.shouldNavigate(d)){f.preventDefault()}var c=a(d);if(!c.hasClass(".t-state-selected")&&!b.trigger(this.element,"select",{item:c.closest(".t-item")[0]})){a(".t-in",this.element).removeClass("t-state-hover t-state-selected");c.addClass("t-state-selected")}},nodeToggle:function(h,d,g){if(h!=null){h.preventDefault()}if(d.data("animating")||!d.find("> div > .t-icon").is(":visible")||d.find("> div > .t-in").hasClass("t-state-disabled")){return}d.data("animating",!g);var c=d.find("> .t-group, > .t-content");var f=!c.is(":visible");if(c.children().length>0&&d.data("loaded")!==false&&!b.trigger(this.element,f?"expand":"collapse",{item:d[0]})){d.find("> div > .t-icon").toggleClass("t-minus",f).toggleClass("t-plus",!f);if(!g){b.fx[f?"play":"rewind"](this.effects,c,{direction:"bottom"},function(){d.data("animating",false)})}else{c[f?"show":"hide"]()}}else{if(f&&this.isAjax()&&(c.length==0||d.data("loaded")===false)){this.ajaxRequest(d)}}},nodeClick:function(g,f){var d=a(f);var c=d.closest(".t-item");if(d.hasClass("t-plus-disabled")||d.hasClass("t-minus-disabled")){return}this.nodeToggle(g,c)},isAjax:function(){return this.ajax||this.ws||this.onDataBinding},url:function(c){return(this.ajax||this.ws)[c]},ajaxOptions:function(c,f){var d={type:"POST",dataType:"text",error:a.proxy(function(h,g){if(b.ajaxError(this.element,"error",h,g)){return}if(g=="parsererror"){alert("Error! The requested URL did not return JSON.")}},this),success:a.proxy(function(g){g=eval("("+g+")");g=g.d||g;t