mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-23 08:13:01 +00:00
1 line
7.7 KiB
JavaScript
1 line
7.7 KiB
JavaScript
|
(function(d){try{if(document.execCommand){document.execCommand("BackgroundImageCache",false,true)}}catch(c){}var b=d.telerik={create:function(e,f){var h=f.name;var g=d.extend({},d.fn[h].defaults,f.options);return e.each(function(){var i=d(this);g=d.meta?d.extend({},g,i.data()):g;if(!i.data(h)){var j=f.init(this,g);i.data(h,j);b.trigger(this,"load");if(f.success){f.success(j)}}})},toJson:function(e){var f=[];for(var h in e){var g=e[h];if(typeof g!="object"){f.push('"'+h+'":"'+g+'"')}else{f.push('"'+h+'":'+this.toJson(g))}}return"{"+f.join(",")+"}"},delegate:function(f,e){return function(g){e.apply(f,[g,this])}},stop:function(e,f){return function(g){g.stopPropagation();e.apply(f||this,arguments)}},stopAll:function(e,f){return function(g){g.preventDefault();g.stopPropagation();e.apply(f||this,arguments)}},bind:function(e,f){var g=d(e.element);d.each(f,function(h){if(d.isFunction(this)){g.bind(h,this)}})},preventDefault:function(f){f.preventDefault()},hover:function(){d(this).addClass("t-state-hover")},leave:function(){d(this).removeClass("t-state-hover")},buttonHover:function(){d(this).addClass("t-button-hover")},buttonLeave:function(){d(this).removeClass("t-button-hover")},stringBuilder:function(){this.buffer=[]},ajaxError:function(h,g,e,i){var f=this.trigger(h,g,{XMLHttpRequest:e,textStatus:i});if(!f){if(i=="error"&&e.status!="0"){alert("Error! The requested URL returned "+e.status+" - "+e.statusText)}if(i=="timeout"){alert("Error! Server timeout.")}}},trigger:function(g,f,h){h=d.extend(h||{},new d.Event(f));h.stopPropagation();d(g).trigger(h);return h.isDefaultPrevented()},getType:function(e){if(e instanceof Date){return"date"}if(!isNaN(e)){return"number"}return"object"},formatString:function(){var j=arguments[0];for(var e=0,f=arguments.length-1;e<f;e++){var h=new RegExp("\\{"+e+"(:([^\\}]+))?\\}","gm");var g=arguments[e+1];var k=this.formatters[this.getType(g)];if(k){var m=h.exec(j);g=k(g,m[2])}j=j.replace(h,function(i){return g})}return j},lastIndexOf:function(e,f){var g=f.length;for(var h=e.length-1;h>-1;h--){if(e.substr(h,g)==f){return h}}return -1},caretPos:function(e){var f=-1;if(document.selection){f=Math.abs(e.document.selection.createRange().moveStart("character",-e.value.length))}else{if(e.selectionStart!==undefined){f=e.selectionStart}}return f},formatters:{},fx:{},cultureInfo:{}};b.datetime=function(){if(arguments.length==0){this.value=new Date()}else{if(arguments.length==1){this.value=new Date(arguments[0])}else{if(arguments.length==3){this.value=new Date(arguments[0],arguments[1],arguments[2])}else{if(arguments.length==6){this.value=new Date(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}else{this.value=new Date(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6])}}}}return this};d.extend(b.datetime,{msPerMinute:60000,msPerDay:86400000,add:function(i,f){var g=i.timeOffset();var h=new b.datetime(i.time()+f);var e=h.timeOffset()-g;return new b.datetime(h.time()+e*b.datetime.msPerMinute)},subtract:function(h,g){g=new b.datetime(g).toDate();var e=h.time()-g;var f=h.timeOffset()-g.timeOffset();return e-(f*b.datetime.msPerMinute)},firstDayOfMonth:function(e){return new b.datetime(0).hours(0).minutes(0).year(e.year(),e.month(),1)},firstVisibleDay:function(e){var f=new b.datetime(e.year(),e.month(),0);while(f.day()!=0){b.datetime.modify(f,-1*b.datetime.msPerDay)}return f},modify:function(i,e){var g=i.timeOffset();var f=new b.datetime(i.time()+e);var h=f.timeOffset()-g;i.time(f.time()+h*b.datetime.msPerMinute)}});b.datetime.prototype={year:function(){if(arguments.length==0){return this.value.getFullYear()}else{if(arguments.length==1){this.value.setFullYear(arguments[0])}else{this.value.setFullYear(arguments[0],arguments[1],arguments[2])}}return this},timeOffset:function(){return this.value.getTimezoneOffset()},day:function(){return this.value.getDay()},toDate:function(){return this.value},addMonth:function(e){this.month(this.month()+e)},addYear:function(e){this.year(this.year()+e)}};d.each(["Month","Date","Hours","Minutes","Seconds","Millisecond
|