mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
1 line
15 KiB
JavaScript
1 line
15 KiB
JavaScript
|
(function(a){var b=a.telerik,e=/{0:?/,c=/{0:?(\S|\s)*}/;b.scripts.push("telerik.calendar.js");function d(h,g,f){var i=new b.datetime();if(h){i=new b.datetime(h)}if(g>i.value){i=new b.datetime(g)}else{if(f<i.value){i=new b.datetime(f)}}return b.datetime.firstDayOfMonth(i)}a.extend(b,{calendar:function(f,j){this.element=f;a.extend(this,j);var i=new b.datetime(this.minDate);var h=new b.datetime(this.maxDate);this.currentView=b.calendar.views[0];this.viewedMonth=d(this.selectedDate,this.minDate,this.maxDate);var g=new b.stringBuilder().cat('<a href="#" class="t-link t-nav-prev').catIf(" t-state-disabled",this.currentView.compare(this.viewedMonth,i,false)<=0).cat('">').cat('<span class="t-icon t-arrow-prev"></span></a><a href="#" class="t-link t-nav-fast">').cat(this.currentView.title(this.viewedMonth)).cat("</a>").cat('<a href="#" class="t-link t-nav-next').catIf(" t-state-disabled",this.currentView.compare(this.viewedMonth,h,true)>=0).cat('"><span class="t-icon t-arrow-next"></span></a>');a(".t-header",this.element).html(g.string());a(".t-nav-next:not(.t-state-disabled)",f).live("click",a.proxy(this.navigateToFuture,this));a(".t-nav-prev:not(.t-state-disabled)",f).live("click",a.proxy(this.navigateToPast,this));a(".t-nav-fast:not(.t-state-disabled)",f).live("click",a.proxy(this.navigateUp,this));a(".t-link.t-state-disabled",f).live("click",b.preventDefault);a("td:not(.t-state-disabled):has(.t-link)",f).live("mouseenter",b.hover).live("mouseleave",b.leave).live("click",a.proxy(this.navigateDown,this));b.bind(this,{change:this.onChange,load:this.onLoad})}});b.calendar.prototype={stopAnimation:false,updateSelection:function(){var g=b.datetime.firstDayOfMonth(this.viewedMonth).toDate();var h=new b.datetime(g).date(32).date(0).toDate();if(this.selectedDate===null||!b.calendar.isInRange(this.selectedDate,g,h)){var j=d(this.selectedDate,this.minDate,this.maxDate);this.goToView(0,j)}var i=this;var f=a(".t-content td:not(.t-other-month)",this.element).removeClass("t-state-selected");if(this.selectedDate!==null){f.filter(function(){return(parseInt(a(this).text(),10)==i.selectedDate.getDate())}).addClass("t-state-selected")}},value:function(){if(arguments.length==0){return this.selectedDate}if(arguments.length==1){this.selectedDate=arguments[0]===null?null:new Date(arguments[0].value?arguments[0].value:arguments[0])}else{if(arguments.length>1){this.selectedDate=new Date(arguments[0],arguments[1],arguments[2])}}this.updateSelection();return this},overlay:function(f){if(!f){return a(".t-overlay",this.element).remove()}a("<div/>").addClass("t-overlay").css({opacity:0,width:this.element.offsetWidth,height:this.element.offsetHeight,position:"absolute",top:0,left:0,zIndex:3,backgroundColor:"#fff"}).appendTo(this.element)},goToView:function(i,h){if(i<0||b.calendar.views.length<=i){return}var g=new b.datetime(this.minDate);var f=new b.datetime(this.maxDate);if(typeof h!="undefined"){h=h.value?h:new b.datetime(h);this.viewedMonth=b.datetime.firstDayOfMonth(h)}this.currentView=b.calendar.views[i];a(".t-nav-prev",this.element).toggleClass("t-state-disabled",this.currentView.compare(h,g,false)<=0);a(".t-nav-next",this.element).toggleClass("t-state-disabled",this.currentView.compare(h,f,true)>=0);a(".t-nav-fast",this.element).html(this.currentView.title(h)).toggleClass("t-state-disabled",i==b.calendar.views.length-1);a(".t-content",this.element).html(this.currentView.body(h,g,f,this.selectedDate?new b.datetime(this.selectedDate):null,this.urlFormat,this.dates)).toggleClass("t-meta-view",i==1||i==2);return this},navigateVertically:function(v,u,s,t){u=new b.datetime(u);this.viewedMonth=b.datetime.firstDayOfMonth(u);this.currentView=b.calendar.views[v];this.overlay(true);var k=new b.datetime(this.minDate);var h=new b.datetime(this.maxDate);var m=a(".t-content",this.element);var q=m.outerWidth();var o=m.outerHeight();var n=m.css("font-size");var p=m.css("line-height");if(p==="normal"){p=parseInt(n)*1.5}m.find("td").removeClass("t-state-hover");a(".t-nav-fast",this.element).html(this.currentView.title(u)).toggleClass("t-state-disabled",v==b.calendar.v
|