sonarr-repo-only/NzbDrone.Web/Scripts/2010.3.1110/telerik.calendar.min.js

1 line
14 KiB
JavaScript
Raw Normal View History

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