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