Radarr/packages/TelerikMvcExtensions.2011.3.../content/Scripts/2011.3.1115/telerik.list.min.js

1 line
11 KiB
JavaScript
Raw Normal View History

2011-11-23 01:51:44 +00:00
(function(a){var b=a.telerik;var e=/\s+/;b.scripts.push("telerik.list.js");b.list={htmlBuilder:function(i,h,k){var n,m,j=i.id,l=i.name,g=new b.stringBuilder(),f=a(i);if(k){m=f.find("option:selected").text();n=f.val()}else{m=i.value}function o(){return a(['<div class="t-widget',h,'t-header"></div>'].join(" "))}this.render=function(){f.wrap(o()).hide();var p=a('<div class="t-dropdown-wrap t-state-default"></div>').insertBefore(f);this.text({builder:g,text:m,id:j,name:l}).appendTo(p);a('<span class="t-select"><span class="t-icon t-arrow-down">select</span></span>').appendTo(p);if(k){g.buffer=[];a(g.cat('<input style="display:none;" type="text" ').catIf('value="',n,'" ',n).catIf('name="',l,'" ',l).cat("/>").string()).insertAfter(p)}};this.text=function(p){return a(['<span class="t-input">',p.text||"&nbsp;","</span>"].join(""))}},initialize:function(){this.previousValue=this.value();b.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.loader.isAjax()&&(!this.data||this.data.length==0)){return}var f=this.$wrapper||this.$element,g=this.dropDown,h=g.$element.css("z-index");var i={offset:f.offset(),outerHeight:f.outerHeight(),outerWidth:f.outerWidth(),zIndex:h&&h!="auto"?h:b.getElementZIndex(f[0])};if(g.$items){g.open(i)}else{this.fill(function(){g.open(i)})}};this.close=function(){this.dropDown.close()};this.dataBind=function(f,l){this.data=f=(f||[]);var h=-1;for(var g=0,k=f.length;g<k;g++){var j=f[g];if(j){if(j.Selected){h=g}}}this.dropDown.dataBind(f,this.encoded);if(h!=-1){this.index=h;this.select(h)}if(!l){this.text("");this.$element.val("");if(this.filteredDataIndexes){this.filteredDataIndexes=null}}};this.highlight=function(f){var k=function(i){var l=i.dropDown;i.close();if(!l.$items){l.dataBind(i.data,i.encoded)}l.$items.removeClass("t-state-selected").eq(h).addClass("t-state-selected")};var h=-1;if(!this.data){return h}if(!isNaN(f-0)){if(f>-1&&f<this.data.length){h=f;k(this)}}else{if(a.isFunction(f)){for(var g=0,j=this.data.length;g<j;g++){if(f(this.data[g])){h=g;break}}if(h!=-1){k(this)}}else{h=this.dropDown.highlight(f)}}return h}},filtering:function(){this.filter=function(g){g.isFiltered=true;var o=true,h=g.data,l=g.$text[0],r=l.value,s=g.trigger,i=g.dropDown;r=this.multiple(r);if(r.length<g.minChars){return}var k=g.filter;if(g.loader.isAjax()){if(g.cache&&h&&h.length>0){g.filters[k](g,h,r);var j=g.filteredDataIndexes;if((j&&j.length>0)||(k==0&&g.selectedIndex!=-1)){o=false}}if(o){var p={};p[g.queryString.text]=r;g.loader.ajaxRequest(function(u){var w=g.trigger;var v=g.dropDown;if(u&&u.length==0){v.close();v.dataBind();return}g.data=u;b.trigger(g.element,"dataBound");g.filters[k](g,u,r);var t=v.$items;if(t.length>0){if(!v.isOpened()){w.open()}g.filtering.autoFill(g,t.first().text())}else{w.close()}},{data:p})}}else{o=false;g.filters[k](g,g.data,r)}if(!o){var f=i.$items;if(!f){return}var m=f.length,q=g.selectedIndex;var n=k==0?q!=-1?f[q].innerText||f[q].textContent:"":f.length>0?f.first().text():"";this.autoFill(g,n);if(m==0){s.close()}else{if(!i.isOpened()){s.open()}}}};this.multiple=function(f){return f}},filters:function(){this.filters=[function f(h,j,m){if(!j||j.length==0){return}var k=h.dropDown;var g=k.$items;if(!g||g.length==0||h.loader.isAjax()){k.dataBind(j,h.encoded);g=k.$items}for(var l=0,o=j.length;l<o;l++){if(j[l].Text.slice(0,m.length).toLowerCase()==m.toLowerCase()){var n=g[l];h.selectedIndex=l;k.highlight(n);k.scrollTo(n);return}}g.removeClass("t-state-selected");h.selectedIndex=-1;b.list.highlightFirstOnFilter(h,g)},c(false,function(g,h){return h.slice(0,g.length).toLowerCase()==g.toLowerCase()}),c(true,function(g,h){return h&&h.toLowerCase().indexOf(g.toLowerCase())!=-1})]},loader:function(g){this.ajaxError=false;this.component=g;this.isAjax=function(){return g.ajax||g.ws||g.onDataBinding};function f(h,i){var j={url:(g.ajax||g.ws)["selectUrl"],type:"POST",data:{},dataType:"text",error:function(l,k){g.loader.ajaxError=true;if(b.ajaxError