From 879124da478a7781ac9e81138eaeaf1b2bf52339 Mon Sep 17 00:00:00 2001 From: xXChinnaXx Date: Wed, 4 Jan 2023 01:43:37 +0530 Subject: [PATCH] enhancement: fill empty days of week with next month. #44 --- README.md | 1 + evo-calendar/js/evo-calendar.js | 49 +++++++++++++++++++++++++++-- evo-calendar/js/evo-calendar.min.js | 14 +-------- 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 2cb044f..d144ada 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ Settings | Type | Default | Description | Options theme | string | Default | Define calendar's theme | Default, Midnight Blue, Orange Coral, Royal Navy format | string | 'mm/dd/yyyy' | Date format | Date string format titleFormat | string | 'MM yyyy' | Date format for calendar title | Date string format +fillEmptyDays | boolean | false | fills the empty spaces if any present at start and end of the month with previous and next month dates respectively | true, false eventHeaderFormat | string | 'MM d, yyyy' | Date format for calendar event's title | Date string format firstDayOfWeek | number | 0 | Displayed first day of the week | 0 (Sunday) - 6 (Saturday) language | string | 'en' | Calendar's language | en, es, de, pt, fr, nl diff --git a/evo-calendar/js/evo-calendar.js b/evo-calendar/js/evo-calendar.js index ba2a371..e383b22 100644 --- a/evo-calendar/js/evo-calendar.js +++ b/evo-calendar/js/evo-calendar.js @@ -41,7 +41,8 @@ sidebarToggler: true, eventDisplayDefault: true, eventListToggler: true, - calendarEvents: null + calendarEvents: null, + fillEmptyDays: false, }; _.options = $.extend({}, _.defaults, settings); @@ -725,6 +726,9 @@ markup += ''; var day = 1; + var prev_day = _.$label.days_in_month[_.$active.month - 1] + ? _.$label.days_in_month[_.$active.month - 1] - _.startingDay + : _.$label.days_in_month[11] - _.startingDay; for (var i = 0; i < 9; i++) { // this loop is for is weeks (rows) for (var j = 0; j < _.$label.days.length; j++) { // this loop is for weekdays (cells) if (day <= _.monthLength && (i > 0 || j >= _.startingDay)) { @@ -737,8 +741,49 @@ var thisDay = _.formatDate(_.$label.months[_.$active.month]+' '+day+' '+_.$active.year, _.options.format); markup += '
'+day+'
'; day++; + prev_day=0 } else { - markup += ''; + + var current_month = _.$active.month; + var current_year = _.$active.year; + if (prev_day > 15) { + //assuming that startingDay will not exceed 15 days i.e we don't have to build empty divs more tham 15 per month + if (current_month - 1 < 0) { + current_month = 11; + current_year -= 1; + } else current_month -= 1; + } else { + var current_month = _.$active.month; + var current_year = _.$active.year; + if (current_month + 1 > 11) { + current_month = 0; + current_year += 1; + } else current_month += 1; + } + var dayClass = "calendar-day"; + if ( + _.$label.days[j] === _.initials.weekends.sat || + _.$label.days[j] === _.initials.weekends.sun + ) { + dayClass += " --weekend"; // add '--weekend' to sat sun + } + if (_.options.fillEmptyDays) { + markup += ''; + var thisDay = _.formatDate( + _.$label.months[current_month] + + " " + + (prev_day + 1) + + " " + + current_year, + _.options.format + ); + markup += `
${ + prev_day + 1 + }
`; + prev_day++; + } else { + markup += ""; + } } markup += ''; } diff --git a/evo-calendar/js/evo-calendar.min.js b/evo-calendar/js/evo-calendar.min.js index 0d78008..e26530d 100644 --- a/evo-calendar/js/evo-calendar.min.js +++ b/evo-calendar/js/evo-calendar.min.js @@ -1,13 +1 @@ -/*! - * Evo Calendar - Simple and Modern-looking Event Calendar Plugin - * - * Licensed under the MIT License - * - * Version: 1.1.3 - * Author: Edlyn Villegas - * Docs: https://edlynvillegas.github.com/evo-calendar - * Repo: https://github.com/edlynvillegas/evo-calendar - * Issues: https://github.com/edlynvillegas/evo-calendar/issues - * - */ -!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"undefined"!=typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(d){"use strict";var i,r=window.EvoCalendar||{};i=0,(r=function(e,t){var a=this;if(a.defaults={theme:null,format:"mm/dd/yyyy",titleFormat:"MM yyyy",eventHeaderFormat:"MMd, yyyy",firstDayOfWeek:0,language:"en",todayHighlight:!1,sidebarDisplayDefault:!0,sidebarToggler:!0,eventDisplayDefault:!0,eventListToggler:!0,calendarEvents:null},a.options=d.extend({},a.defaults,t),a.initials={default_class:d(e)[0].classList.value,validParts:/dd?|DD?|mm?|MM?|yy(?:yy)?/g,dates:{en:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],noEventForToday:"No event for today.. so take a rest! :)",noEventForThisDay:"No event for this day.. so take a rest! :)",previousYearText:"Previous year",nextYearText:"Next year",closeSidebarText:"Close sidebar",closeEventListText:"Close event list"},es:{days:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],daysShort:["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"],daysMin:["Do","Lu","Ma","Mi","Ju","Vi","Sa"],months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],monthsShort:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],noEventForToday:"No hay evento para hoy.. ¡así que descanse! :)",noEventForThisDay:"Ningún evento para este día.. ¡así que descanse! :)",previousYearText:"Año anterior",nextYearText:"El próximo año",closeSidebarText:"Cerrar la barra lateral",closeEventListText:"Cerrar la lista de eventos"},de:{days:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],daysShort:["So","Mo","Di","Mi","Do","Fr","Sa"],daysMin:["So","Mo","Di","Mi","Do","Fr","Sa"],months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],monthsShort:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],noEventForToday:"Keine Veranstaltung für heute.. also ruhen Sie sich aus! :)",noEventForThisDay:"Keine Veranstaltung für diesen Tag.. also ruhen Sie sich aus! :)",previousYearText:"Vorheriges Jahr",nextYearText:"Nächstes Jahr",closeSidebarText:"Schließen Sie die Seitenleiste",closeEventListText:"Schließen Sie die Ereignisliste"},pt:{days:["Domingo","Segunda-Feira","Terça-Feira","Quarta-Feira","Quinta-Feira","Sexta-Feira","Sábado"],daysShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],daysMin:["Do","2a","3a","4a","5a","6a","Sa"],months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthsShort:["Jan","Feb","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],noEventForToday:"Nenhum evento para hoje.. então descanse! :)",noEventForThisDay:"Nenhum evento para este dia.. então descanse! :)",previousYearText:"Ano anterior",nextYearText:"Próximo ano",closeSidebarText:"Feche a barra lateral",closeEventListText:"Feche a lista de eventos"},fr:{days:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],daysShort:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"],daysMin:["Di","Lu","Ma","Me","Je","Ve","Sa"],months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],monthsShort:["Jan","Fév","Mar","Avr","Mai","Juin","Juil","Août","Sept","Oct","Nov","Déc"],noEventForToday:"Rien pour aujourd'hui... Belle journée :)",noEventForThisDay:"Rien pour ce jour-ci... Profite de te réposer :)",previousYearText:"Année précédente",nextYearText:"L'année prochaine",closeSidebarText:"Fermez la barre latérale",closeEventListText:"Fermer la liste des événements"},nl:{days:["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"],daysShort:["Zon","Maan","Din","Woe","Don","Vrij","Zat"],daysMin:["Zo","Ma","Di","Wo","Do","Vr","Za"],months:["Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"],monthsShort:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Aug","Sep","Okt","Nov","Dec"],noEventForToday:"Geen event voor vandaag.. dus rust even uit! :)",noEventForThisDay:"Geen event voor deze dag.. dus rust even uit! :)",previousYearText:"Vorig jaar",nextYearText:"Volgend jaar",closeSidebarText:"Sluit de zijbalk",closeEventListText:"Sluit de event lijst"},id:{days:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"],daysShort:["Min","Sen","Sel","Rab","Kam","Jum","Sab"],daysMin:["Mi","Sn","Sl","Ra","Ka","Ju","Sa"],months:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],monthsShort:["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Agu","Sep","Okt","Nov","Des"],noEventForToday:"Tidak ada Acara untuk Sekarang.. Jadi Beristirahatlah! :)",noEventForThisDay:"Tidak ada Acara untuk Hari Ini.. Jadi Beristirahatlah! :)",previousYearText:"Tahun Sebelumnya",nextYearText:"Tahun Berikutnya",closeSidebarText:"Tutup Sidebar",closeEventListText:"Tutup Daftar Acara"}}},a.initials.weekends={sun:a.initials.dates[a.options.language].daysShort[0],sat:a.initials.dates[a.options.language].daysShort[6]},null!=a.options.calendarEvents)for(var n=0;nt){for(var n=e.split(" "),i=0;i=new Date(e)},r.prototype.hasSameDayEventType=function(e,t){for(var a=this,n=0,i=0;i 

 
    ',a=0;a'+e.initials.dates[e.options.language].months[a]+"";t+="
",t+="
",t+='
';for(a=0;a'+e.$label.days[a]+""}t+="
",t+='

',e.$elements.calendarEl.html(t),e.$elements.sidebarEl||(e.$elements.sidebarEl=d(e.$elements.calendarEl).find(".calendar-sidebar")),e.$elements.innerEl||(e.$elements.innerEl=d(e.$elements.calendarEl).find(".calendar-inner")),e.$elements.eventEl||(e.$elements.eventEl=d(e.$elements.calendarEl).find(".calendar-events")),e.options.sidebarToggler&&(d(e.$elements.sidebarEl).append(''),e.$elements.sidebarToggler||(e.$elements.sidebarToggler=d(e.$elements.sidebarEl).find("span#sidebarToggler"))),e.options.eventListToggler&&(d(e.$elements.calendarEl).append(''),e.$elements.eventListToggler||(e.$elements.eventListToggler=d(e.$elements.calendarEl).find("span#eventListToggler")))}e.buildSidebarYear(),e.buildSidebarMonths(),e.buildCalendar(),e.buildEventList(),e.initEventListener(),e.resize()},r.prototype.buildEventList=function(){var e,t=this,a=!1;t.$active.events=[];var n=t.formatDate(t.$active.date,t.options.eventHeaderFormat,t.options.language);t.$elements.eventEl.find(".event-header > p").text(n);n=t.$elements.eventEl.find(".event-list");if(0',t.$active.date===t.$current.date?e+="

"+t.initials.dates[t.options.language].noEventForToday+"

":e+="

"+t.initials.dates[t.options.language].noEventForThisDay+"

",e+=""),n.append(e)},r.prototype.addEventList=function(e){var t,a=this,n=a.$elements.eventEl.find(".event-list");0===n.find("[data-event-index]").length&&n.empty(),a.$active.events.push(e),t='
',t+='
"),t+="

",e.description&&(t+='

'+e.description+"

"),t+="
",t+="
",n.append(t),a.$elements.eventEl.find('[data-event-index="'+e.id+'"]').off("click.evocalendar").on("click.evocalendar",a.selectEvent)},r.prototype.removeEventList=function(e){var t,a=this,n=a.$elements.eventEl.find(".event-list");0!==n.find('[data-event-index="'+e+'"]').length&&(n.find('[data-event-index="'+e+'"]').remove(),0===n.find("[data-event-index]").length&&(n.empty(),a.$active.date===a.$current.date?t+="

"+a.initials.dates[a.options.language].noEventForToday+"

":t+="

"+a.initials.dates[a.options.language].noEventForThisDay+"

",n.append(t)))},r.prototype.buildSidebarYear=function(){this.$elements.sidebarEl.find(".calendar-year > p").text(this.$active.year)},r.prototype.buildSidebarMonths=function(){this.$elements.sidebarEl.find(".calendar-months > [data-month-val]").removeClass("active-month"),this.$elements.sidebarEl.find('.calendar-months > [data-month-val="'+this.$active.month+'"]').addClass("active-month")},r.prototype.buildCalendar=function(){var e,t=this;t.calculateDays(),r=t.formatDate(new Date(t.$label.months[t.$active.month]+" 1 "+t.$active.year),t.options.titleFormat,t.options.language),t.$elements.innerEl.find(".calendar-table th").text(r),t.$elements.innerEl.find(".calendar-body").remove(),e+='';for(var a=1,n=0;n<9;n++){for(var i,o=0;o=t.startingDay)?(i="calendar-day",t.$label.days[o]!==t.initials.weekends.sat&&t.$label.days[o]!==t.initials.weekends.sun||(i+=" --weekend"),e+='',e+='
'+a+"
",a++):e+="",e+=""}if(a>t.monthLength)break;e+=''}e+="",t.$elements.innerEl.find(".calendar-table").append(e),t.options.todayHighlight&&t.$elements.innerEl.find("[data-date-val='"+t.$current.date+"']").addClass("calendar-today"),t.$elements.innerEl.find(".calendar-day").children().off("click.evocalendar").on("click.evocalendar",t.selectDate);var r=t.$elements.innerEl.find("[data-date-val='"+t.$active.date+"']");r&&(t.$elements.innerEl.children().removeClass("calendar-active"),r.addClass("calendar-active")),null!=t.options.calendarEvents&&t.buildEventIndicator()},r.prototype.addEventIndicator=function(t){var a,n,i=this,e=t.date,o=i.stringCheck(t.type);if(e instanceof Array){if(t.everyYear)for(var r=0;r'),0===n.find("span.event-indicator > .type-bullet > .type-"+o).length&&(a='
.type-bullet > .type-'+n).parent().remove())}},r.prototype.buildEventIndicator=function(){this.$elements.innerEl.find(".calendar-day > day > .event-indicator").empty();for(var e=0;et){for(var n=e.split(" "),i=0;i=new Date(e))},a.prototype.hasSameDayEventType=function(e,t){for(var a=0,n=0;n0},a.prototype.setTheme=function(t){var a=this,n=a.options.theme;a.options.theme=t.toLowerCase().split(" ").join("-"),a.options.theme&&e(a.$elements.calendarEl).removeClass(n),"default"!==a.options.theme&&e(a.$elements.calendarEl).addClass(a.options.theme)},a.prototype.resize=function(){var t=this;t.windowW=e(window).width(),t.windowW<=t.$breakpoints.tablet?(t.toggleSidebar(!1),t.toggleEventList(!1),t.windowW<=t.$breakpoints.mobile?e(window).off("click.evocalendar.evo-"+t.instanceUid):e(window).on("click.evocalendar.evo-"+t.instanceUid,e.proxy(t.toggleOutside,t))):(t.options.sidebarDisplayDefault?t.toggleSidebar(!0):t.toggleSidebar(!1),t.options.eventDisplayDefault?t.toggleEventList(!0):t.toggleEventList(!1),e(window).off("click.evocalendar.evo-"+t.instanceUid))},a.prototype.initEventListener=function(){e(window).off("resize.evocalendar.evo-"+this.instanceUid).on("resize.evocalendar.evo-"+this.instanceUid,e.proxy(this.resize,this)),this.options.sidebarToggler&&this.$elements.sidebarToggler.off("click.evocalendar").on("click.evocalendar",this.toggleSidebar),this.options.eventListToggler&&this.$elements.eventListToggler.off("click.evocalendar").on("click.evocalendar",this.toggleEventList),this.$elements.sidebarEl.find("[data-month-val]").off("click.evocalendar").on("click.evocalendar",this.selectMonth),this.$elements.sidebarEl.find("[data-year-val]").off("click.evocalendar").on("click.evocalendar",this.selectYear),this.$elements.eventEl.find("[data-event-index]").off("click.evocalendar").on("click.evocalendar",this.selectEvent)},a.prototype.destroyEventListener=function(){e(window).off("resize.evocalendar.evo-"+this.instanceUid),e(window).off("click.evocalendar.evo-"+this.instanceUid),this.options.sidebarToggler&&this.$elements.sidebarToggler.off("click.evocalendar"),this.options.eventListToggler&&this.$elements.eventListToggler.off("click.evocalendar"),this.$elements.innerEl.find(".calendar-day").children().off("click.evocalendar"),this.$elements.sidebarEl.find("[data-month-val]").off("click.evocalendar"),this.$elements.sidebarEl.find("[data-year-val]").off("click.evocalendar"),this.$elements.eventEl.find("[data-event-index]").off("click.evocalendar")},a.prototype.calculateDays=function(){var e,t,a,n=this;for(n.monthLength=n.$label.days_in_month[n.$active.month],1==n.$active.month&&(n.$active.year%4==0&&n.$active.year%100!=0||n.$active.year%400==0)&&(n.monthLength=29),e=n.initials.dates[n.options.language].daysShort,t=n.options.firstDayOfWeek;n.$label.days.length
 

 
    ';for(var n=0;n'+a.initials.dates[a.options.language].months[n]+"";t+="
",t+="
",t+='
';for(var n=0;n'+a.$label.days[n]+""}t+="
",t+='

',a.$elements.calendarEl.html(t),a.$elements.sidebarEl||(a.$elements.sidebarEl=e(a.$elements.calendarEl).find(".calendar-sidebar")),a.$elements.innerEl||(a.$elements.innerEl=e(a.$elements.calendarEl).find(".calendar-inner")),a.$elements.eventEl||(a.$elements.eventEl=e(a.$elements.calendarEl).find(".calendar-events")),a.options.sidebarToggler&&(e(a.$elements.sidebarEl).append(''),a.$elements.sidebarToggler||(a.$elements.sidebarToggler=e(a.$elements.sidebarEl).find("span#sidebarToggler"))),a.options.eventListToggler&&(e(a.$elements.calendarEl).append(''),a.$elements.eventListToggler||(a.$elements.eventListToggler=e(a.$elements.calendarEl).find("span#eventListToggler")))}a.buildSidebarYear(),a.buildSidebarMonths(),a.buildCalendar(),a.buildEventList(),a.initEventListener(),a.resize()},a.prototype.buildEventList=function(){var e,t=this,a=!1;t.$active.events=[];var n=t.formatDate(t.$active.date,t.options.eventHeaderFormat,t.options.language);t.$elements.eventEl.find(".event-header > p").text(n);var i=t.$elements.eventEl.find(".event-list");if(i.children().length>0&&i.empty(),t.options.calendarEvents){for(var s=0;s',t.$active.date===t.$current.date?e+="

"+t.initials.dates[t.options.language].noEventForToday+"

":e+="

"+t.initials.dates[t.options.language].noEventForThisDay+"

",e+="
"),i.append(e)},a.prototype.addEventList=function(e){var t,a=this.$elements.eventEl.find(".event-list");0===a.find("[data-event-index]").length&&a.empty(),this.$active.events.push(e),t='
',t+='
"),t+="

",e.description&&(t+='

'+e.description+"

"),t+="
",t+="
",a.append(t),this.$elements.eventEl.find('[data-event-index="'+e.id+'"]').off("click.evocalendar").on("click.evocalendar",this.selectEvent)},a.prototype.removeEventList=function(e){var t,a=this.$elements.eventEl.find(".event-list");0!==a.find('[data-event-index="'+e+'"]').length&&(a.find('[data-event-index="'+e+'"]').remove(),0===a.find("[data-event-index]").length&&(a.empty(),this.$active.date===this.$current.date?t+="

"+this.initials.dates[this.options.language].noEventForToday+"

":t+="

"+this.initials.dates[this.options.language].noEventForThisDay+"

",a.append(t)))},a.prototype.buildSidebarYear=function(){this.$elements.sidebarEl.find(".calendar-year > p").text(this.$active.year)},a.prototype.buildSidebarMonths=function(){this.$elements.sidebarEl.find(".calendar-months > [data-month-val]").removeClass("active-month"),this.$elements.sidebarEl.find('.calendar-months > [data-month-val="'+this.$active.month+'"]').addClass("active-month")},a.prototype.buildCalendar=function(){this.calculateDays(),t=this.formatDate(new Date(this.$label.months[this.$active.month]+" 1 "+this.$active.year),this.options.titleFormat,this.options.language),this.$elements.innerEl.find(".calendar-table th").text(t),this.$elements.innerEl.find(".calendar-body").remove(),e+='';for(var e,t,a=1,n=this.$label.days_in_month[this.$active.month-1]?this.$label.days_in_month[this.$active.month-1]-this.startingDay:this.$label.days_in_month[11]-this.startingDay,i=0;i<9;i++){for(var s=0;s0||s>=this.startingDay)){var o="calendar-day";(this.$label.days[s]===this.initials.weekends.sat||this.$label.days[s]===this.initials.weekends.sun)&&(o+=" --weekend"),e+='';var r=this.formatDate(this.$label.months[this.$active.month]+" "+a+" "+this.$active.year,this.options.format);e+='
'+a+"
",a++,n=0}else{var l=this.$active.month,d=this.$active.year;if(n>15)l-1<0?(l=11,d-=1):l-=1;else{var l=this.$active.month,d=this.$active.year;l+1>11?(l=0,d+=1):l+=1}var o="calendar-day";if((this.$label.days[s]===this.initials.weekends.sat||this.$label.days[s]===this.initials.weekends.sun)&&(o+=" --weekend"),this.options.fillEmptyDays){e+='';var r=this.formatDate(this.$label.months[l]+" "+(n+1)+" "+d,this.options.format);e+=`
${n+1}
`,n++}else e+=""}e+=""}if(a>this.monthLength)break;e+=''}e+="",this.$elements.innerEl.find(".calendar-table").append(e),this.options.todayHighlight&&this.$elements.innerEl.find("[data-date-val='"+this.$current.date+"']").addClass("calendar-today"),this.$elements.innerEl.find(".calendar-day").children().off("click.evocalendar").on("click.evocalendar",this.selectDate);var c=this.$elements.innerEl.find("[data-date-val='"+this.$active.date+"']");c&&(this.$elements.innerEl.children().removeClass("calendar-active"),c.addClass("calendar-active")),null!=this.options.calendarEvents&&this.buildEventIndicator()},a.prototype.addEventIndicator=function(e){var t,a,n=this,i=e.date,s=n.stringCheck(e.type);if(i instanceof Array){if(e.everyYear)for(var o=0;o'),0===a.find("span.event-indicator > .type-bullet > .type-"+s).length&&(t='
.type-bullet > .type-'+n).parent().remove())}},a.prototype.buildEventIndicator=function(){this.$elements.innerEl.find(".calendar-day > day > .event-indicator").empty();for(var e=0;e=0&&t<=a.$label.months.length&&(a.$active.month=t.toString()):a.$active.month=e(t.currentTarget).data("monthVal"),a.buildSidebarMonths(),a.buildCalendar(),a.windowW<=a.$breakpoints.tablet&&a.$UI.hasSidebar&&a.toggleSidebar(!1),e(a.$elements.calendarEl).trigger("selectMonth",[a.initials.dates[a.options.language].months[a.$active.month],a.$active.month])},a.prototype.selectDate=function(t){var a,n,i,s,o,r=this,l=r.$active.date;"string"==typeof t||"number"==typeof t||t instanceof Date?(a=r.formatDate(new Date(t),r.options.format),n=new Date(a).getFullYear(),i=new Date(a).getMonth(),r.$active.year!==n&&r.selectYear(n),r.$active.month!==i&&r.selectMonth(i),s=r.$elements.innerEl.find("[data-date-val='"+a+"']")):a=(s=e(t.currentTarget)).data("dateVal"),o=r.$active.date===a,r.$active.date=a,r.$active.event_date=a,r.$elements.innerEl.find("[data-date-val]").removeClass("calendar-active"),s.addClass("calendar-active"),o||r.buildEventList(),e(r.$elements.calendarEl).trigger("selectDate",[r.$active.date,l])},a.prototype.getActiveDate=function(){return this.$active.date},a.prototype.getActiveEvents=function(){return this.$active.events},a.prototype.toggleOutside=function(e){var t;t=e.target===this.$elements.innerEl[0],this.$UI.hasSidebar&&t&&this.toggleSidebar(!1),this.$UI.hasEvent&&t&&this.toggleEventList(!1)},a.prototype.toggleSidebar=function(t){var a=this;void 0===t||t.originalEvent?(e(a.$elements.calendarEl).toggleClass("sidebar-hide"),a.$UI.hasSidebar=!a.$UI.hasSidebar):t?(e(a.$elements.calendarEl).removeClass("sidebar-hide"),a.$UI.hasSidebar=!0):(e(a.$elements.calendarEl).addClass("sidebar-hide"),a.$UI.hasSidebar=!1),a.windowW<=a.$breakpoints.tablet&&a.$UI.hasSidebar&&a.$UI.hasEvent&&a.toggleEventList()},a.prototype.toggleEventList=function(t){var a=this;void 0===t||t.originalEvent?(e(a.$elements.calendarEl).toggleClass("event-hide"),a.$UI.hasEvent=!a.$UI.hasEvent):t?(e(a.$elements.calendarEl).removeClass("event-hide"),a.$UI.hasEvent=!0):(e(a.$elements.calendarEl).addClass("event-hide"),a.$UI.hasEvent=!1),a.windowW<=a.$breakpoints.tablet&&a.$UI.hasEvent&&a.$UI.hasSidebar&&a.toggleSidebar()},a.prototype.addCalendarEvent=function(e){var t=this;function a(e){if(e.id||console.log('%c Event named: "'+e.name+"\" doesn't have a unique ID ","color:white;font-weight:bold;background-color:#e21d1d;"),e.date instanceof Array)for(var a=0;a=0){var n=t.options.calendarEvents[a];t.options.calendarEvents.splice(a,1),t.removeEventList(e),t.removeEventIndicator(n)}else console.log("%c "+e+": ID not found ","color:white;font-weight:bold;background-color:#e21d1d;")}if(e instanceof Array)for(var n=0;n