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.
Readarr/NzbDrone.Web/Scripts/2011.1.315/telerik.textbox.min.js

1 line
11 KiB

(function(d){var i=d.telerik,a=[8,9,37,38,39,40,46,35,36,44],b=["font-family","font-size","font-stretch","font-style","font-weight","letter-spacing","line-height","color","text-align","text-decoration","text-indent","text-transform"];function f(l){var o={};for(var k=0,n=b.length;k<n;k++){var m=b[k],j=l.css(m);if(j){if(b[k]!="font-style"&&j!="normal"){o[m]=j}}}return o}i.textbox=function(j,k){if(j.nodeName.toLowerCase()!=="input"&&j.type.toLowerCase()!=="text"){throw"Target element is not a INPUT"}d.extend(this,k);this.element=j;var l=this.$element=d(j).bind({focus:function(q){var p=q.target;setTimeout(function(){if(d.browser.msie){p.select()}else{p.selectionStart=0;p.selectionEnd=p.value.length}},0)},keydown:d.proxy(this._keydown,this),keypress:d.proxy(this._keypress,this)}).bind("paste",d.proxy(this._paste,this));var o=new i.stringBuilder();if(j.parentNode.nodeName.toLowerCase()!=="div"){l.addClass("t-input").wrap(d('<div class="t-widget t-numerictextbox"></div>'));if(this.showIncreaseButton){o.cat('<a class="t-link t-icon t-arrow-up" href="#" tabindex="-1" title="').cat(this.increaseButtonTitle).cat('">Increment</a>')}if(this.showDecreaseButton){o.cat('<a class="t-link t-icon t-arrow-down" href="#" tabindex="-1" title="').cat(this.decreaseButtonTitle).cat('">Decrement</a>')}if(o.buffer.length>0){d(o.string()).insertAfter(l)}}this.$wrapper=l.closest(".t-numerictextbox").find(".t-arrow-up, .t-arrow-down").bind({click:i.preventDefault,dragstart:i.preventDefault}).end().bind({focusin:d.proxy(this._focus,this),focusout:d.proxy(this._blur,this)});this.enabled=!l.is("[disabled]");o.buffer=[];o.cat("[ |").cat(this.groupSeparator).catIf("|"+this.symbol,this.symbol).cat("]");this.replaceRegExp=new RegExp(o.string(),"g");var m=l.attr("value");o.buffer=[];o.cat('<div class="t-formatted-value').cat((m==""&&this.enabled)?" t-state-empty":"").cat('">').cat(m||(this.enabled?this.text:"")).cat("</div>");this.$text=d(o.string()).insertBefore(l).css(f(l)).click(function(p){j.focus()});this._blur();this[this.enabled?"enable":"disable"]();this.numFormat=this.numFormat===undefined?this.type.charAt(0):this.numFormat;var n=this.separator;this.step=this.parse(this.step,n);this.val=this.parse(this.val,n);this.minValue=this.parse(this.minValue,n);this.maxValue=this.parse(this.maxValue,n);this.decimals={"190":".","188":",","110":n};this.value(m||this.val);i.bind(this,{load:this.onLoad,valueChange:this.onChange})};i.textbox.prototype={_paste:function(n){var l=this.$element.val();if(d.browser.msie){var k=this.element.document.selection.createRange().text;var j=window.clipboardData.getData("Text");if(k&&k.length>0){l=l.replace(k,j)}else{l+=j}}if(l=="-"){return true}var m=this.parse(l,this.separator);if(m||m==0){this._update(m)}},_keydown:function(p){var m=p.keyCode,k=this.$element,o=this.separator,j=k.val();setTimeout(d.proxy(function(){k.toggleClass("t-state-error",!this.inRange(this.parse(k.val(),this.separator),this.minValue,this.maxValue))},this));var l=this.decimals[m];if(l){if(l==o&&this.digits>0&&j.indexOf(o)==-1){return true}else{p.preventDefault()}}if(m==8||m==46){setTimeout(d.proxy(function(){this._update(this.parse(k.val()))},this));return true}if(m==38||m==40){var n=m==38?1:-1;this._modify(n*this.step);return true}if(m==222){p.preventDefault()}},_keypress:function(l){var k=d(l.target),j=l.keyCode||l.which;if(l.shiftKey&&j!=45){return false}if(j==0||d.inArray(j,a)!=-1||l.ctrlKey||(l.shiftKey&&j==45)){return true}if(((this.minValue!==null?this.minValue<0:true)&&String.fromCharCode(j)=="-"&&i.caretPos(k[0])==0&&k.val().indexOf("-")==-1)||this.inRange(j,48,57)){setTimeout(d.proxy(function(){var m=this.parse(k.val());if(m!=null&&this.digits){var n=Math.pow(10,this.digits);m=parseInt(m*n)/n}if(this.val!=m){if(i.trigger(this.element,"valueChange",{oldValue:this.val,newValue:m})){m=this.val}this._value(m)}},this));return true}l.preventDefault()},_focus:function(){this.$element.css("color",this.$text.css("color"));this.$text.hide()},_blur:function(){this.$element.css("color",this.$element.css("background-color")).removeClass("t-state-error");if(