!function(t){"function"==typeof define&&define.amd?define(["jquery","moment"],t):"object"==typeof exports?t(require("jquery"),require("moment")):t(jQuery,moment)}(function(t,e){function n(n,i){var o,r;this.element=n,this.options=t.extend(!0,{},a,i),this.options.moment&&(e=this.options.moment),this.validateOptions(),this.constraints={next:!0,today:!0,previous:!0,nextYear:!0,previousYear:!0},this.options.events.length&&(this.options.multiDayEvents?this.options.events=this.addMultiDayMomentObjectsToEvents(this.options.events):this.options.events=this.addMomentObjectToEvents(this.options.events)),this.options.lengthOfTime.months||this.options.lengthOfTime.days?this.options.lengthOfTime.months?(this.options.lengthOfTime.days=null,this.options.lengthOfTime.startDate?this.intervalStart=e(this.options.lengthOfTime.startDate).startOf("month"):this.options.startWithMonth?this.intervalStart=e(this.options.startWithMonth).startOf("month"):this.intervalStart=e().startOf("month"),this.intervalEnd=e(this.intervalStart).add(this.options.lengthOfTime.months,"months").subtract(1,"days"),this.month=this.intervalStart.clone()):this.options.lengthOfTime.days&&(this.options.lengthOfTime.startDate?this.intervalStart=e(this.options.lengthOfTime.startDate).startOf("day"):this.intervalStart=e().weekday(this.options.weekOffset).startOf("day"),this.intervalEnd=e(this.intervalStart).add(this.options.lengthOfTime.days-1,"days").endOf("day"),this.month=this.intervalStart.clone()):(this.month=e().startOf("month"),this.intervalStart=e(this.month),this.intervalEnd=e(this.month).endOf("month")),this.options.startWithMonth&&(this.month=e(this.options.startWithMonth).startOf("month"),this.intervalStart=e(this.month),this.intervalEnd=this.options.lengthOfTime.days?e(this.month).add(this.options.lengthOfTime.days-1,"days").endOf("day"):e(this.month).endOf("month")),this.options.constraints&&(this.options.constraints.startDate&&(r=e(this.options.constraints.startDate),this.options.lengthOfTime.days?(this.intervalStart.isBefore(r,"week")&&(this.intervalStart=r.startOf("week")),(this.intervalStart.diff(this.intervalEnd,"days")
previous
<%= month %> <%= year %>
next
<% for(var i = 0; i < daysOfTheWeek.length; i++) { %><% } %><% for(var i = 0; i < numberOfRows; i++){ %><% for(var j = 0; j < 7; j++){ %><% var d = j + i * 7; %><% } %><% } %>
<%= daysOfTheWeek[i] %>
<%= days[d].day %>
",showAdjacentMonths:!0,trackSelectedDate:!1,formatWeekdayHeader:null,adjacentDaysChangeMonth:!1,ignoreInactiveDaysInSelection:null,lengthOfTime:{days:null,interval:1,months:null},clickEvents:{click:null,today:null,nextYear:null,nextMonth:null,nextInterval:null,previousYear:null,onYearChange:null,previousMonth:null,onMonthChange:null,previousInterval:null,onIntervalChange:null},targets:{day:"day",empty:"empty",nextButton:"clndr-next-button",todayButton:"clndr-today-button",previousButton:"clndr-previous-button",nextYearButton:"clndr-next-year-button",previousYearButton:"clndr-previous-year-button"},classes:{past:"past",today:"today",event:"event",inactive:"inactive",selected:"selected",lastMonth:"last-month",nextMonth:"next-month",adjacentMonth:"adjacent-month"}};n.prototype.init=function(){var n,s;if(this.daysOfTheWeek=this.options.daysOfTheWeek||[],s=this.options.formatWeekdayHeader||s,!this.options.daysOfTheWeek)for(this.daysOfTheWeek=[],s=this.options.formatWeekdayHeader||function(t){return t.format("dd").charAt(0)},n=0;n<7;n++)this.daysOfTheWeek.push(s(e().weekday(n)));if(this.options.weekOffset&&(this.daysOfTheWeek=this.shiftWeekdayLabels(this.options.weekOffset)),!t.isFunction(this.options.render)){if(this.options.render=null,"undefined"==typeof _)throw new Error("Underscore was not found. Please include underscore.js OR provide a custom render function.");this.compiledClndrTemplate=_.template(this.options.template)}t(this.element).html("
"),this.calendarContainer=t(".clndr",this.element),this.bindEvents(),this.render(),this.options.ready&&this.options.ready.apply(this,[])},n.prototype.validateOptions=function(){(this.options.weekOffset>6||this.options.weekOffset<0)&&(console.warn("clndr.js: An invalid offset "+this.options.weekOffset+" was provided (must be 0 - 6); using 0 instead."),this.options.weekOffset=0)},n.prototype.shiftWeekdayLabels=function(t){var e,n=this.daysOfTheWeek;for(e=0;et.month()?(v+=" "+this.options.classes.adjacentMonth,p.isAdjacentMonth=!0,this._currentIntervalStart.year()===t.year()?v+=" "+this.options.classes.lastMonth:v+=" "+this.options.classes.nextMonth):this._currentIntervalStart.month()1)||arguments[1];return this.options.multiDayEvents?this.options.events=t.merge(this.options.events,this.addMultiDayMomentObjectsToEvents(e)):this.options.events=t.merge(this.options.events,this.addMomentObjectToEvents(e)),n&&this.render(),this},n.prototype.removeEvents=function(t){var e;for(e=this.options.events.length-1;e>=0;e--)!0===t(this.options.events[e])&&this.options.events.splice(e,1);return this.render(),this},n.prototype.addMomentObjectToEvents=function(t){var n=0,s=this;for(n;n1)throw new Error("CLNDR does not support multiple elements yet. Make sure your clndr selector returns only one element.");if(!this.length)throw new Error("CLNDR cannot be instantiated on an empty selector.");return this.data("plugin_clndr")?this.data("plugin_clndr"):(e=new n(this,t),this.data("plugin_clndr",e),e)}});