mirror of https://github.com/Radarr/Radarr
1 line
11 KiB
JavaScript
1 line
11 KiB
JavaScript
|
(function(c){var f=c.telerik;var b=parseInt(c.browser.version.substring(0,5).replace(".",""));var d=c.browser.mozilla&&b>=180&&b<=191;f.dropDown=function(i){c.extend(this,i);this.$element=c(new f.stringBuilder().cat("<div ").catIf(i.attr,i.attr).cat(' class="t-popup t-group"><ul class="t-reset">').cat("</ul></div>").string()).hide();var h=this.$element[0];if(!h.style.width){h.style.width=(i.outerWidth?i.outerWidth-2:0)+"px"}if(!h.style.overflowY){h.style.overflowY="auto"}function g(m){var k=new f.stringBuilder();if(m){for(var j=0,n=m.length;j<n;j++){var l=m[j];var o={html:l.Text||l,dataItem:l};if(this.onItemCreate){this.onItemCreate(o)}k.cat('<li class="t-item">').cat(o.html).cat("</li>")}}return k.string()}this.position=function(k,j){this.offset={top:k,left:j}};this.open=function(){if(this.isOpened()||(this.onOpen&&!this.onOpen())){return}var m=this.$element;var k=".t-reset > .t-item";m.delegate(k,"mouseenter",f.hover).delegate(k,"mouseleave",f.leave).delegate(k,"click",c.proxy(function(n){if(this.onClick){this.onClick(c.extend(n,{item:c(n.target).closest(".t-item")[0]}))}},this)).appendTo(document.body);var l=this.offset;l.top+=this.outerHeight;var j=this.zIndex||"auto";if(c.browser.msie&&j=="auto"){j=""}f.fx._wrap(m).css(c.extend({position:"absolute",zIndex:j},this.offset));if(d){m.css("overflow","hidden")}f.fx.play(this.effects,m,{direction:"bottom"},c.proxy(function(){if(d){m.css("overflow","auto")}var n=this.$items.filter(".t-state-selected");if(n.length){this.scrollTo(n[0])}},this))};this.close=function(){if(this.onClose&&!this.onClose()){return}var j=this.$element;if(d){j.css("overflow","hidden")}f.fx.rewind(this.effects,j,{direction:"bottom"},function(){if(d){j.css("overflow","auto")}j.parent().remove()})};this.dataBind=function(k){k=k||[];var n=this.$element;var m=n[0].style.height;var l=m&&m!="auto"?n[0].style.height:"200px";var j=c(g.call(this,k));n.find("> ul").html(j);n.css("height",j.length>10?l:"auto");this.$items=j};this.highlight=function(j){return c(j).addClass("t-state-selected").siblings().removeClass("t-state-selected").end().index()};this.isOpened=function(){return this.$element.is(":visible")};this.scrollTo=function(p){if(!p){return}var j=p.offsetTop;var n=p.offsetHeight;var k=this.$element[0];var l=k.scrollTop;var o=k.clientHeight;var m=j+n;k.scrollTop=l>j?j:m>(l+o)?m-o:l}};f.list={initialize:function(){this.$input=this.$element.find("input:last");this.previousValue=this.value();f.bind(this,{dataBinding:this.onDataBinding,dataBound:this.onDataBound,error:this.onError,open:this.onOpen,close:this.onClose,valueChange:this.onChange,load:this.onLoad});c(document).bind("mousedown",c.proxy(function(i){var g=this.dropDown.$element;var h=g&&g.parent().length>0;if(h&&!c.contains(this.element,i.target)&&!c.contains(g.parent()[0],i.target)){this.trigger.change();this.trigger.close()}},this))},common:function(){this.open=function(){if(this.data.length==0){return}var g=this.dropDown;if(g.$items){g.open()}else{this.fill(function(){g.open()})}};this.close=function(){this.dropDown.close()};this.dataBind=function(g){this.data=g||[];this.dropDown.dataBind(this.data)};this.highlight=function(k){var j=-1;var g=function(m){var i=m.previousValue;m.close();m.dataBind(m.data);m.previousValue=i;m.dropDown.$items.removeClass("t-state-selected").eq(j).addClass("t-state-selected")};if(!isNaN(k-0)){if(k>-1&&k<this.data.length){j=k;g(this)}}else{if(c.isFunction(k)){for(var h=0,l=this.data.length;h<l;h++){if(k(this.data[h])){j=h;break}}if(j!=-1){g(this)}}else{j=this.dropDown.highlight(k)}}return j}},filtering:function(){this.filter=function(n){n.isFiltered=true;var t=true;var g=n.data;var r=n.$text[0];var k=r.value;var p=n.trigger;var m=n.dropDown;k=this.multiple(k);if(k.length<n.minChars){return}var l=n.filter;if(n.loader.isAjax()){if(n.cache&&g&&g.length>0){n.filters[l](n,g,k);var h=n.filteredDataIndexes;if((h&&h.length>0)||(l==0&&n.selectedIndex!=-1)){t=false}}if(t){var q={};q[n.queryString.text]=k;n.loader.ajaxRequest(function(v){var w=n.trigger;var u=n.dropDown;if(v&&v.length==0){n.close();n.dataBind();return}n.data=v;f.t
|