mirror of https://github.com/Radarr/Radarr
1 line
6.5 KiB
JavaScript
1 line
6.5 KiB
JavaScript
|
(function(c){var a=c.telerik;a.combobox=function(f,p){c.extend(this,p);var d=f.nodeName.toLowerCase()=="input"&&f.type.toLowerCase()=="text";var q=f.nodeName.toLowerCase()=="select";if((d||q)&&!c(f).parent().hasClass("t-combobox")){if(q&&!this.data){this.data=a.list.retrieveData(f)}var j=new a.list.htmlBuilder(f,"t-combobox",q);j.text=function(s){var t=s.builder;t.buffer=[];return c(t.cat('<input class="t-input" autocomplete="off" type="text" ').catIf('value="',s.text,'" ',s.text).catIf('name="',s.name,'-input" ',s.name).cat("/>").string())};j.render();if(q){f=f.previousSibling}}this.element=f;var o=this.$element=c(f);this.loader=new a.list.loader(this);this.trigger=new a.list.trigger(this);var g=this.$wrapper=o.closest(".t-combobox");var e=this.$wrapper.find(".t-select");var n=c.browser.msie?"paste":"input";var i=this.$text=this.$wrapper.find("> .t-dropdown-wrap > .t-input").attr("autocomplete","off").bind(n,c.proxy(function(v){var s=v.target.value;if(c.browser.msie){var u=f.document.selection.createRange().text;var t=window.clipboardData.getData("Text");if(u&&u.length>0){s=s.replace(u,t)}else{s+=t}}this.$element.val(s);m(this)},this));var l=function(u){var s="class",t=o.attr(s);if(t!=i.attr(s)){i.attr(s,t).addClass("t-input")}};if(c.browser.msie){f.attachEvent("onpropertychange",l)}else{o.bind("DOMAttrModified",l)}if(!o.attr("disabled")){e.bind("click",c.proxy(h,this))}this.filtering=new a.list.filtering(this);this.filtering.autoFill=function(s,t){if(s.autoFill&&(s.lastKeyCode!=8&&s.lastKeyCode!=46)){var u=s.$text[0];var y=a.caretPos(u);var x=u.value.substring(0,y);var w=t.toLowerCase().indexOf(x.toLowerCase());if(w!=-1){var v=t.substring(w+x.length);u.value=x+v;a.list.selection(u,y,y+v.length)}}};this.dropDown=new a.dropDown({attr:this.dropDownAttr,effects:this.effects,onOpen:c.proxy(function(){var t=this.data;var s=this.dropDown;if(t.length==0){return}var v=this.$text.val();var u=this.selectedIndex;if(u!=-1&&this.isFiltered){if(v==t[u].Text){this.filteredDataIndexes=[];s.onItemCreate=null;s.dataBind(this.data);this.select(s.$items[u])}else{this.filters[this.filter](this,this.data,v)}this.isFiltered=false}},this),onClick:c.proxy(function(s){this.select(s.item);this.trigger.change();this.trigger.close();i.focus()},this)});this.dropDown.$element.css("direction",g.closest(".t-rtl").length?"rtl":"");this.enable=function(){g.removeClass("t-state-disabled");i.removeAttr("disabled");e.bind("click",c.proxy(h,this))};this.disable=function(){g.addClass("t-state-disabled");i.attr("disabled","disabled");e.unbind("click")};this.fill=function(t){function v(B){var A=B.selectedValue||B.value();if(A){B.value(A);return}var C=s.$items;var E=B.index;var D=C.filter(".t-state-selected");var F=D.length;var G=E!=-1&&E<C.length?C[E]:F>0?D[F-1]:null;if(G){B.select(G)}else{B.selectedIndex=-1;if(B.highlightFirst){B.highlight(C[0])}}}var w=this.loader;var s=this.dropDown;var y=this.minChars;var x=this.text();var u=x.length;if(!s.$items&&!w.ajaxError){if(w.isAjax()&&u>=y){var z={};z[this.queryString.text]=x;w.ajaxRequest(function(A){this.dataBind(A,true);v(this);a.trigger(this.element,"dataBound");this.trigger.change();if(t){t()}},{data:z})}else{this.dataBind(this.data,true);v(this);if(t){t()}}}};this.reload=function(){this.dropDown.$items=null;this.fill()};this.select=function(t){var s=this.highlight(t);if(s==-1){return s}var u=this.filteredDataIndexes;this.selectedIndex=(u&&u.length)>0?u[s]:s;a.list.updateTextAndValue(this,c(this.dropDown.$items[s]).text(),this.data[this.selectedIndex].Value)};this.text=function(){return this.$text.val.apply(this.$text,arguments)};this.value=function(){if(arguments.length){var t=arguments[0];var s=this.select(function(u){return t==(u.Value||u.Text)});if(s==-1){this.selectedIndex=s;this.$element.val(t);this.text(t)}this.previousValue=this.$element.val()}else{return this.$element.val()}};a.list.common.call(this);a.list.filters.call(this);a.list.initialize.call(this);c(document.documentElement).bind("mousedown",c.proxy(function(v){var s=this.dropDown.$element;var t=s&&s.parent().length>0;if(c.contains(this.$wrappe
|