From 20074c2c62c0c27884ab31738995712146f00e0a Mon Sep 17 00:00:00 2001 From: Sergey Romanov Date: Sun, 11 Aug 2013 20:42:43 +0600 Subject: [PATCH] minified version updated --- js/calendar.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/calendar.min.js b/js/calendar.min.js index 078276e7..c05243e4 100644 --- a/js/calendar.min.js +++ b/js/calendar.min.js @@ -1,3 +1,3 @@ /*! bootstrap-calendar 2013-08-11 */ https://github.com/Serhioromano/bootstrap-calendar.git -"use strict";Date.prototype.getWeek=function(){var t=new Date(this.getFullYear(),0,1);return Math.ceil(((this.getTime()-t.getTime())/864e5+t.getDay()+1)/7)},Date.prototype.getMonthFormatted=function(){var t=this.getMonth()+1;return 10>t?"0"+t:t},Date.prototype.getDateFormatted=function(){var t=this.getDate();return 10>t?"0"+t:t},String.prototype.format||(String.prototype.format=function(){var t=arguments;return this.replace(/{(\d+)}/g,function(e,a){return t[a]!==void 0?t[a]:e})}),function(t){function e(e,a){return this.options=t.extend(!0,{},o,e),this.context=a,a.css("width",this.options.width),t.ajaxSetup({dataType:"json",type:"post",async:!1}),this.view.call(this),this}function a(t){var e=t%19,a=Math.floor(t/100),o=t%100,s=Math.floor(a/4),i=a%4,n=Math.floor((a+8)/25),r=Math.floor((a-n+1)/3),p=(19*e+a-s-r+15)%30,l=Math.floor(o/4),h=o%4,d=(32+2*i+2*l-p-h)%7,c=Math.floor((e+11*p+22*d)/451),u=p+d+7*c+114,g=Math.floor(u/31)-1,y=u%31+1;return new Date(t,g,y,0,0,0)}var o={width:"100%",view:"month",day:"now",first_day:1,events_url:"",tmpl_path:"tmpls/",classes:{months:{inmonth:"cal-day-inmonth",outmonth:"cal-day-outmonth",saturday:"cal-day-weekend",sunday:"cal-day-weekend",holidays:"cal-day-holiday",today:"cal-day-today"},week:{workday:"cal-day-workday",saturday:"cal-day-weekend",sunday:"cal-day-weekend",holidays:"cal-day-holiday",today:"cal-day-today"}},holidays:{"08-03":"International Women's Day","25-12":"Christmas's","01-05":"International labor day"},enable_easter_holidays:!1,views:{year:{slide_events:1},month:{slide_events:1}},onAfterEventsLoad:function(){},onBeforeEventsLoad:function(t){t()},onAfterViewLoad:function(){},events:[],position:{start:new Date,end:new Date},templates:{year:"",month:"",week:"",day:""},stop_cycling:!1};e.prototype.setOptions=function(e){t.extend(this.options,e)},e.prototype._render=function(){this.context.html(""),this._loadTemplate(this.options.view),this.stop_cycling=!1;var e={};e.events=[],e.cal=this,e.day=1,e.months=1==this.options.first_day?[language.d1,language.d2,language.d3,language.d4,language.d5,language.d6,language.d0]:[language.d0,language.d1,language.d2,language.d3,language.d4,language.d5,language.d6];var a=parseInt(this.options.position.start.getTime()),o=parseInt(this.options.position.end.getTime());switch(t.each(this.options.events,function(t,s){o>=parseInt(s.start)&&parseInt(s.end)>=a&&e.events.push(s)}),this.options.view){case"month":break;case"week":break;case"day":}e.start=new Date(this.options.position.start.getTime()),e.lang=language,this.context.append(this.options.templates[this.options.view](e)),this._update()},e.prototype._week=function(){this._loadTemplate("week-days");var e={},a=parseInt(this.options.position.start.getTime()),o=parseInt(this.options.position.end.getTime()),s=[],i=this;return t.each(this.options.events,function(t,e){o>=parseInt(e.start)&&parseInt(e.end)>=a&&(e.start_day=new Date(parseInt(e.start)).getDay(),1==i.options.first_day&&(e.start_day=e.start_day-1),0>i.options.start_day&&(e.start_day=0),e.days=864e5>=e.end-e.start?1:(e.end-e.start)/864e5,a>e.start&&(e.days=e.days-(a-e.start)/864e5,e.start_day=0),e.days=Math.ceil(e.days),e.start_day+e.days>7&&(e.days=7-e.start_day),1==i.options.first_day,s.push(e))}),e.events=s,i.options.templates["week-days"](e)},e.prototype._month=function(e){this._loadTemplate("year-month");var a={},o=e+1;a.data_day=this.options.position.start.getFullYear()+"-"+(10>o?"0"+o:o)+"-"+"01",a.month_name=language["m"+e];var s=new Date(this.options.position.start.getFullYear(),e,1,0,0,0),i=parseInt(s.getTime()),n=parseInt(new Date(this.options.position.start.getFullYear(),e+1,0,0,0,0).getTime()),r=[];return t.each(this.options.events,function(t,e){n>=parseInt(e.start)&&parseInt(e.end)>=i&&r.push(e)}),a.events=r,this.options.templates["year-month"](a)},e.prototype._day=function(e,a){this._loadTemplate("month-day");var o={tooltip:""},s=this.options.classes.months.outmonth,i=this.options.position.start.getDay();2==this.options.first_day?i++:i=0==i?7:i,a=a-i+1;var n=new Date(this.options.position.start.getFullYear(),this.options.position.start.getMonth(),a,0,0,0);if(a>0&&(s=this.options.classes.months.inmonth),a+1>this.options.position.end.getDate()&&(this.stop_cycling=!0),a>this.options.position.end.getDate()&&(a-=this.options.position.end.getDate(),s=this.options.classes.months.outmonth),s=t.trim(s+" "+this._getDayClass("months",n)),0>=a){var r=new Date(this.options.position.start.getFullYear(),this.options.position.start.getMonth(),0).getDate();a=r-Math.abs(a),s+=" cal-month-first-row"}var p=this._getHoliday(n);p!==!1&&(o.tooltip=p),o.data_day=n.getFullYear()+"-"+n.getMonthFormatted()+"-"+(10>a?"0"+a:a),o.cls=s,o.day=a;var l=parseInt(n.getTime()),h=parseInt(l+864e5),d=[];return t.each(this.options.events,function(t,e){h>parseInt(e.start)&&parseInt(e.end)>l&&d.push(e)}),o.events=d,this.options.templates["month-day"](o)},e.prototype._getHoliday=function(t){if(this.options.enable_easter_holidays){var e=a(t.getFullYear());if(e.toDateString()==t.toDateString())return language.easter;var o=new Date;if(o.setTime(e.getTime()),o.setDate(e.getDate()+1),o.toDateString()==t.toDateString())return language.easterMonday}if(this.options.holidays){var s=t.getDateFormatted()+"-"+t.getMonthFormatted();if(s in this.options.holidays)return this.options.holidays[s];if(s+="-"+t.getFullYear(),s in this.options.holidays)return this.options.holidays[s]}return!1},e.prototype._getHolidayName=function(t){var e=this._getHoliday(t);return e===!1?"":e},e.prototype._getDayClass=function(t,e){var a=this,o=function(e,o){var s;s=a.options.classes&&t in a.options.classes&&e in a.options.classes[t]?a.options.classes[t][e]:"","string"==typeof s&&s.length&&o.push(s)},s=[];e.toDateString()==(new Date).toDateString()&&o("today",s);var i=this._getHoliday(e);switch(i!==!1&&o("holidays",s),e.getDay()){case 0:o("sunday",s);break;case 6:o("saturday",s)}return s.join(" ")},e.prototype.view=function(t){t&&(this.options.view=t),this._init_position.call(this),this._loadEvents.call(this),this._render.call(this),this.options.onAfterViewLoad.call(this,this.options.view)},e.prototype.navigate=function(e,a){var o=t.extend({},this.options.position);if("next"==e)switch(this.options.view){case"year":o.start.setFullYear(this.options.position.start.getFullYear()+1);break;case"month":o.start.setMonth(this.options.position.start.getMonth()+1);break;case"week":o.start.setDate(this.options.position.start.getDate()+7);break;case"day":o.start.setDate(this.options.position.start.getDate()+1)}else if("prev"==e)switch(this.options.view){case"year":o.start.setFullYear(this.options.position.start.getFullYear()-1);break;case"month":o.start.setMonth(this.options.position.start.getMonth()-1);break;case"week":o.start.setDate(this.options.position.start.getDate()-7);break;case"day":o.start.setDate(this.options.position.start.getDate()-1)}else"today"==e?o.start.setTime((new Date).getTime()):t.error(language.error_where.format(e));this.options.day=o.start.getFullYear()+"-"+o.start.getMonthFormatted()+"-"+o.start.getDateFormatted(),this.view.call(this),_.isFunction(a)&&a()},e.prototype._init_position=function(){var e,a,o;if("now"==this.options.day){var s=new Date;e=s.getFullYear(),a=s.getMonth(),o=s.getDate()}else if(this.options.day.match(/^\d{4}-\d{2}-\d{2}$/g)){var i=this.options.day.split("-");e=i[0],a=i[1]-1,o=i[2]}else t.error(language.error_dateformat.format(this.options.day));switch(this.options.view){case"year":this.options.position.start.setTime(new Date(e,0,1).getTime()),this.options.position.end.setTime(new Date(e,12,0,23,59,59).getTime());break;case"month":this.options.position.start.setTime(new Date(e,a,1).getTime()),this.options.position.end.setTime(new Date(e,a+1,0,23,59,59).getTime());break;case"day":this.options.position.start.setTime(new Date(e,a,o).getTime()),this.options.position.end.setTime(new Date(e,a,o,23,59,59).getTime());break;case"week":var n=new Date(e,a,o),r=n.getDate()-n.getDay();1==this.options.first_day&&(r+=1);var p=r+6;this.options.position.start.setTime(new Date(e,a,r).getTime()),this.options.position.end.setTime(new Date(e,a,p,23,59,59).getTime());break;default:t.error(language.error_noview.format(this.options.view))}return this},e.prototype.getTitle=function(){var t=this.options.position.start;switch(this.options.view){case"year":return language.title_year.format(t.getFullYear());case"month":return language.title_month.format(language["m"+t.getMonth()],t.getFullYear());case"week":return language.title_week.format(t.getWeek(),t.getFullYear());case"day":return language.title_day.format(language["d"+t.getDay()],t.getDate(),language["m"+t.getMonth()],t.getFullYear())}},e.prototype.isToday=function(){var t=(new Date).getTime();return t>this.options.position.start&&this.options.position.end>t},e.prototype.getStartDate=function(){return this.options.position.start},e.prototype.getEndDate=function(){return this.options.position.end},e.prototype._loadEvents=function(){this.options.events_url||t.error(language.error_loadurl);var e=this;this.options.onBeforeEventsLoad(function(){t.ajax({url:e.options.events_url,data:{from:e.options.position.start.getTime(),to:e.options.position.end.getTime()}}).done(function(a){a.success||t.error(a.error),e.options.events=a.result,e.options.onAfterEventsLoad(a.result)})})},e.prototype._loadTemplate=function(e){if(!this.options.templates[e]){var a=this;t.ajax({url:this.options.tmpl_path+e+".html",dataType:"html",type:"GET"}).done(function(t){a.options.templates[e]=_.template(t)})}},e.prototype._update=function(){var e=this;t('*[rel="tooltip"]').tooltip(),t("*[data-cal-date]").click(function(){e.options.day=t(this).data("cal-date"),e.view(t(this).data("cal-view"))}),t(".cal-cell").dblclick(function(){e.options.day=t("[data-cal-date]",this).data("cal-date"),e.view(t("[data-cal-date]",this).data("cal-view"))}),this["_update_"+this.options.view]()},e.prototype._update_day=function(){},e.prototype._update_week=function(){},e.prototype._update_year=function(){this._update_month_year()},e.prototype._update_month=function(){this._update_month_year();var e=t(document.createElement("div")).attr("id","cal-week-box");e.html(language.week);var a=this.options.position.start.getFullYear()+"-"+this.options.position.start.getMonthFormatted()+"-";t(".cal-month-box .cal-row-fluid").each(function(o,s){var i=t(s);i.bind("mouseenter",function(){var o=t(".cal-span1:first-child .cal-month-day",i),s=o.hasClass("cal-month-first-row")?1:t("[data-cal-date]",o).text();s=10>s?"0"+s:s,e.attr("data-cal-week",a+s).show().appendTo(o)}).bind("mouseleave",function(){e.hide()})});var o=this;e.click(function(){o.options.day=t(this).data("cal-week"),o.view("week")}),t("a.event").mouseenter(function(){t("a.event"+t(this).data("event-id")).parents(".cal-span1").addClass("day-highlight dh-"+t(this).data("event-class"))}),t("a.event").mouseleave(function(){t("div.cal-span1").removeClass("day-highlight dh-"+t(this).data("event-class"))})},e.prototype._update_month_year=function(){if(this.options.views[this.options.view].slide_events){var e=0,a=this,o=t(document.createElement("div")).attr("id","cal-day-box").html('');t(".cal-month-day, .cal-year-box .span3").each(function(a,s){t(s).bind("mouseenter",function(){0!=t(".events-list",s).length&&t(s).children("[data-cal-date]").text()!=e&&o.show().appendTo(s)}),t(s).bind("mouseleave",function(){o.hide()})});var s=t(document.createElement("div")).attr("id","cal-slide-box");s.hide().click(function(t){t.stopPropagation()}),this._loadTemplate("events-list"),o.click(function(o){o.stopPropagation();var i=t(this),n=i.parents(".cal-cell"),r=i.parents(".cal-row-fluid"),p=n.data("cal-row");i.fadeOut("fast"),s.html(a.options.templates["events-list"]({events:t(".events-list a.event",n)})).slideUp("fast",function(){r.after(s),e=t("[data-cal-date]",n).text(),t("#cal-slide-tick").addClass("tick"+p).show(),s.slideDown("fast",function(){t("body").one("click",function(){s.slideUp("fast"),e=0})})}),t("a.event-item").mouseenter(function(){t("a.event"+t(this).data("event-id")).parents(".cal-span1").addClass("day-highlight dh-"+t(this).data("event-class"))}),t("a.event-item").mouseleave(function(){t("div.cal-span1").removeClass("day-highlight dh-"+t(this).data("event-class"))})})}},t.fn.calendar=function(t){return new e(t,this)}}(jQuery); \ No newline at end of file +"use strict";Date.prototype.getWeek=function(){var t=new Date(this.getFullYear(),0,1);return Math.ceil(((this.getTime()-t.getTime())/864e5+t.getDay()+1)/7)},Date.prototype.getMonthFormatted=function(){var t=this.getMonth()+1;return 10>t?"0"+t:t},Date.prototype.getDateFormatted=function(){var t=this.getDate();return 10>t?"0"+t:t},String.prototype.format||(String.prototype.format=function(){var t=arguments;return this.replace(/{(\d+)}/g,function(e,a){return t[a]!==void 0?t[a]:e})}),function(t){function e(t,e){var a,o,s;s=t,a=0>t.indexOf("?")?"?":"&";for(o in e)s+=a+o+"="+encodeURIComponent(e[o]),a="&";return s}function a(e,a){return this.options=t.extend(!0,{},s,e),this.context=a,a.css("width",this.options.width),this.view.call(this),this}function o(t){var e=t%19,a=Math.floor(t/100),o=t%100,s=Math.floor(a/4),i=a%4,n=Math.floor((a+8)/25),r=Math.floor((a-n+1)/3),l=(19*e+a-s-r+15)%30,p=Math.floor(o/4),h=o%4,d=(32+2*i+2*p-l-h)%7,c=Math.floor((e+11*l+22*d)/451),u=l+d+7*c+114,g=Math.floor(u/31)-1,y=u%31+1;return new Date(t,g,y,0,0,0)}var s={width:"100%",view:"month",day:"now",first_day:1,events_url:"",tmpl_path:"tmpls/",classes:{months:{inmonth:"cal-day-inmonth",outmonth:"cal-day-outmonth",saturday:"cal-day-weekend",sunday:"cal-day-weekend",holidays:"cal-day-holiday",today:"cal-day-today"},week:{workday:"cal-day-workday",saturday:"cal-day-weekend",sunday:"cal-day-weekend",holidays:"cal-day-holiday",today:"cal-day-today"}},enable_easter_holidays:!1,views:{year:{slide_events:1,enable:1},month:{slide_events:1,enable:1},week:{enable:1},day:{enable:1}},onAfterEventsLoad:function(){},onBeforeEventsLoad:function(t){t()},onAfterViewLoad:function(){},events:[],position:{start:new Date,end:new Date},templates:{year:"",month:"",week:"",day:""},stop_cycling:!1};a.prototype.setOptions=function(e){t.extend(this.options,e)},a.prototype._render=function(){this.context.html(""),this._loadTemplate(this.options.view),this.stop_cycling=!1;var e={};e.events=[],e.cal=this,e.day=1,e.months=1==this.options.first_day?[language.d1,language.d2,language.d3,language.d4,language.d5,language.d6,language.d0]:[language.d0,language.d1,language.d2,language.d3,language.d4,language.d5,language.d6];var a=parseInt(this.options.position.start.getTime()),o=parseInt(this.options.position.end.getTime());switch(t.each(this.options.events,function(t,s){o>=parseInt(s.start)&&parseInt(s.end)>=a&&e.events.push(s)}),this.options.view){case"month":break;case"week":break;case"day":}e.start=new Date(this.options.position.start.getTime()),e.lang=language,this.context.append(this.options.templates[this.options.view](e)),this._update()},a.prototype._week=function(){this._loadTemplate("week-days");var e={},a=parseInt(this.options.position.start.getTime()),o=parseInt(this.options.position.end.getTime()),s=[],i=this;return t.each(this.options.events,function(t,e){o>=parseInt(e.start)&&parseInt(e.end)>=a&&(e.start_day=new Date(parseInt(e.start)).getDay(),1==i.options.first_day&&(e.start_day=e.start_day-1),0>i.options.start_day&&(e.start_day=0),e.days=864e5>=e.end-e.start?1:(e.end-e.start)/864e5,a>e.start&&(e.days=e.days-(a-e.start)/864e5,e.start_day=0),e.days=Math.ceil(e.days),e.start_day+e.days>7&&(e.days=7-e.start_day),1==i.options.first_day,s.push(e))}),e.events=s,i.options.templates["week-days"](e)},a.prototype._month=function(e){this._loadTemplate("year-month");var a={},o=e+1;a.data_day=this.options.position.start.getFullYear()+"-"+(10>o?"0"+o:o)+"-"+"01",a.month_name=language["m"+e];var s=new Date(this.options.position.start.getFullYear(),e,1,0,0,0),i=parseInt(s.getTime()),n=parseInt(new Date(this.options.position.start.getFullYear(),e+1,0,0,0,0).getTime()),r=[];return t.each(this.options.events,function(t,e){n>=parseInt(e.start)&&parseInt(e.end)>=i&&r.push(e)}),a.events=r,this.options.templates["year-month"](a)},a.prototype._day=function(e,a){this._loadTemplate("month-day");var o={tooltip:""},s=this.options.classes.months.outmonth,i=this.options.position.start.getDay();2==this.options.first_day?i++:i=0==i?7:i,a=a-i+1;var n=new Date(this.options.position.start.getFullYear(),this.options.position.start.getMonth(),a,0,0,0);if(a>0&&(s=this.options.classes.months.inmonth),a+1>this.options.position.end.getDate()&&(this.stop_cycling=!0),a>this.options.position.end.getDate()&&(a-=this.options.position.end.getDate(),s=this.options.classes.months.outmonth),s=t.trim(s+" "+this._getDayClass("months",n)),0>=a){var r=new Date(this.options.position.start.getFullYear(),this.options.position.start.getMonth(),0).getDate();a=r-Math.abs(a),s+=" cal-month-first-row"}var l=this._getHoliday(n);l!==!1&&(o.tooltip=l),o.data_day=n.getFullYear()+"-"+n.getMonthFormatted()+"-"+(10>a?"0"+a:a),o.cls=s,o.day=a;var p=parseInt(n.getTime()),h=parseInt(p+864e5),d=[];return t.each(this.options.events,function(t,e){h>parseInt(e.start)&&parseInt(e.end)>p&&d.push(e)}),o.events=d,this.options.templates["month-day"](o)},a.prototype._getHoliday=function(t){if(this.options.enable_easter_holidays){var e=o(t.getFullYear());if(e.toDateString()==t.toDateString())return language.easter;var a=new Date;if(a.setTime(e.getTime()),a.setDate(e.getDate()+1),a.toDateString()==t.toDateString())return language.easterMonday}if(this.options.holidays){var s=t.getDateFormatted()+"-"+t.getMonthFormatted();if(s in this.options.holidays)return this.options.holidays[s];if(s+="-"+t.getFullYear(),s in this.options.holidays)return this.options.holidays[s]}return!1},a.prototype._getHolidayName=function(t){var e=this._getHoliday(t);return e===!1?"":e},a.prototype._getDayClass=function(t,e){var a=this,o=function(e,o){var s;s=a.options.classes&&t in a.options.classes&&e in a.options.classes[t]?a.options.classes[t][e]:"","string"==typeof s&&s.length&&o.push(s)},s=[];e.toDateString()==(new Date).toDateString()&&o("today",s);var i=this._getHoliday(e);switch(i!==!1&&o("holidays",s),e.getDay()){case 0:o("sunday",s);break;case 6:o("saturday",s)}return s.join(" ")},a.prototype.view=function(t){t&&(this.options.view=t),this._init_position.call(this),this._loadEvents.call(this),this._render.call(this),this.options.onAfterViewLoad.call(this,this.options.view)},a.prototype.navigate=function(e,a){var o=t.extend({},this.options.position);if("next"==e)switch(this.options.view){case"year":o.start.setFullYear(this.options.position.start.getFullYear()+1);break;case"month":o.start.setMonth(this.options.position.start.getMonth()+1);break;case"week":o.start.setDate(this.options.position.start.getDate()+7);break;case"day":o.start.setDate(this.options.position.start.getDate()+1)}else if("prev"==e)switch(this.options.view){case"year":o.start.setFullYear(this.options.position.start.getFullYear()-1);break;case"month":o.start.setMonth(this.options.position.start.getMonth()-1);break;case"week":o.start.setDate(this.options.position.start.getDate()-7);break;case"day":o.start.setDate(this.options.position.start.getDate()-1)}else"today"==e?o.start.setTime((new Date).getTime()):t.error(language.error_where.format(e));this.options.day=o.start.getFullYear()+"-"+o.start.getMonthFormatted()+"-"+o.start.getDateFormatted(),this.view.call(this),_.isFunction(a)&&a()},a.prototype._init_position=function(){var e,a,o;if("now"==this.options.day){var s=new Date;e=s.getFullYear(),a=s.getMonth(),o=s.getDate()}else if(this.options.day.match(/^\d{4}-\d{2}-\d{2}$/g)){var i=this.options.day.split("-");e=i[0],a=i[1]-1,o=i[2]}else t.error(language.error_dateformat.format(this.options.day));switch(this.options.view){case"year":this.options.position.start.setTime(new Date(e,0,1).getTime()),this.options.position.end.setTime(new Date(e,12,0,23,59,59).getTime());break;case"month":this.options.position.start.setTime(new Date(e,a,1).getTime()),this.options.position.end.setTime(new Date(e,a+1,0,23,59,59).getTime());break;case"day":this.options.position.start.setTime(new Date(e,a,o).getTime()),this.options.position.end.setTime(new Date(e,a,o,23,59,59).getTime());break;case"week":var n=new Date(e,a,o),r=n.getDate()-n.getDay();1==this.options.first_day&&(r+=1);var l=r+6;this.options.position.start.setTime(new Date(e,a,r).getTime()),this.options.position.end.setTime(new Date(e,a,l,23,59,59).getTime());break;default:t.error(language.error_noview.format(this.options.view))}return this},a.prototype.getTitle=function(){var t=this.options.position.start;switch(this.options.view){case"year":return language.title_year.format(t.getFullYear());case"month":return language.title_month.format(language["m"+t.getMonth()],t.getFullYear());case"week":return language.title_week.format(t.getWeek(),t.getFullYear());case"day":return language.title_day.format(language["d"+t.getDay()],t.getDate(),language["m"+t.getMonth()],t.getFullYear())}},a.prototype.isToday=function(){var t=(new Date).getTime();return t>this.options.position.start&&this.options.position.end>t},a.prototype.getStartDate=function(){return this.options.position.start},a.prototype.getEndDate=function(){return this.options.position.end},a.prototype._loadEvents=function(){this.options.events_url||t.error(language.error_loadurl);var a=this;this.options.onBeforeEventsLoad(function(){t.ajax({url:e(a.options.events_url,{from:a.options.position.start.getTime(),to:a.options.position.end.getTime()}),dataType:"json",type:"GET",async:!1}).done(function(e){e.success||t.error(e.error),a.options.events=e.result||[],a.options.onAfterEventsLoad(e.result)})})},a.prototype._loadTemplate=function(e){if(!this.options.templates[e]){var a=this;t.ajax({url:this.options.tmpl_path+e+".html",dataType:"html",type:"GET",async:!1}).done(function(t){a.options.templates[e]=_.template(t)})}},a.prototype._update=function(){var e=this;t('*[rel="tooltip"]').tooltip(),t("*[data-cal-date]").click(function(){var a=t(this).data("cal-view");e.options.views[a].enable&&(e.options.day=t(this).data("cal-date"),e.view(a))}),t(".cal-cell").dblclick(function(){var a=t("[data-cal-date]",this).data("cal-view");e.options.views[a].enable&&(e.options.day=t("[data-cal-date]",this).data("cal-date"),e.view(a))}),this["_update_"+this.options.view]()},a.prototype._update_day=function(){},a.prototype._update_week=function(){},a.prototype._update_year=function(){this._update_month_year()},a.prototype._update_month=function(){this._update_month_year();var e=t(document.createElement("div")).attr("id","cal-week-box");e.html(language.week);var a=this.options.position.start.getFullYear()+"-"+this.options.position.start.getMonthFormatted()+"-";t(".cal-month-box .cal-row-fluid").each(function(o,s){var i=t(s);i.bind("mouseenter",function(){var o=t(".cal-cell1:first-child .cal-month-day",i),s=o.hasClass("cal-month-first-row")?1:t("[data-cal-date]",o).text();s=10>s?"0"+s:s,e.attr("data-cal-week",a+s).show().appendTo(o)}).bind("mouseleave",function(){e.hide()})});var o=this;e.click(function(){o.options.day=t(this).data("cal-week"),o.view("week")}),t("a.event").mouseenter(function(){t("a.event"+t(this).data("event-id")).parents(".cal-cell1").addClass("day-highlight dh-"+t(this).data("event-class"))}),t("a.event").mouseleave(function(){t("div.cal-cell1").removeClass("day-highlight dh-"+t(this).data("event-class"))})},a.prototype._update_month_year=function(){if(this.options.views[this.options.view].slide_events){var e=0,a=this,o=t(document.createElement("div")).attr("id","cal-day-box").html('');t(".cal-month-day, .cal-year-box .span3").each(function(a,s){t(s).bind("mouseenter",function(){0!=t(".events-list",s).length&&t(s).children("[data-cal-date]").text()!=e&&o.show().appendTo(s)}),t(s).bind("mouseleave",function(){o.hide()})});var s=t(document.createElement("div")).attr("id","cal-slide-box");s.hide().click(function(t){t.stopPropagation()}),this._loadTemplate("events-list"),o.click(function(o){o.stopPropagation();var i=t(this),n=i.parents(".cal-cell"),r=i.parents(".cal-row-fluid"),l=n.data("cal-row");i.fadeOut("fast"),s.html(a.options.templates["events-list"]({events:t(".events-list a.event",n)})).slideUp("fast",function(){r.after(s),e=t("[data-cal-date]",n).text(),t("#cal-slide-tick").addClass("tick"+l).show(),s.slideDown("fast",function(){t("body").one("click",function(){s.slideUp("fast"),e=0})})}),t("a.event-item").mouseenter(function(){t("a.event"+t(this).data("event-id")).parents(".cal-cell1").addClass("day-highlight dh-"+t(this).data("event-class"))}),t("a.event-item").mouseleave(function(){t("div.cal-cell1").removeClass("day-highlight dh-"+t(this).data("event-class"))})})}},t.fn.calendar=function(t){return new a(t,this)}}(jQuery); \ No newline at end of file