1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00
Radarr/NzbDrone.Web/Scripts/2010.3.1318/telerik.calendar.min.js

1 line
14 KiB
JavaScript
Raw Normal View History

(function(c){var b=c.telerik;function a(g,f,d){var e=new b.datetime();if(g){e=new b.datetime(g.toDate())}if(f.value>e.value){e=new b.datetime(f.value)}else{if(d.value<e.value){e=new b.datetime(d.value)}}return b.datetime.firstDayOfMonth(e)}c.extend(b,{calendar:function(d,e){this.element=d;c.extend(this,e);this.currentView=b.calendar.views[0];this.viewedMonth=a(this.selectedDate,this.minDate,this.maxDate);var f=new b.stringBuilder().cat('<a href="#" class="t-link t-nav-prev ').catIf("t-state-disabled",this.currentView.compare(this.viewedMonth,this.minDate,false)<=0).cat('">').cat('<span class="t-icon t-arrow-prev"></span></a><a href="#" class="t-link t-nav-fast">').cat(b.calendar.views[0].title(this.viewedMonth)).cat("</a>").cat('<a href="#" class="t-link t-nav-next ').catIf("t-state-disabled",this.currentView.compare(this.viewedMonth,this.maxDate,true)>=0).cat('"><span class="t-icon t-arrow-next"></span></a>');c(".t-header",this.element).html(f.string());c(".t-nav-next:not(.t-state-disabled)",d).live("click",c.proxy(this.navigateToFuture,this));c(".t-nav-prev:not(.t-state-disabled)",d).live("click",c.proxy(this.navigateToPast,this));c(".t-nav-fast:not(.t-state-disabled)",d).live("click",c.proxy(this.navigateUp,this));c(".t-link.t-state-disabled",d).live("click",b.preventDefault);c("td:not(.t-state-disabled):has(.t-link)",d).live("mouseenter",b.hover).live("mouseleave",b.leave).live("click",c.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);var f=new b.datetime(g.value).date(32).date(0);if(this.selectedDate===null||!b.calendar.isInRange(this.selectedDate,g,f)){var e=a(this.selectedDate,this.minDate,this.maxDate);this.goToView(0,e)}var d=this;var h=c(".t-content td:not(.t-other-month)",this.element).removeClass("t-state-selected");if(this.selectedDate!==null){h.filter(function(){return(parseInt(c(this).text(),10)==d.selectedDate.date())}).addClass("t-state-selected")}},value:function(){if(arguments.length==0){return this.selectedDate===null?null:this.selectedDate.toDate()}if(arguments.length==1){this.selectedDate=arguments[0]===null?null:arguments[0].value?arguments[0]:new b.datetime(arguments[0])}else{if(arguments.length>1){this.selectedDate=new b.datetime(arguments[0],arguments[1],arguments[2])}}this.updateSelection();return this},overlay:function(d){if(!d){return c(".t-overlay",this.element).remove()}c("<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(d,e){if(d<0||b.calendar.views.length<=d){return}if(typeof e!="undefined"){this.viewedMonth=b.datetime.firstDayOfMonth(e)}this.currentView=b.calendar.views[d];c(".t-nav-prev",this.element).toggleClass("t-state-disabled",this.currentView.compare(e,this.minDate,false)<=0);c(".t-nav-next",this.element).toggleClass("t-state-disabled",this.currentView.compare(e,this.maxDate,true)>=0);c(".t-nav-fast",this.element).html(this.currentView.title(this.viewedMonth)).toggleClass("t-state-disabled",d==b.calendar.views.length-1);c(".t-content",this.element).html(this.currentView.body(this.viewedMonth,this.minDate,this.maxDate,this.selectedDate,this.urlFormat,this.dates)).toggleClass("t-meta-view",d==1||d==2);return this},navigateVertically:function(e,g,h,p){this.viewedMonth=b.datetime.firstDayOfMonth(g);this.currentView=b.calendar.views[e];this.overlay(true);var o=c(".t-content",this.element);var f=o.outerWidth();var m=o.outerHeight();var i=o.css("font-size");var q=o.css("line-height");if(q==="normal"){q=parseInt(i)*1.5}o.find("td").removeClass("t-state-hover");c(".t-nav-fast",this.element).html(this.currentView.title(g)).toggleClass("t-state-disabled",e==b.calendar.views.length-1);c(".t-nav-prev",this.element).toggleClass("t-state-disabled",this.currentView.compare(this.viewedMonth,this.minDate,false)<=0);c(".t-nav-next",this.element).toggleClass("t-state-disabled"