Lidarr/NzbDrone.Web/Scripts/2010.3.1318/telerik.list.min.js

1 line
9.7 KiB
JavaScript
Raw Normal View History

(function(e){var a=e.telerik;var b=/\s+/;a.list={initialize:function(){this.previousValue=this.value();a.bind(this,{dataBinding:this.onDataBinding,dataBound:this.onDataBound,error:this.onError,open:this.onOpen,close:this.onClose,valueChange:this.onChange,load:this.onLoad});e(document.documentElement).bind("mousedown",e.proxy(function(h){var f=this.dropDown.$element;var g=f&&f.parent().length>0;if(e.contains(this.element,h.target)||(g&&e.contains(f.parent()[0],h.target))){return}this.trigger.change();this.trigger.close()},this))},common:function(){this.open=function(){if(this.data.length==0){return}var h=this.$element;var f=this.dropDown;var g={offset:h.offset(),outerHeight:h.outerHeight(),outerWidth:h.outerWidth(),zIndex:a.getElementZIndex(h[0])};if(f.$items){f.open(g)}else{this.fill(function(){f.open(g)})}};this.close=function(){this.dropDown.close()};this.dataBind=function(h,f){this.data=h=(h||[]);var j=!!this.loader.isAjax();for(var g=0,k=h.length;g<k;g++){var l=h[g];if(l.Selected){this.index=g}if(this.encoded&&j&&!this.onDataBinding){h[g].Text=a.encode(l.Text)}}this.dropDown.dataBind(h);if(!f){this.text("");this.$input.val("")}};this.highlight=function(j){var h=function(m){var l=m.previousValue;var i=m.dropDown;m.close();i.dataBind(m.data);m.previousValue=l;i.$items.removeClass("t-state-selected").eq(f).addClass("t-state-selected")};var f=-1;if(!this.data){return f}if(!isNaN(j-0)){if(j>-1&&j<this.data.length){f=j;h(this)}}else{if(e.isFunction(j)){for(var g=0,k=this.data.length;g<k;g++){if(j(this.data[g])){f=g;break}}if(f!=-1){h(this)}}else{f=this.dropDown.highlight(j)}}return f}},filtering:function(){this.filter=function(m){m.isFiltered=true;var s=true;var f=m.data;var q=m.$text[0];var j=q.value;var o=m.trigger;var l=m.dropDown;j=this.multiple(j);if(j.length<m.minChars){return}var k=m.filter;if(m.loader.isAjax()){if(m.cache&&f&&f.length>0){m.filters[k](m,f,j);var g=m.filteredDataIndexes;if((g&&g.length>0)||(k==0&&m.selectedIndex!=-1)){s=false}}if(s){var p={};p[m.queryString.text]=j;m.loader.ajaxRequest(function(w){var v=m.trigger;var x=m.dropDown;if(w&&w.length==0){x.close();x.dataBind();return}if(m.encoded){for(var t=0,y=w.length;t<y;t++){var z=w[t];if(z.Text){w[t].Text=a.encode(z.Text)}else{w[t]=a.encode(z)}}}m.data=w;a.trigger(m.element,"dataBound");m.filters[k](m,w,j);var u=x.$items;if(u.length>0){if(!x.isOpened()){v.open()}m.filtering.autoFill(m,u.first().text())}else{v.close()}},{data:p})}}else{s=false;m.filters[k](m,m.data,j)}if(!s){var r=l.$items;var h=r.length;var i=m.selectedIndex;var n=k==0?i!=-1?r[i].innerText||r[i].textContent:"":r.length>0?r.first().text():"";this.autoFill(m,n);if(h==0){o.close()}else{if(!l.isOpened()){o.open()}}}};this.multiple=function(f){return f}},filters:function(){this.filters=[function f(g,k,n){if(!k||k.length==0){return}var l=g.dropDown;var j=l.$items;if(j.length==0||g.loader.isAjax()){l.dataBind(k);j=l.$items}for(var h=0,m=k.length;h<m;h++){if(k[h].Text.slice(0,n.length).toLowerCase()==n.toLowerCase()){var o=j[h];g.selectedIndex=h;l.highlight(o);l.scrollTo(o);return}}j.removeClass("t-state-selected");g.selectedIndex=-1;a.list.highlightFirstOnFilter(g,j)},d(false,function(h,g){return g.slice(0,h.length).toLowerCase()==h.toLowerCase()}),d(true,function(h,g){return g&&g.toLowerCase().indexOf(h.toLowerCase())!=-1})]},loader:function(g){this.ajaxError=false;this.component=g;this.isAjax=function(){return g.ajax||g.ws||g.onDataBinding};function f(h,j){var i={url:(g.ajax||g.ws)["selectUrl"],type:"POST",data:{},dataType:"text",error:function(l,k){g.loader.ajaxError=true;if(a.ajaxError(g.element,"error",l,k)){return}},complete:e.proxy(function(){this.hideBusy()},g.loader),success:function(l,m,k){try{l=eval("("+l+")")}catch(n){if(!a.ajaxError(g.element,"error",k,"parseeror")){alert("Error! The requested URL did not return JSON.")}g.loader.ajaxError=true;return}l=l.d||l;if(h){h.call(g,l)}}};e.extend(i,j);if(g.ws){i.data=a.toJson(i.data);i.contentType="application/json; charset=utf-8"}return i}this.ajaxRequest=function(h,i){var j={};if(a.trigger(g.element,"dataBinding",j)){return}if(g.ajax