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.
Prowlarr/NzbDrone.Web/Scripts/2010.2.825/telerik.tabstrip.min.js

1 line
3.4 KiB

(function(a){var b=a.telerik;a.extend(b,{tabstrip:function(c,d){this.element=c;var e=a(c);a.extend(this,d);var h=".t-tabstrip-items > .t-item:not(.t-state-disabled)";e.delegate(h,"mouseenter",b.hover).delegate(h,"mouseleave",b.leave).delegate(h,d.activateEvent,b.delegate(this,this._click)).delegate("> .t-reset > .t-item.t-state-disabled > .t-link","click",b.preventDefault);b.bind(this,{select:a.proxy(function(i){if(i.target==this.element&&this.onSelect){this.onSelect(i)}},this),error:this.onError,load:this.onLoad});var g=e.find("li.t-state-active");var f=this.getContentElement(e.find("> .t-content"),g.parent().children().index(g));if(f&&f.length>0&&f.children().length==0){this.activateTab(g.eq(0))}}});a.extend(b.tabstrip.prototype,{select:function(c){a(c).each(a.proxy(function(e,f){var d=a(f);if(d.is(".t-state-disabled,.t-state-active")){return}this.activateTab(d)},this))},enable:function(c){a(c).addClass("t-state-default").removeClass("t-state-disabled")},disable:function(c){a(c).removeClass("t-state-default").removeClass("t-state-active").addClass("t-state-disabled")},reload:function(d){var c=this;var e=a("> .t-content",this.element);a(d).each(function(){var g=a(this);var f=g.find(".t-link").data("ContentUrl");if(f){c.ajaxRequest(g,c.getContentElement(e,g.index()),null,f)}})},_click:function(j,f){var h=a(f);var c=h.find(".t-link");var d=c.attr("href");var g=a(this.getContentElement(a("> .t-content",this.element),h.parent().children().index(h)));if(h.is(".t-state-disabled,.t-state-active")){j.preventDefault();return}if(b.trigger(this.element,"select",{item:h[0],contentElement:g[0]})){j.preventDefault()}var i=(d&&(d.charAt(d.length-1)=="#"||d.indexOf("#"+this.element.id+"-")!=-1));if(i||(g.length>0&&g.children().length==0)||g.length==0){j.preventDefault()}else{return}if(this.activateTab(h)){j.preventDefault()}},activateTab:function(d){var f=d.parent().children().removeClass("t-state-active").addClass("t-state-default").index(d);d.removeClass("t-state-default").addClass("t-state-active");var h=d.parent().parent().find("> .t-content");if(h.length>0){var e=h.filter(".t-state-active");var j=this.getContentElement(h,f);var g=this;if(!j){e.removeClass("t-state-active");b.fx.rewind(g.effects,e,{});return false}var c=a.trim(j.html()).length==0;var i=function(){j.addClass("t-state-active");b.fx.play(g.effects,j,{})};e.removeClass("t-state-active").stop(false,true);b.fx.rewind(g.effects,e,{},function(){if(d.hasClass("t-state-active")){if(!c){i()}else{if(c){g.ajaxRequest(d,j,function(){if(d.hasClass("t-state-active")){i()}})}}}});return true}return false},getContentElement:function(g,f){var d=new RegExp("-"+(f+1)+"$");for(var c=0,e=g.length;c<e;c++){if(d.test(a(g[c]).attr("id"))){return a(g[c])}}},ajaxRequest:function(d,c,j,e){var i=this;var h=null;var g=setTimeout(function(){h=a('<span class="t-icon t-loading"></span>').prependTo(d.find(".t-link"))},100);var f={};a.ajax({type:"GET",cache:false,url:e||d.find(".t-link").attr("href"),dataType:"html",data:f,error:a.proxy(function(l,k){if(b.ajaxError(this.element,"error",l,k)){return}},this),complete:function(){clearTimeout(g);if(h!==null){h.remove()}},success:a.proxy(function(k,n){c.html(k);var l=d.find(".t-link");var m=l.attr("href");if(m&&m!="#"){l.data("ContentUrl",m).attr("href","#")}if(j){j.call(i,c)}},this)})}});a.fn.tTabStrip=function(c){return b.create(this,{name:"tTabStrip",init:function(d,e){return new b.tabstrip(d,e)},options:c})};a.fn.tTabStrip.defaults={activateEvent:"click",effects:b.fx.toggle.defaults()}})(jQuery);