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/2011.3.1115/telerik.combobox.min.js

1 line
7.0 KiB

(function(a){var b=a.telerik;b.scripts.push("telerik.combobox.js");b.combobox=function(h,n){a.extend(this,n);var k=h.nodeName.toLowerCase()=="input"&&h.type.toLowerCase()=="text";var j=h.nodeName.toLowerCase()=="select";if((k||j)&&!a(h).parent().hasClass("t-combobox")){if(j&&!this.data){this.data=b.list.retrieveData(h)}var i=new b.list.htmlBuilder(h,"t-combobox",j);i.text=function(s){var r=s.builder;r.buffer=[];return a(r.cat('<input class="t-input" autocomplete="off" type="text" ').catIf('value="',s.text,'" ',s.text).catIf('name="',s.name,'-input" ',s.name).cat("/>").string())};i.render();if(j){h=h.previousSibling}}this.element=h;var d=this.$element=a(h);this.loader=new b.list.loader(this);this.trigger=new b.list.trigger(this);var g=this.$wrapper=d.closest(".t-combobox");var e=this.$wrapper.find(".t-select");var f=this.$text=this.$wrapper.find("> .t-dropdown-wrap > .t-input").attr("autocomplete","off").bind("paste",a.proxy(function(r){setTimeout(a.proxy(function(){this.$element.val(r.target.value);o(this)},this),0)},this));var q=function(t){var r="class",s=d.attr(r);if((t.attrName&&t.attrName=="class")||(t.propertyName&&t.propertyName=="className")){if(s!=f.attr(r)){f.attr(r,s).addClass("t-input")}}};if(a.browser.msie){h.attachEvent("onpropertychange",q)}else{d.bind("DOMAttrModified",q)}d.closest("form").bind("reset",a.proxy(function(r){var s=this;window.setTimeout(function(){if(d.val()!=""){s.value(d.val())}else{s.highlight(0);s.selectedIndex=0}},1)},this));this.filtering=new b.list.filtering(this);this.filtering.autoFill=function(r,v){if(r.autoFill&&(r.lastKeyCode!=8&&r.lastKeyCode!=46)){var u=r.$text[0];var s=b.caretPos(u);var t=u.value.substring(0,s);var w=v.toLowerCase().indexOf(t.toLowerCase());if(w!=-1){var x=v.substring(w+t.length);u.value=t+x;b.list.selection(u,s,s+x.length)}}};this.dropDown=new b.dropDown({attr:this.dropDownAttr,effects:this.effects,onOpen:a.proxy(function(){var r=this.data;var s=this.dropDown;if(r.length==0){return}var u=this.$text.val();var t=this.selectedIndex;if(t!=-1&&this.isFiltered){if(u==r[t].Text){this.filteredDataIndexes=[];s.onItemCreate=null;if(this.filter){s.dataBind(this.data,this.encoded)}this.select(s.$items[t])}else{this.filters[this.filter](this,this.data,u)}this.isFiltered=false}},this),onClick:a.proxy(function(r){this.select(r.item);this.trigger.change();this.trigger.close();f.focus()},this)});this.dropDown.$element.css("direction",g.closest(".t-rtl").length?"rtl":"");this.enable=function(){g.removeClass("t-state-disabled");f.removeAttr("disabled");d.removeAttr("disabled");if(!e.data("events")){e.bind("click",a.proxy(p,this))}};this.disable=function(){g.addClass("t-state-disabled");f.attr("disabled","disabled");d.attr("disabled","disabled");e.unbind("click")};this[this.enabled?"enable":"disable"]();this.fill=function(r){function y(B){var F=B.selectedValue||B.value();if(F){B.value(F);return}var z=s.$items;var D=B.index;var A=z.filter(".t-state-selected");var E=A.length;var C=D!=-1&&D<z.length?z[D]:E>0?A[E-1]:null;if(C){B.select(C)}else{B.selectedIndex=-1;if(B.highlightFirst){B.highlight(z[0])}}}var t=this.loader;var s=this.dropDown;var u=this.minChars;var w=this.text();var x=w.length;if(!s.$items&&!t.ajaxError){if((t.isAjax()||this.onDataBinding)&&x>=u){var v={};v[this.queryString.text]=w;t.ajaxRequest(function(z){this.dataBind(z,true);y(this);b.trigger(this.element,"dataBound");this.trigger.change();if(r){r()}},{data:v})}else{this.dataBind(this.data,true);y(this);if(r){r()}}}};this.reload=function(){this.dropDown.$items=null;this.fill()};this.select=function(u){var t=this.highlight(u);if(t!=-1){var s=this.filteredDataIndexes;this.selectedIndex=(s&&s.length)>0?s[t]:t;var r=this.data[this.selectedIndex];b.list.updateTextAndValue(this,r.Text,r.Value)}return t};this.text=function(){return this.$text.val.apply(this.$text,arguments)};this.value=function(){if(arguments.length){var s=arguments[0];var r=this.select(function(t){return s==(t.Value||t.Text)});if(r==-1){this.selectedIndex=r;this.$element.val(s);this.text(s)}this.previousValue=this.$element.val()}else{return this.$eleme