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.
Lidarr/packages/TelerikMvcExtensions.2011.3.../content/Scripts/2011.3.1115/telerik.timepicker.min.js

1 line
7.1 KiB

(function(a){var b=a.telerik;b.scripts.push("telerik.timepicker.js");b.timeView=function(d){a.extend(this,d);var c=this.dropDown=new b.dropDown({attr:this.dropDownAttr,effects:this.effects,onClick:function(f){var g=f.item;d.onChange(g.innerText||g.textContent)}});c.$element.addClass("t-time-popup").css("direction",this.isRtl?"rtl":"")};b.timeView.prototype={_ensureItems:function(){if(!this.dropDown.$items){this.bind()}},open:function(c){this._ensureItems();this.dropDown.open(c)},close:function(){this.dropDown.close()},bind:function(){var g=b.timeView.getTimeMilliseconds;var d=[];var e=this.format;var j=this.interval;var p=new b.datetime(this.minValue);var m=g(p);var l=g(this.maxValue);var k=j*b.datetime.msPerMinute;var n=parseInt(b.datetime.msPerDay/(j*b.datetime.msPerMinute));if(m!=l){var o=m<l?l-m:l+b.datetime.msPerDay-m;n=parseInt(o/k)+1}var c=b.datetime.add;var f=b.datetime.format;for(var h=0;h<n;h++){d[h]=f(p.toDate(),e);p=c(p,k)}if(g(p)-k-l!=0&&m!=l){d[n]=f(this.maxValue,e)}this.dropDown.dataBind(d)},isOpened:function(){return this.dropDown.isOpened()},value:function(e){this._ensureItems();var d=this.dropDown;if(e===undefined){return d.$items.filter(".t-state-selected").text()}var c=d.$items;if(!c){return}c.removeClass("t-state-selected");if(e){d.highlight(a.grep(c,function(f){return(f.innerText||f.textContent)==e}))}},navigate:function(h){var i=h.keyCode||h.which;if(i==38||i==40){h.preventDefault()}this._ensureItems();var g=this.dropDown;var d=g.$items;var f=d.filter(".t-state-selected");var c=f.length==0||d.length==1?d.first():(i==38)?f.prev():(i==40)?f.next():[];if(c.length){var j=c.text();g.scrollTo(c[0]);g.highlight(c[0]);if(!g.isOpened()){this.onChange(j)}else{this.onNavigateWithOpenPopup(j)}}}};a.each(["min","max"],a.proxy(function(c,d){b.timeView.prototype[d]=function(f){var e=d+"Value";if(f===undefined){return this[e]}this[e]=new Date(f.value?f.value:f);this.bind()}},this));a.extend(b.timeView,{isInRange:function(j,e,d){if(j===null){return true}var c=b.timeView.getTimeMilliseconds;var h=b.datetime.msPerDay;var i=c(j);var g=c(e);var f=c(d);i=g>i?i+h:i;f=g>f?f+h:f;return g-f==0||i>=g&&i<=f},getTimeMilliseconds:function(c){c=c.value?c:new b.datetime(c);return((c.hours()*60)+c.minutes())*b.datetime.msPerMinute+c.seconds()*1000+c.milliseconds()}});b.timepicker=function(f,g){a.extend(this,g);if(f.nodeName.toLowerCase()!=="input"&&f.type.toLowerCase()!=="text"){throw"Target element is not a INPUT"}this.element=f;var c=this.$element=a(f).addClass("t-input").attr("autocomplete","off").bind({keydown:a.proxy(this._keydown,this),focus:a.proxy(function(j){if(this.openOnFocus){this._open()}this.$element.removeClass("t-state-error")},this),blur:a.proxy(function(j){this._bluring=setTimeout(a.proxy(function(){this._update(c.val())},this),100)},this)});if(!c.parent().hasClass("t-picker-wrap")){c.wrap('<div class="t-widget t-timepicker"><div class="t-picker-wrap"></div></div>');if(g.showButton){var d=new b.stringBuilder(),h=g.buttonTitle;a(d.cat('<span class="t-select">').cat('<span class="t-icon t-icon-clock" ').catIf('title="',h).catIf(h,h).cat('"></span></span>').string()).insertAfter(c)}}this.timeView=new b.timeView({effects:this.effects,dropDownAttr:this.dropDownAttr,format:this.format,interval:this.interval,isRtl:c.closest(".t-rtl").length,minValue:this.minValue,maxValue:this.maxValue,onNavigateWithOpenPopup:a.proxy(function(j){this.$element.val(j)},this),onChange:a.proxy(function(j){clearTimeout(this._bluring);if(j!=this.inputValue){this._update(j)}this._close();window.setTimeout(function(){c.focus()},1)},this)});this.inputValue=c.val();var i=this.selectedValue||this.inputValue;if(i){this._value(this.parse(i))}var e=this.enabled?a.proxy(this._togglePopup,this):b.preventDefault;this.$wrapper=c.closest(".t-timepicker").find(".t-icon").bind("click",e).end();a(document.documentElement).bind("mousedown",a.proxy(function(k){var m=this.$element.val();if(m!=this.inputValue){this._update(m)}var j=this.timeView.dropDown.$element;var l=j&&j.parent().length>0;if(!l||a.contains(this.$wrapper[0],k.target)||a.contains(j.parent()[0]