Sonarr/NzbDrone.Web/Scripts/2011.1.315/telerik.list.min.js

1 line
11 KiB
JavaScript
Raw Normal View History

2011-03-29 04:52:17 +00:00
(function(e){var a=e.telerik;var b=/\s+/;a.list={htmlBuilder:function(g,f,h){var k,n,l=g.id,m=g.name,o=new a.stringBuilder(),i=e(g);if(h){n=i.find("option:selected").text();k=i.val()}else{n=g.value}function j(){return e(['<div class="t-widget',f,'t-header"></div>'].join(" "))}this.render=function(){i.wrap(j()).hide();var p=e('<div class="t-dropdown-wrap t-state-default"></div>').insertBefore(i);this.text({builder:o,text:n,id:l,name:m}).appendTo(p);e('<span class="t-select"><span class="t-icon t-arrow-down">select</span></span>').appendTo(p);if(h){o.buffer=[];e(o.cat('<input style="display:none;" type="text" ').catIf('value="',k,'" ',k).catIf('name="',m,'" ',m).cat("/>").string()).insertAfter(p)}};this.text=function(p){return e(['<span class="t-input">',p.text||"&nbsp;","</span>"].join(""))}},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})},common:function(){this.open=function(){if(this.data.length==0){return}var g=this.$wrapper||this.$element,f=this.dropDown;var h={offset:g.offset(),outerHeight:g.outerHeight(),outerWidth:g.outerWidth(),zIndex:a.getElementZIndex(g[0])};if(f.$items){f.open(h)}else{this.fill(function(){f.open(h)})}};this.close=function(){this.dropDown.close()};this.dataBind=function(h,f){this.data=h=(h||[]);var l=-1,j=!!this.loader.isAjax();for(var g=0,k=h.length;g<k;g++){var m=h[g];if(m){if(m.Selected){l=g}if(this.encoded&&j&&!this.onDataBinding){h[g].Text=a.encode(m.Text)}}}this.dropDown.dataBind(h);if(l!=-1){this.index=l;this.select(l)}if(!f){this.text("");this.$element.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&&!m.onDataBinding){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;if(!r){return}var h=r.length,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||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:{},dataT