From 2452dc33f7ce387081ef1169ac3e135dfd2094d9 Mon Sep 17 00:00:00 2001 From: Carsten Jacobsen Date: Mon, 23 May 2016 22:47:19 +0200 Subject: [PATCH] feat(onNavigation): adding new callback: onNavigation -> triggers when the visible date changes --- dist/datepickk.js | 73 ++++++++++++++++++++++----------------- dist/datepickk.min.js | 2 +- dist/datepickk.min.js.map | 2 +- index.html | 38 ++++++++++++++++---- src/js/datepickk.js | 73 ++++++++++++++++++++++----------------- 5 files changed, 118 insertions(+), 70 deletions(-) diff --git a/dist/datepickk.js b/dist/datepickk.js index f71046d..789ba46 100644 --- a/dist/datepickk.js +++ b/dist/datepickk.js @@ -4,7 +4,7 @@ * (c) 2016 Carsten Jacobsen */ (function(){ - + function Datepickk(args){ Datepickk.numInstances = (Datepickk.numInstances || 0) + 1; var that = this; @@ -31,7 +31,7 @@ weekStart:1 } }; - + var range = false; var maxSelections = null; var container = document.body; @@ -40,6 +40,7 @@ var closeOnSelect = false; var button = null; var title = null; + var onNavigation = null; var onClose = null; var onConfirm = null; var closeOnClick = true; @@ -56,7 +57,7 @@ var minDate = null; var maxDate = null; var locked = false; - + function generateDaynames(){ that.el.days.innerHTML = ''; if(daynames){ @@ -79,7 +80,7 @@ function generateYears(){ [].slice.call(that.el.yearPicker.childNodes).forEach(function(node,index) { - node.innerHTML = "'" + (currentYear + parseInt(node.getAttribute('data-year'))).toString().substring(2,4); + node.innerHTML = "'" + (currentYear + parseInt(node.getAttribute('data-year'))).toString().substring(2,4); }) } @@ -110,7 +111,7 @@ input.addEventListener(eventName,function(){ if(locked){ event.preventDefault(); - } + } }); input.addEventListener('change',inputChange); } @@ -131,7 +132,7 @@ var element = that.el.legend.querySelector('[data-legend-id="' + legendId + '"]'); if(e.type == 'mouseover' && element){ var color = (element.getAttribute('data-color'))?hexToRgb(element.getAttribute('data-color')):null; - element.setAttribute('style','background-color:rgba(' + color.r + ',' + color.g + ',' + color.b + ',0.35);'); + element.setAttribute('style','background-color:rgba(' + color.r + ',' + color.g + ',' + color.b + ',0.35);'); }else if(element){ element.removeAttribute('style'); } @@ -183,7 +184,7 @@ } } } - + [].slice.call(that.el.legend.querySelectorAll('.d-legend-item')).forEach(function(item) { if(legends.indexOf(item) < 0){ item.removeEventListener('mouseover',hoverLegend); @@ -195,7 +196,7 @@ function hoverLegend(e){ [].slice.call(that.el.tables.querySelectorAll('[data-legend-id*="' + this.getAttribute('data-legend-id') + '"]')).forEach(function(element) { if(e.type == 'mouseover') element.classList.add('legend-hover'); - else element.classList.remove('legend-hover'); + else element.classList.remove('legend-hover'); }); } } @@ -262,7 +263,7 @@ if(date instanceof Date){ inputEl.setAttribute('data-date',date.toJSON()); - + if(disabledDates.indexOf(date.getTime()) != -1 || disabledDays.indexOf(date.getDay()) != -1){ inputEl.setAttribute('disabled',true); } @@ -270,7 +271,7 @@ if((minDate && date < minDate) || (maxDate && date > maxDate)){ inputEl.setAttribute('disabled',true); labelEl.className = 'd-hidden'; - + } if(today && date.getTime() == new Date().setHours(0,0,0,0)){ @@ -392,8 +393,9 @@ if(currentMonth-1+months-1>11){ that.el.yearPicker.querySelector('[data-year="1"]').classList.add('current'); } - + renderSelectedDates(); + if(onNavigation) onNavigation.call(that); }; function renderSelectedDates(){ @@ -443,7 +445,7 @@ date = new Date(date); date.setHours(0,0,0,0); var el = that.el.querySelector('[data-date="'+ date.toJSON() +'"]'); - + if(range && el && el.checked) { el.classList.add('single'); } @@ -478,7 +480,7 @@ function unselectAll(ignoreOnSelect){ selectedDates.forEach(function(date) { - unselectDate(date,ignoreOnSelect); + unselectDate(date,ignoreOnSelect); }); }; @@ -496,18 +498,18 @@ for(length; length > maxSelections-1; length --){ unselectDate(selectedDates[0]); } - + } - + if(range && selectedDates.length){ var first = that.el.querySelector('[data-date="'+ selectedDates[0].toJSON() +'"]'); if(!first && date > selectedDates[0]){ that.el.tables.classList.add('before'); } } - + selectedDates.push(date); - + if(closeOnSelect){ that.hide(); } @@ -601,7 +603,7 @@ currentMonth = parseInt(this.getAttribute('data-month')); setDate(); that.el.monthPicker.classList.remove('d-show'); - }); + }); }); [].slice.call(that.el.yearPicker.childNodes).forEach(function(yearPicker) { @@ -609,7 +611,7 @@ currentYear += parseInt(this.getAttribute('data-year')); setDate(); that.el.yearPicker.classList.remove('d-show'); - }); + }); }) var startX = 0; @@ -690,10 +692,10 @@ } Object.defineProperties(that,{ - "selectedDates": { - get: function () { - return selectedDates.sort(function(a,b){return a.getTime() - b.getTime();}); - } + "selectedDates": { + get: function () { + return selectedDates.sort(function(a,b){return a.getTime() - b.getTime();}); + } }, "range": { get: function() { @@ -776,7 +778,7 @@ }, set: function(x){ if(x){ - closeOnSelect = true; + closeOnSelect = true; }else{ closeOnSelect = false; } @@ -810,7 +812,7 @@ x.forEach(function(date) { if(date instanceof Date){ disabledDates.push(new Date(date.getFullYear(),date.getMonth(),date.getDate()).getTime()); - } + } }); }else if(x instanceof Date){ disabledDates = [new Date(x.getFullYear(),x.getMonth(),x.getDate()).getTime()]; @@ -866,7 +868,7 @@ highlightObj.dates.push({ start: new Date(hlDate.start.getFullYear(),hlDate.start.getMonth(),hlDate.start.getDate()), end: ('end' in hlDate)?new Date(hlDate.end.getFullYear(),hlDate.end.getMonth(),hlDate.end.getDate()):new Date(hlDate.start.getFullYear(),hlDate.start.getMonth(),hlDate.start.getDate()) - }); + }); }); } @@ -970,6 +972,15 @@ } } }, + "onNavigation": { + set: function(callback){ + if(typeof callback == 'function'){ + onNavigation = callback.bind(that); + }else if(!callback){ + onNavigation = null; + } + } + }, "closeOnClick": { get: function(){ return closeOnClick; @@ -1141,8 +1152,8 @@ '
10
' + '
11
' + '
12
' + - '' + - '
' + + '
' + + '
' + '
' + '
' + '
' + @@ -1157,9 +1168,9 @@ '
' + '
' + '
' + - '' + + '' + '
' + - '' + + '' + '
'; var getBrowserVersion = function(){ @@ -1199,4 +1210,4 @@ if ( typeof define === 'function' && define.amd ) define('Datepickk', Datepickk); else if ( typeof exports === 'object' ) module.exports = Datepickk; else window.Datepickk = Datepickk; -})(); \ No newline at end of file +})(); diff --git a/dist/datepickk.min.js b/dist/datepickk.min.js index 58e8934..043cf26 100644 --- a/dist/datepickk.min.js +++ b/dist/datepickk.min.js @@ -1,2 +1,2 @@ -!function(){function e(r){function i(){if(S.el.days.innerHTML="",U)for(var e=0;I>e&&3>e;e++){var t=document.createElement("div");t.setAttribute("class","d-week");for(var n=0;7>n;n++){var a=document.createElement("div"),r=document.createElement("p");r.innerHTML=O[W].dayNames[n],a.appendChild(r),t.appendChild(a)}S.el.days.appendChild(t)}}function l(){[].slice.call(S.el.yearPicker.childNodes).forEach(function(e,t){e.innerHTML="'"+(F+parseInt(e.getAttribute("data-year"))).toString().substring(2,4)})}function d(){function t(e){function t(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}if("LABEL"===e.target.nodeName){var n=e.target.getAttribute("data-legend-id")?e.target.getAttribute("data-legend-id").split(" "):[];n.length&&n.forEach(function(n){var a=S.el.legend.querySelector('[data-legend-id="'+n+'"]');if("mouseover"==e.type&&a){var r=a.getAttribute("data-color")?t(a.getAttribute("data-color")):null;a.setAttribute("style","background-color:rgba("+r.r+","+r.g+","+r.b+",0.35);")}else a&&a.removeAttribute("style")})}}S.el.tables.innerHTML="";for(var n=0;I>n;n++){var a=document.createElement("div");a.setAttribute("class","d-table");for(var r=0;42>r;r++){var i=document.createElement("input");i.type="checkbox",i.id=e.numInstances+"-"+n+"-d-day-"+r;var l=document.createElement("label");l.setAttribute("for",e.numInstances+"-"+n+"-d-day-"+r);var d=document.createElement("text"),s=document.createElement("span");s.setAttribute("class","d-tooltip"),a.appendChild(i),a.appendChild(l),l.appendChild(d),l.appendChild(s),i.addEventListener(T,function(){ae&&event.preventDefault()}),i.addEventListener("change",y)}S.el.tables.appendChild(a)}S.el.tables.addEventListener("mouseover",t),S.el.tables.addEventListener("mouseout",t)}function s(){function e(e){[].slice.call(S.el.tables.querySelectorAll('[data-legend-id*="'+this.getAttribute("data-legend-id")+'"]')).forEach(function(t){"mouseover"==e.type?t.classList.add("legend-hover"):t.classList.remove("legend-hover")})}for(var t=new Date(S.el.tables.childNodes[0].childNodes[0].getAttribute("data-date")),n=new Date(S.el.tables.childNodes[I-1].childNodes[82].getAttribute("data-date")),a=K.filter(function(e){for(var a=0;at)return!0;return!1}),r=[],i=0;i11?e-=12:0>e&&(e+=12),e}function c(e,t){var n=S.el.querySelectorAll(".d-table"),a=O[W].weekStart;[].slice.call(S.el.querySelectorAll(".d-table")).forEach(function(r,i){var l=new Date(e,t+i,0).getDate(),d=new Date(e,t+i-1,0).getDate(),s=new Date(e,t+i-1,1).getDay();0>s-a?s=7-a:s-=a;var c=O[W].monthNames[o(t-1+i)];r.setAttribute("data-month",c),[].slice.call(r.querySelectorAll(".d-table input")).forEach(function(a,r){var o=a.nextSibling;a.checked=!1,a.removeAttribute("disabled"),o.removeAttribute("style"),o.removeAttribute("data-legend-id"),o.className="";var c=null;if(s>r?(o.childNodes[0].innerHTML=d-(s-r-1),0==i?(c=new Date(e,t+i-2,d-(s-r-1)),o.className="prev"):(c="",o.className="d-hidden",a.setAttribute("disabled",!0))):l+s>r?(c=new Date(e,t+i-1,r-s+1),o.childNodes[0].innerHTML=r-s+1,o.className=""):(o.childNodes[0].innerHTML=r-l-s+1,i==n.length-1?(c=new Date(e,t+i,r-l-s+1),o.className="next"):(c="",o.className="d-hidden",a.setAttribute("disabled",!0))),c instanceof Date){a.setAttribute("data-date",c.toJSON()),-1==_.indexOf(c.getTime())&&-1==G.indexOf(c.getDay())||a.setAttribute("disabled",!0),(te&&te>c||ne&&c>ne)&&(a.setAttribute("disabled",!0),o.className="d-hidden"),Z&&c.getTime()==(new Date).setHours(0,0,0,0)?o.classList.add("today"):o.classList.remove("today"),Q[c.getTime()]?(o.childNodes[0].setAttribute("data-tooltip",!0),o.childNodes[1].innerHTML=Q[c.getTime()]):(o.childNodes[0].removeAttribute("data-tooltip"),o.childNodes[1].innerHTML="");var u=K.filter(function(e){for(var t=0;t=e.dates[t].start.getTime()&&c.getTime()<=e.dates[t].end.getTime())return!0;return!1});if(u.length>0){var h="",g="";if(u.length>1){var f=Math.round(100/u.length);h="background: linear-gradient(-45deg,";for(var v=0;v12||1>x)&&(x>12?(F+=1,x-=12):(F-=1,x+=12)),ne&&new Date(F,x-1+I-1,1)>=new Date(ne).setDate(1)?(F=ne.getFullYear(),x=ne.getMonth()+1-I+1,S.el.header.childNodes[2].setAttribute("style","visibility:hidden")):S.el.header.childNodes[2].removeAttribute("style"),te&&new Date(F,x-1,1)<=new Date(te).setDate(1)?(F=te.getFullYear(),x=te.getMonth()+1,S.el.header.childNodes[0].setAttribute("style","visibility:hidden")):S.el.header.childNodes[0].removeAttribute("style");for(var e=0;I>e;e++){var t=x-1+e;t>11?t-=12:0>t&&(t+=12),S.el.monthPicker.childNodes[t].classList.add("current")}c(F,x),l();var n=O[W].monthNames[x-1],a="";if(I>1){a+=" - ";var r=x-1+I-1;r>11?r-=12:0>r&&(r+=12),a+=O[W].monthNames[r]}var i=x-1+I-1>11?F.toString().substring(2,4)+"/"+(F+1).toString().substring(2,4):F.toString().substring(2,4);S.el.header.childNodes[1].childNodes[0].innerHTML=n+a,S.el.header.childNodes[1].childNodes[1].innerHTML=i,S.el.yearPicker.querySelector('[data-year="0"]').classList.add("current"),x-1+I-1>11&&S.el.yearPicker.querySelector('[data-year="1"]').classList.add("current"),h()}}function h(){if(C.forEach(function(e){var t=S.el.querySelector('[data-date="'+e.toJSON()+'"]');t&&(t.checked=!0)}),S.el.tables.classList.remove("before"),Y&&C.length>1){var e=new Date(F,x-1,1),t=C.sort(function(e,t){return e.getTime()-t.getTime()}),n=S.el.querySelector('[data-date="'+t[0].toJSON()+'"]');!n&&e>=new Date(t[0].getFullYear(),t[0].getMonth(),1)&&e<=new Date(t[1].getFullYear(),t[1].getMonth(),1)&&S.el.tables.classList.add("before")}}function g(){[].slice.call(S.el.querySelectorAll(".d-table input")).forEach(function(e){e.checked=!1}),[].slice.call(S.el.monthPicker.querySelectorAll(".current")).forEach(function(e){e.classList.remove("current")}),[].slice.call(S.el.yearPicker.querySelectorAll(".current")).forEach(function(e){e.classList.remove("current")})}function f(){x+=I,u()}function v(){x-=I,u()}function m(e,t){e=new Date(e),e.setHours(0,0,0,0);var n=S.el.querySelector('[data-date="'+e.toJSON()+'"]');Y&&n&&n.checked&&n.classList.add("single"),n&&!n.checked&&(n.checked=!0),C.push(e),$&&!t&&$.apply(e,[!0])}function b(e,t){e=new Date(e),e.setHours(0,0,0,0);var n=S.el.querySelector('[data-date="'+e.toJSON()+'"]');n&&(n.classList.remove("single"),n.checked&&(n.checked=!1)),C=C.filter(function(t){return t.getTime()!=e.getTime()}),$&&!t&&$.call(e,!1)}function p(e){C.forEach(function(t){b(t,e)})}function y(e){var t=this,n=new Date(t.getAttribute("data-date"));if(t.classList.remove("single"),!ae){if(Y&&S.el.tables.classList.remove("before"),t.checked){if(P&&C.length>P-1){var a=C.length;for(a;a>P-1;a--)b(C[0])}if(Y&&C.length){var r=S.el.querySelector('[data-date="'+C[0].toJSON()+'"]');!r&&n>C[0]&&S.el.tables.classList.add("before")}C.push(n),J&&S.hide()}else Y&&1==C.length&&C[0].getTime()==n.getTime()?(m(n),t.classList.add("single")):C=C.filter(function(e){return e.getTime()!=n.getTime()});$&&$.call(n,t.checked)}}function D(e){e?(Y=!0,S.el.tables.classList.add("range")):(Y=!1,S.el.tables.classList.remove("range"))}function L(e){S.inline||S.container!==document.body||document.body.classList.add("d-noscroll"),N(e);var n=function(){S.el.classList.remove("d-show"),S.el.calendar.removeEventListener(t(),n)};S.el.calendar.addEventListener(t(),n),S.el.classList.add("d-show"),q.appendChild(S.el),H=!0,ee&&(x=ee.getMonth()+1,F=ee.getFullYear()),u()}function k(){document.body.classList.remove("d-noscroll");var e=function(){S.el.parentNode.removeChild(S.el),H=!1,S.el.classList.remove("d-hide"),"function"==typeof X&&X.apply(S),S.el.removeEventListener(t(),e)};S.el.addEventListener(t(),e),S.el.classList.add("d-hide")}function w(){S.el.header.childNodes[0].addEventListener(T,v),S.el.header.childNodes[2].addEventListener(T,f),S.el.header.childNodes[1].childNodes[0].addEventListener(T,function(){S.el.monthPicker.classList.contains("d-show")?S.el.monthPicker.classList.remove("d-show"):S.el.monthPicker.classList.add("d-show"),S.el.yearPicker.classList.remove("d-show")}),S.el.header.childNodes[1].childNodes[1].addEventListener(T,function(){l(),S.el.yearPicker.classList.contains("d-show")?S.el.yearPicker.classList.remove("d-show"):S.el.yearPicker.classList.add("d-show"),S.el.monthPicker.classList.remove("d-show")}),S.el.button.addEventListener(T,k),S.el.overlay.addEventListener(T,function(){R&&S.hide()}),[].slice.call(S.el.monthPicker.childNodes).forEach(function(e){e.addEventListener(T,function(){x=parseInt(this.getAttribute("data-month")),u(),S.el.monthPicker.classList.remove("d-show")})}),[].slice.call(S.el.yearPicker.childNodes).forEach(function(e){e.addEventListener(T,function(){F+=parseInt(this.getAttribute("data-year")),u(),S.el.yearPicker.classList.remove("d-show")})});var e=0,t=0;S.el.calendar.addEventListener("touchstart",function(t){e=t.changedTouches[0].clientX||t.originalEvent.changedTouches[0].clientX}),S.el.calendar.addEventListener("touchmove",function(n){t=n.changedTouches[0].clientX-e||n.originalEvent.changedTouches[0].clientX-e,n.preventDefault()}),S.el.calendar.addEventListener("touchend",function(e){t>50?v():-50>t&&f(),t=0})}function N(e){for(var t in e)t in S&&(S[t]=e[t])}function A(){S.el=document.createElement("div"),S.el.id="Datepickk",S.el.classList.add(a().type),S.el.innerHTML=n,S.el.calendar=S.el.childNodes[1],S.el.titleBox=S.el.childNodes[0],S.el.button=S.el.childNodes[3],S.el.header=S.el.calendar.childNodes[0],S.el.monthPicker=S.el.calendar.childNodes[1],S.el.yearPicker=S.el.calendar.childNodes[2],S.el.tables=S.el.calendar.childNodes[4],S.el.days=S.el.calendar.childNodes[3],S.el.overlay=S.el.childNodes[4],S.el.legend=S.el.childNodes[2],N(r),d(),i(),w(),V&&L(),null!=window.FastClick&&FastClick.attach(S.el)}function E(){return new Date(F,x-1,1)}function M(e){e=new Date(e),x=e.getMonth()+1,F=e.getFullYear(),u()}e.numInstances=(e.numInstances||0)+1;var S=this,T="click",C=[],F=(new Date).getFullYear(),x=(new Date).getMonth()+1,O={no:{monthNames:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],dayNames:["ma","ti","on","to","fr","lø","sø"],weekStart:1},en:{monthNames:["january","february","march","april","may","june","july","august","september","october","november","december"],dayNames:["su","mo","tu","we","th","fr","sa"],weekStart:0},de:{monthNames:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],dayNames:["Mo","Di","Mi","Do","Fr","Sa","So"],weekStart:1}},Y=!1,P=null,q=document.body,H=!1,I=1,J=!1,j=null,z=null,X=null,B=null,R=!0,V=!1,W="en",$=null,_=[],G=[],K=[],Q={},U=!0,Z=!0,ee=null,te=null,ne=null,ae=!1;return S.show=L,S.hide=k,S.selectDate=m,S.unselectAll=p,S.unselectDate=b,Object.defineProperties(S,{selectedDates:{get:function(){return C.sort(function(e,t){return e.getTime()-t.getTime()})}},range:{get:function(){return Y},set:function(e){D(e),e&&(P=2)}},button:{get:function(){return j},set:function(e){j="string"==typeof e?e:null,S.el.button.innerHTML=j?j:""}},title:{get:function(){return z},set:function(e){z="string"==typeof e?e:null,S.el.titleBox.innerText=z?z:""}},lang:{get:function(){return W},set:function(e){e in O?(W=e,i(),u()):console.error("Language not found")}},months:{get:function(){return I},set:function(e){"number"==typeof e&&e>0?(I=e,i(),d(),u(),1==I?S.el.classList.remove("multi"):S.el.classList.add("multi")):console.error("months must be a number > 0")}},isOpen:{get:function(){return H}},closeOnSelect:{get:function(){return J},set:function(e){J=!!e}},disabledDays:{get:function(){return G},set:function(e){if(e instanceof Array)for(var t=0;te&&3>e;e++){var t=document.createElement("div");t.setAttribute("class","d-week");for(var n=0;7>n;n++){var a=document.createElement("div"),r=document.createElement("p");r.innerHTML=O[$].dayNames[n],a.appendChild(r),t.appendChild(a)}S.el.days.appendChild(t)}}function l(){[].slice.call(S.el.yearPicker.childNodes).forEach(function(e,t){e.innerHTML="'"+(F+parseInt(e.getAttribute("data-year"))).toString().substring(2,4)})}function d(){function t(e){function t(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}if("LABEL"===e.target.nodeName){var n=e.target.getAttribute("data-legend-id")?e.target.getAttribute("data-legend-id").split(" "):[];n.length&&n.forEach(function(n){var a=S.el.legend.querySelector('[data-legend-id="'+n+'"]');if("mouseover"==e.type&&a){var r=a.getAttribute("data-color")?t(a.getAttribute("data-color")):null;a.setAttribute("style","background-color:rgba("+r.r+","+r.g+","+r.b+",0.35);")}else a&&a.removeAttribute("style")})}}S.el.tables.innerHTML="";for(var n=0;I>n;n++){var a=document.createElement("div");a.setAttribute("class","d-table");for(var r=0;42>r;r++){var i=document.createElement("input");i.type="checkbox",i.id=e.numInstances+"-"+n+"-d-day-"+r;var l=document.createElement("label");l.setAttribute("for",e.numInstances+"-"+n+"-d-day-"+r);var d=document.createElement("text"),s=document.createElement("span");s.setAttribute("class","d-tooltip"),a.appendChild(i),a.appendChild(l),l.appendChild(d),l.appendChild(s),i.addEventListener(T,function(){re&&event.preventDefault()}),i.addEventListener("change",y)}S.el.tables.appendChild(a)}S.el.tables.addEventListener("mouseover",t),S.el.tables.addEventListener("mouseout",t)}function s(){function e(e){[].slice.call(S.el.tables.querySelectorAll('[data-legend-id*="'+this.getAttribute("data-legend-id")+'"]')).forEach(function(t){"mouseover"==e.type?t.classList.add("legend-hover"):t.classList.remove("legend-hover")})}for(var t=new Date(S.el.tables.childNodes[0].childNodes[0].getAttribute("data-date")),n=new Date(S.el.tables.childNodes[I-1].childNodes[82].getAttribute("data-date")),a=Q.filter(function(e){for(var a=0;at)return!0;return!1}),r=[],i=0;i11?e-=12:0>e&&(e+=12),e}function c(e,t){var n=S.el.querySelectorAll(".d-table"),a=O[$].weekStart;[].slice.call(S.el.querySelectorAll(".d-table")).forEach(function(r,i){var l=new Date(e,t+i,0).getDate(),d=new Date(e,t+i-1,0).getDate(),s=new Date(e,t+i-1,1).getDay();0>s-a?s=7-a:s-=a;var c=O[$].monthNames[o(t-1+i)];r.setAttribute("data-month",c),[].slice.call(r.querySelectorAll(".d-table input")).forEach(function(a,r){var o=a.nextSibling;a.checked=!1,a.removeAttribute("disabled"),o.removeAttribute("style"),o.removeAttribute("data-legend-id"),o.className="";var c=null;if(s>r?(o.childNodes[0].innerHTML=d-(s-r-1),0==i?(c=new Date(e,t+i-2,d-(s-r-1)),o.className="prev"):(c="",o.className="d-hidden",a.setAttribute("disabled",!0))):l+s>r?(c=new Date(e,t+i-1,r-s+1),o.childNodes[0].innerHTML=r-s+1,o.className=""):(o.childNodes[0].innerHTML=r-l-s+1,i==n.length-1?(c=new Date(e,t+i,r-l-s+1),o.className="next"):(c="",o.className="d-hidden",a.setAttribute("disabled",!0))),c instanceof Date){a.setAttribute("data-date",c.toJSON()),-1==G.indexOf(c.getTime())&&-1==K.indexOf(c.getDay())||a.setAttribute("disabled",!0),(ne&&ne>c||ae&&c>ae)&&(a.setAttribute("disabled",!0),o.className="d-hidden"),ee&&c.getTime()==(new Date).setHours(0,0,0,0)?o.classList.add("today"):o.classList.remove("today"),U[c.getTime()]?(o.childNodes[0].setAttribute("data-tooltip",!0),o.childNodes[1].innerHTML=U[c.getTime()]):(o.childNodes[0].removeAttribute("data-tooltip"),o.childNodes[1].innerHTML="");var u=Q.filter(function(e){for(var t=0;t=e.dates[t].start.getTime()&&c.getTime()<=e.dates[t].end.getTime())return!0;return!1});if(u.length>0){var h="",f="";if(u.length>1){var g=Math.round(100/u.length);h="background: linear-gradient(-45deg,";for(var v=0;v12||1>x)&&(x>12?(F+=1,x-=12):(F-=1,x+=12)),ae&&new Date(F,x-1+I-1,1)>=new Date(ae).setDate(1)?(F=ae.getFullYear(),x=ae.getMonth()+1-I+1,S.el.header.childNodes[2].setAttribute("style","visibility:hidden")):S.el.header.childNodes[2].removeAttribute("style"),ne&&new Date(F,x-1,1)<=new Date(ne).setDate(1)?(F=ne.getFullYear(),x=ne.getMonth()+1,S.el.header.childNodes[0].setAttribute("style","visibility:hidden")):S.el.header.childNodes[0].removeAttribute("style");for(var e=0;I>e;e++){var t=x-1+e;t>11?t-=12:0>t&&(t+=12),S.el.monthPicker.childNodes[t].classList.add("current")}c(F,x),l();var n=O[$].monthNames[x-1],a="";if(I>1){a+=" - ";var r=x-1+I-1;r>11?r-=12:0>r&&(r+=12),a+=O[$].monthNames[r]}var i=x-1+I-1>11?F.toString().substring(2,4)+"/"+(F+1).toString().substring(2,4):F.toString().substring(2,4);S.el.header.childNodes[1].childNodes[0].innerHTML=n+a,S.el.header.childNodes[1].childNodes[1].innerHTML=i,S.el.yearPicker.querySelector('[data-year="0"]').classList.add("current"),x-1+I-1>11&&S.el.yearPicker.querySelector('[data-year="1"]').classList.add("current"),h(),X&&X.call(S)}}function h(){if(C.forEach(function(e){var t=S.el.querySelector('[data-date="'+e.toJSON()+'"]');t&&(t.checked=!0)}),S.el.tables.classList.remove("before"),Y&&C.length>1){var e=new Date(F,x-1,1),t=C.sort(function(e,t){return e.getTime()-t.getTime()}),n=S.el.querySelector('[data-date="'+t[0].toJSON()+'"]');!n&&e>=new Date(t[0].getFullYear(),t[0].getMonth(),1)&&e<=new Date(t[1].getFullYear(),t[1].getMonth(),1)&&S.el.tables.classList.add("before")}}function f(){[].slice.call(S.el.querySelectorAll(".d-table input")).forEach(function(e){e.checked=!1}),[].slice.call(S.el.monthPicker.querySelectorAll(".current")).forEach(function(e){e.classList.remove("current")}),[].slice.call(S.el.yearPicker.querySelectorAll(".current")).forEach(function(e){e.classList.remove("current")})}function g(){x+=I,u()}function v(){x-=I,u()}function m(e,t){e=new Date(e),e.setHours(0,0,0,0);var n=S.el.querySelector('[data-date="'+e.toJSON()+'"]');Y&&n&&n.checked&&n.classList.add("single"),n&&!n.checked&&(n.checked=!0),C.push(e),_&&!t&&_.apply(e,[!0])}function b(e,t){e=new Date(e),e.setHours(0,0,0,0);var n=S.el.querySelector('[data-date="'+e.toJSON()+'"]');n&&(n.classList.remove("single"),n.checked&&(n.checked=!1)),C=C.filter(function(t){return t.getTime()!=e.getTime()}),_&&!t&&_.call(e,!1)}function p(e){C.forEach(function(t){b(t,e)})}function y(e){var t=this,n=new Date(t.getAttribute("data-date"));if(t.classList.remove("single"),!re){if(Y&&S.el.tables.classList.remove("before"),t.checked){if(P&&C.length>P-1){var a=C.length;for(a;a>P-1;a--)b(C[0])}if(Y&&C.length){var r=S.el.querySelector('[data-date="'+C[0].toJSON()+'"]');!r&&n>C[0]&&S.el.tables.classList.add("before")}C.push(n),J&&S.hide()}else Y&&1==C.length&&C[0].getTime()==n.getTime()?(m(n),t.classList.add("single")):C=C.filter(function(e){return e.getTime()!=n.getTime()});_&&_.call(n,t.checked)}}function D(e){e?(Y=!0,S.el.tables.classList.add("range")):(Y=!1,S.el.tables.classList.remove("range"))}function L(e){S.inline||S.container!==document.body||document.body.classList.add("d-noscroll"),N(e);var n=function(){S.el.classList.remove("d-show"),S.el.calendar.removeEventListener(t(),n)};S.el.calendar.addEventListener(t(),n),S.el.classList.add("d-show"),q.appendChild(S.el),H=!0,te&&(x=te.getMonth()+1,F=te.getFullYear()),u()}function k(){document.body.classList.remove("d-noscroll");var e=function(){S.el.parentNode.removeChild(S.el),H=!1,S.el.classList.remove("d-hide"),"function"==typeof B&&B.apply(S),S.el.removeEventListener(t(),e)};S.el.addEventListener(t(),e),S.el.classList.add("d-hide")}function w(){S.el.header.childNodes[0].addEventListener(T,v),S.el.header.childNodes[2].addEventListener(T,g),S.el.header.childNodes[1].childNodes[0].addEventListener(T,function(){S.el.monthPicker.classList.contains("d-show")?S.el.monthPicker.classList.remove("d-show"):S.el.monthPicker.classList.add("d-show"),S.el.yearPicker.classList.remove("d-show")}),S.el.header.childNodes[1].childNodes[1].addEventListener(T,function(){l(),S.el.yearPicker.classList.contains("d-show")?S.el.yearPicker.classList.remove("d-show"):S.el.yearPicker.classList.add("d-show"),S.el.monthPicker.classList.remove("d-show")}),S.el.button.addEventListener(T,k),S.el.overlay.addEventListener(T,function(){V&&S.hide()}),[].slice.call(S.el.monthPicker.childNodes).forEach(function(e){e.addEventListener(T,function(){x=parseInt(this.getAttribute("data-month")),u(),S.el.monthPicker.classList.remove("d-show")})}),[].slice.call(S.el.yearPicker.childNodes).forEach(function(e){e.addEventListener(T,function(){F+=parseInt(this.getAttribute("data-year")),u(),S.el.yearPicker.classList.remove("d-show")})});var e=0,t=0;S.el.calendar.addEventListener("touchstart",function(t){e=t.changedTouches[0].clientX||t.originalEvent.changedTouches[0].clientX}),S.el.calendar.addEventListener("touchmove",function(n){t=n.changedTouches[0].clientX-e||n.originalEvent.changedTouches[0].clientX-e,n.preventDefault()}),S.el.calendar.addEventListener("touchend",function(e){t>50?v():-50>t&&g(),t=0})}function N(e){for(var t in e)t in S&&(S[t]=e[t])}function A(){S.el=document.createElement("div"),S.el.id="Datepickk",S.el.classList.add(a().type),S.el.innerHTML=n,S.el.calendar=S.el.childNodes[1],S.el.titleBox=S.el.childNodes[0],S.el.button=S.el.childNodes[3],S.el.header=S.el.calendar.childNodes[0],S.el.monthPicker=S.el.calendar.childNodes[1],S.el.yearPicker=S.el.calendar.childNodes[2],S.el.tables=S.el.calendar.childNodes[4],S.el.days=S.el.calendar.childNodes[3],S.el.overlay=S.el.childNodes[4],S.el.legend=S.el.childNodes[2],N(r),d(),i(),w(),W&&L(),null!=window.FastClick&&FastClick.attach(S.el)}function E(){return new Date(F,x-1,1)}function M(e){e=new Date(e),x=e.getMonth()+1,F=e.getFullYear(),u()}e.numInstances=(e.numInstances||0)+1;var S=this,T="click",C=[],F=(new Date).getFullYear(),x=(new Date).getMonth()+1,O={no:{monthNames:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],dayNames:["ma","ti","on","to","fr","lø","sø"],weekStart:1},en:{monthNames:["january","february","march","april","may","june","july","august","september","october","november","december"],dayNames:["su","mo","tu","we","th","fr","sa"],weekStart:0},de:{monthNames:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],dayNames:["Mo","Di","Mi","Do","Fr","Sa","So"],weekStart:1}},Y=!1,P=null,q=document.body,H=!1,I=1,J=!1,j=null,z=null,X=null,B=null,R=null,V=!0,W=!1,$="en",_=null,G=[],K=[],Q=[],U={},Z=!0,ee=!0,te=null,ne=null,ae=null,re=!1;return S.show=L,S.hide=k,S.selectDate=m,S.unselectAll=p,S.unselectDate=b,Object.defineProperties(S,{selectedDates:{get:function(){return C.sort(function(e,t){return e.getTime()-t.getTime()})}},range:{get:function(){return Y},set:function(e){D(e),e&&(P=2)}},button:{get:function(){return j},set:function(e){j="string"==typeof e?e:null,S.el.button.innerHTML=j?j:""}},title:{get:function(){return z},set:function(e){z="string"==typeof e?e:null,S.el.titleBox.innerText=z?z:""}},lang:{get:function(){return $},set:function(e){e in O?($=e,i(),u()):console.error("Language not found")}},months:{get:function(){return I},set:function(e){"number"==typeof e&&e>0?(I=e,i(),d(),u(),1==I?S.el.classList.remove("multi"):S.el.classList.add("multi")):console.error("months must be a number > 0")}},isOpen:{get:function(){return H}},closeOnSelect:{get:function(){return J},set:function(e){J=!!e}},disabledDays:{get:function(){return K},set:function(e){if(e instanceof Array)for(var t=0;t start){\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t});\r\n\t\t\tvar legends = [];\r\n\t\t\tfor(var l = 0;l<_highlights.length;l++){\r\n\t\t\t\tif('legend' in _highlights[l] && _highlights[l].legend){\r\n\t\t\t\t\tvar oldLegend = container.querySelector('.d-legend-item[data-legend=\"' + _highlights[l].legend + '\"][data-color=\"' + _highlights[l].backgroundColor + '\"]');\r\n\t\t\t\t\tif(oldLegend == null){\r\n\t\t\t\t\t\tvar legendItem = document.createElement('p');\r\n\t\t\t\t\t\t\tlegendItem.setAttribute('class','d-legend-item');\r\n\t\t\t\t\t\t\tlegendItem.setAttribute('data-legend',_highlights[l].legend);\r\n\t\t\t\t\t\t\tlegendItem.setAttribute('data-legend-id',highlight.indexOf(_highlights[l]));\r\n\t\t\t\t\t\t\tlegendItem.setAttribute('data-color',_highlights[l].backgroundColor);\r\n\t\t\t\t\t\tvar legendItemPoint = document.createElement('span');\r\n\t\t\t\t\t\t\tlegendItemPoint.setAttribute('style','background-color:' + _highlights[l].backgroundColor);\r\n\r\n\t\t\t\t\t\tlegendItem.appendChild(legendItemPoint);\r\n\r\n\t\t\t\t\t\tthat.el.legend.appendChild(legendItem);\r\n\t\t\t\t\t\tlegendItem.addEventListener('mouseover',hoverLegend);\r\n\t\t\t\t\t\tlegendItem.addEventListener('mouseout',hoverLegend);\r\n\t\t\t\t\t\tlegends.push(legendItem);\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tlegends.push(oldLegend);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t[].slice.call(that.el.legend.querySelectorAll('.d-legend-item')).forEach(function(item) {\r\n\t\t\t\tif(legends.indexOf(item) < 0){\r\n\t\t\t\t\titem.removeEventListener('mouseover',hoverLegend);\r\n\t\t\t\t\titem.removeEventListener('mouseout',hoverLegend);\r\n\t\t\t\t\tthat.el.legend.removeChild(item);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tfunction hoverLegend(e){\r\n\t\t\t\t[].slice.call(that.el.tables.querySelectorAll('[data-legend-id*=\"' + this.getAttribute('data-legend-id') + '\"]')).forEach(function(element) {\r\n\t\t\t\t\tif(e.type == 'mouseover') element.classList.add('legend-hover');\r\n\t\t\t\t\telse element.classList.remove('legend-hover');\t\t\t\t\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction parseMonth(month){\r\n\t\t\tif(month > 11) month -= 12;\r\n\t\t\telse if(month < 0) month += 12;\r\n\t\t\treturn month;\r\n\t\t}\r\n\r\n\t\tfunction generateDates(year,month){\r\n\t\t\tvar monthElements = that.el.querySelectorAll('.d-table');\r\n\t\t\tvar weekStart = languages[lang].weekStart;\r\n\r\n\t\t\t[].slice.call(that.el.querySelectorAll('.d-table')).forEach(function(element, index) {\r\n\t\t\t\tvar days = new Date(year,month + index,0).getDate();\r\n\t\t\t\tvar daysLast = new Date(year,month + index - 1,0).getDate();\r\n\t\t\t\tvar startDay = new Date(year,month + index - 1,1).getDay();\r\n\t\t\t\tvar startDate = null;\r\n\t\t\t\tvar endDate = null;\r\n\t\t\t\tif(startDay - weekStart < 0){\r\n\t\t\t\t\tstartDay = 7 - weekStart;\r\n\t\t\t\t}else{\r\n\t\t\t\t\tstartDay -= weekStart;\r\n\t\t\t\t}\r\n\t\t\t\tvar monthText = languages[lang].monthNames[parseMonth(month - 1 + index)];\r\n\t\t\t\telement.setAttribute('data-month',monthText);\r\n\r\n\t\t\t\t[].slice.call(element.querySelectorAll('.d-table input')).forEach(function(inputEl,i) {\r\n\t\t\t\t\tvar labelEl = inputEl.nextSibling;\r\n\r\n\t\t\t\t\tinputEl.checked = false;\r\n\t\t\t\t\tinputEl.removeAttribute('disabled');\r\n\t\t\t\t\tlabelEl.removeAttribute('style');\r\n\t\t\t\t\tlabelEl.removeAttribute('data-legend-id');\r\n\t\t\t\t\tlabelEl.className = '';\r\n\r\n\t\t\t\t\tvar date = null;\r\n\t\t\t\t\tif(i < startDay){\r\n\t\t\t\t\t\tlabelEl.childNodes[0].innerHTML = daysLast - (startDay - i - 1);\r\n\t\t\t\t\t\tif(index == 0){\r\n\t\t\t\t\t\t\tdate = new Date(year,month + index - 2,daysLast - (startDay - i - 1));\r\n\t\t\t\t\t\t\tlabelEl.className = 'prev';\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tdate = '';\r\n\t\t\t\t\t\t\tlabelEl.className = 'd-hidden';\r\n\t\t\t\t\t\t\tinputEl.setAttribute('disabled',true);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else if(i < days + startDay){\r\n\t\t\t\t\t\tdate = new Date(year,month + index - 1,i - startDay+1);\r\n\t\t\t\t\t\tlabelEl.childNodes[0].innerHTML = i - startDay + 1;\r\n\t\t\t\t\t\tlabelEl.className = '';\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tlabelEl.childNodes[0].innerHTML = i - days - startDay + 1;\r\n\t\t\t\t\t\tif(index == monthElements.length-1){\r\n\t\t\t\t\t\t\tdate = new Date(year,month + index,i - days - startDay + 1);\r\n\t\t\t\t\t\t\tlabelEl.className = 'next';\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tdate = '';\r\n\t\t\t\t\t\t\tlabelEl.className = 'd-hidden';\r\n\t\t\t\t\t\t\tinputEl.setAttribute('disabled',true);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(date instanceof Date){\r\n\t\t\t\t\t\tinputEl.setAttribute('data-date',date.toJSON());\r\n\t\t\t\t\t\r\n\t\t\t\t\t\tif(disabledDates.indexOf(date.getTime()) != -1 || disabledDays.indexOf(date.getDay()) != -1){\r\n\t\t\t\t\t\t\tinputEl.setAttribute('disabled',true);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif((minDate && date < minDate) || (maxDate && date > maxDate)){\r\n\t\t\t\t\t\t\tinputEl.setAttribute('disabled',true);\r\n\t\t\t\t\t\t\tlabelEl.className = 'd-hidden';\r\n\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif(today && date.getTime() == new Date().setHours(0,0,0,0)){\r\n\t\t\t\t\t\t\tlabelEl.classList.add('today');\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tlabelEl.classList.remove('today');\r\n\t\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\t\tif(tooltips[date.getTime()]){\r\n\t\t\t\t\t\t\tlabelEl.childNodes[0].setAttribute('data-tooltip',true);\r\n\t\t\t\t\t\t\tlabelEl.childNodes[1].innerHTML = tooltips[date.getTime()];\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tlabelEl.childNodes[0].removeAttribute('data-tooltip');\r\n\t\t\t\t\t\t\tlabelEl.childNodes[1].innerHTML = '';\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tvar _highlights = highlight.filter(function(x){\r\n\t\t\t\t\t\t\tfor(var m = 0;m < x.dates.length;m++){\r\n\t\t\t\t\t\t\t\tif(date.getTime() >= x.dates[m].start.getTime() && date.getTime() <= x.dates[m].end.getTime()){\r\n\t\t\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\tif(_highlights.length > 0){\r\n\t\t\t\t\t\t\tvar bgColor = '';\r\n\t\t\t\t\t\t\tvar legendIds = '';\r\n\r\n\t\t\t\t\t\t\tif(_highlights.length > 1){\r\n\t\t\t\t\t\t\t\tvar percent = Math.round(100 / _highlights.length);\r\n\t\t\t\t\t\t\t\tbgColor = 'background: linear-gradient(-45deg,';\r\n\t\t\t\t\t\t\t\tfor(var z = 0;z < _highlights.length;z++){\r\n\t\t\t\t\t\t\t\t\tlegendIds += highlight.indexOf(_highlights[z]);\r\n\t\t\t\t\t\t\t\t\tif(z !== _highlights.length -1){legendIds += ' ';}\r\n\t\t\t\t\t\t\t\t\tbgColor += _highlights[z].backgroundColor + ' ' + (percent*z) + '%';\r\n\t\t\t\t\t\t\t\t\tif(z != _highlights.length - 1){\r\n\t\t\t\t\t\t\t\t\t\tbgColor += ',';\r\n\t\t\t\t\t\t\t\t\t\tbgColor += _highlights[z].backgroundColor + ' ' + (percent*(z+1)) + '%,';\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tbgColor += ');';\r\n\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\tbgColor = (_highlights[0].backgroundColor)?'background:'+ _highlights[0].backgroundColor + ';':'';\r\n\t\t\t\t\t\t\t\tlegendIds += highlight.indexOf(_highlights[0]);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tvar Color = (_highlights[0].color)?'color:'+ _highlights[0].color + ';':'';\r\n\t\t\t\t\t\t\tlabelEl.setAttribute('style',bgColor + Color);\r\n\t\t\t\t\t\t\tlabelEl.setAttribute('data-legend-id',legendIds);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\tgenerateLegends();\r\n\t\t};\r\n\r\n\t\tfunction setDate(){\r\n\t\t\tif(!that.el.tables.childNodes.length || !that.el.tables.childNodes[0].childNodes.length) return;\r\n\r\n\t\t\tresetCalendar();\r\n\r\n\t\t\tif(currentMonth > 12 || currentMonth < 1){\r\n\t\t\t\tif(currentMonth > 12){\r\n\t\t\t\t\tcurrentYear += 1;\r\n\t\t\t\t\tcurrentMonth -= 12;\r\n\t\t\t\t}else{\r\n\t\t\t\t\tcurrentYear -= 1;\r\n\t\t\t\t\tcurrentMonth += 12;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif(maxDate && new Date(currentYear,currentMonth-1+months-1,1) >= new Date(maxDate).setDate(1)){\r\n\t\t\t\tcurrentYear = maxDate.getFullYear();\r\n\t\t\t\tcurrentMonth = maxDate.getMonth() + 1 - months + 1;\r\n\t\t\t\tthat.el.header.childNodes[2].setAttribute('style','visibility:hidden');\r\n\t\t\t}else{\r\n\t\t\t\tthat.el.header.childNodes[2].removeAttribute('style');\r\n\t\t\t}\r\n\t\t\tif(minDate && new Date(currentYear,currentMonth -1,1) <= new Date(minDate).setDate(1)){\r\n\t\t\t\tcurrentYear = minDate.getFullYear();\r\n\t\t\t\tcurrentMonth = minDate.getMonth() + 1;\r\n\t\t\t\tthat.el.header.childNodes[0].setAttribute('style','visibility:hidden');\r\n\t\t\t}else{\r\n\t\t\t\tthat.el.header.childNodes[0].removeAttribute('style');\r\n\t\t\t}\r\n\r\n\t\t\tfor(var c = 0;c < months;c++){\r\n\t\t\t\tvar index = currentMonth-1+c;\r\n\t\t\t\tif(index > 11){\r\n\t\t\t\t\tindex -= 12;\r\n\t\t\t\t}else if(index < 0){\r\n\t\t\t\t\tindex += 12;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthat.el.monthPicker.childNodes[index].classList.add('current');\r\n\t\t\t}\r\n\r\n\t\t\tgenerateDates(currentYear,currentMonth);\r\n\t\t\tgenerateYears();\r\n\t\t\tvar startmonth = languages[lang].monthNames[currentMonth-1];\r\n\t\t\tvar endmonth = '';\r\n\t\t\tif(months > 1){\r\n\t\t\t\tendmonth += ' - ';\r\n\t\t\t\tvar monthint = currentMonth-1+months-1;\r\n\t\t\t\tif(monthint > 11){\r\n\t\t\t\t\tmonthint -= 12;\r\n\t\t\t\t}else if(monthint < 0){\r\n\t\t\t\t\tmonthint += 12;\r\n\t\t\t\t}\r\n\t\t\t\tendmonth += languages[lang].monthNames[monthint];\r\n\t\t\t}\r\n\t\t\tvar yearname = (currentMonth-1+months-1 > 11)?currentYear.toString().substring(2,4) + '/' + (currentYear + 1).toString().substring(2,4):currentYear.toString().substring(2,4);\r\n\t\t\tthat.el.header.childNodes[1].childNodes[0].innerHTML = startmonth + endmonth;\r\n\t\t\tthat.el.header.childNodes[1].childNodes[1].innerHTML = yearname;\r\n\r\n\t\t\tthat.el.yearPicker.querySelector('[data-year=\"0\"]').classList.add('current');\r\n\t\t\tif(currentMonth-1+months-1>11){\r\n\t\t\t\tthat.el.yearPicker.querySelector('[data-year=\"1\"]').classList.add('current');\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\trenderSelectedDates();\r\n\t\t};\r\n\r\n\t\tfunction renderSelectedDates(){\r\n\t\t\tselectedDates.forEach(function(date) {\r\n\t\t\t\tvar el = that.el.querySelector('[data-date=\"' + date.toJSON() + '\"]');\r\n\t\t\t\tif(el){\r\n\t\t\t\t\tel.checked = true;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tthat.el.tables.classList.remove('before');\r\n\t\t\tif(range && selectedDates.length > 1){\r\n\t\t\t\tvar currentDate = new Date(currentYear,currentMonth-1,1);\r\n\t\t\t\tvar sorted = selectedDates.sort(function(a,b){return a.getTime()-b.getTime()});\r\n\t\t\t\tvar first = that.el.querySelector('[data-date=\"'+ sorted[0].toJSON() +'\"]');\r\n\t\t\t\tif(!first && currentDate >= new Date(sorted[0].getFullYear(),sorted[0].getMonth(),1) && currentDate <= new Date(sorted[1].getFullYear(),sorted[1].getMonth(),1)){\r\n\t\t\t\t\tthat.el.tables.classList.add('before');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tfunction resetCalendar(){\r\n\t\t\t[].slice.call(that.el.querySelectorAll('.d-table input')).forEach(function(inputEl) {\r\n\t\t\t\tinputEl.checked = false;\r\n\t\t\t});\r\n\r\n\t\t\t[].slice.call(that.el.monthPicker.querySelectorAll('.current')).forEach(function(monthPickEl) {\r\n\t\t\t\tmonthPickEl.classList.remove('current');\r\n\t\t\t});\r\n\r\n\t\t\t[].slice.call(that.el.yearPicker.querySelectorAll('.current')).forEach(function(yearPickEl) {\r\n\t\t\t\tyearPickEl.classList.remove('current');\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\tfunction nextMonth(){\r\n\t\t\tcurrentMonth += months;\r\n\t\t\tsetDate();\r\n\t\t};\r\n\r\n\t\tfunction prevMonth(){\r\n\t\t\tcurrentMonth -= months;\r\n\t\t\tsetDate();\r\n\t\t};\r\n\r\n\t\tfunction selectDate(date,ignoreOnSelect){\r\n\t\t\tdate = new Date(date);\r\n\t\t\tdate.setHours(0,0,0,0);\r\n\t\t\tvar el = that.el.querySelector('[data-date=\"'+ date.toJSON() +'\"]');\r\n\t\t\t\r\n\t\t\tif(range && el && el.checked) {\r\n\t\t\t\tel.classList.add('single');\r\n\t\t\t}\r\n\r\n\t\t\tif(el && !el.checked){\r\n\t\t\t\tel.checked = true;\r\n\t\t\t}\r\n\r\n\r\n\t\t\tselectedDates.push(date);\r\n\r\n\t\t\tif(onSelect && !ignoreOnSelect){\r\n\t\t\t\tonSelect.apply(date,[true]);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tfunction unselectDate(date,ignoreOnSelect){\r\n\t\t\tdate = new Date(date);\r\n\t\t\tdate.setHours(0,0,0,0);\r\n\t\t\tvar el = that.el.querySelector('[data-date=\"'+ date.toJSON() +'\"]');\r\n\t\t\tif(el){\r\n\t\t\t\tel.classList.remove('single');\r\n\t\t\t\tif(el.checked){el.checked = false;}\r\n\t\t\t}\r\n\r\n\t\t\tselectedDates = selectedDates.filter(function(x){return x.getTime() != date.getTime()});\r\n\r\n\t\t\tif(onSelect && !ignoreOnSelect){\r\n\t\t\t\tonSelect.call(date,false);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tfunction unselectAll(ignoreOnSelect){\r\n\t\t\tselectedDates.forEach(function(date) {\r\n\t\t\t\tunselectDate(date,ignoreOnSelect);\t\t\t\t\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\tfunction inputChange(e){\r\n\t\t\tvar input = this;\r\n\t\t\tvar date = new Date(input.getAttribute('data-date'));\r\n\t\t\tinput.classList.remove('single');\r\n\t\t\tif(locked){return;}\r\n\t\t\tif(range){\r\n\t\t\t\tthat.el.tables.classList.remove('before');\r\n\t\t\t}\r\n\t\t\tif(input.checked){\r\n\t\t\t\tif(maxSelections && selectedDates.length > maxSelections-1){\r\n\t\t\t\t\tvar length = selectedDates.length;\r\n\t\t\t\t\tfor(length; length > maxSelections-1; length --){\r\n\t\t\t\t\t\tunselectDate(selectedDates[0]);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif(range && selectedDates.length){\r\n\t\t\t\t\tvar first = that.el.querySelector('[data-date=\"'+ selectedDates[0].toJSON() +'\"]');\r\n\t\t\t\t\tif(!first && date > selectedDates[0]){\r\n\t\t\t\t\t\tthat.el.tables.classList.add('before');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tselectedDates.push(date);\r\n\t\t\t\t\r\n\t\t\t\tif(closeOnSelect){\r\n\t\t\t\t\tthat.hide();\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tif(range && selectedDates.length == 1 && selectedDates[0].getTime() == date.getTime()){\r\n\t\t\t\t\tselectDate(date);\r\n\t\t\t\t\tinput.classList.add('single');\r\n\t\t\t\t}else{\r\n\t\t\t\t\tselectedDates = selectedDates.filter(function(x){return x.getTime() != date.getTime()})\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif(onSelect){\r\n\t\t\t\tonSelect.call(date,input.checked);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tfunction setRange(val){\r\n\t\t\tif(val){\r\n\t\t\t\trange = true;\r\n\t\t\t\tthat.el.tables.classList.add('range');\r\n\t\t\t}else{\r\n\t\t\t\trange = false;\r\n\t\t\t\tthat.el.tables.classList.remove('range');\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tfunction show(properties){\r\n\t\t\tif(!that.inline && that.container === document.body){document.body.classList.add('d-noscroll');}\r\n\t\t\tsetArgs(properties);\r\n\t\t\tvar handler = function(){\r\n\t\t\t\tthat.el.classList.remove('d-show');\r\n\t\t\t\tthat.el.calendar.removeEventListener(whichAnimationEvent(),handler);\r\n\t\t\t};\r\n\t\t\tthat.el.calendar.addEventListener(whichAnimationEvent(),handler);\r\n\t\t\tthat.el.classList.add('d-show');\r\n\t\t\tcontainer.appendChild(that.el);\r\n\t\t\topened = true;\r\n\t\t\tif(startDate){\r\n\t\t\t\tcurrentMonth = startDate.getMonth() + 1;\r\n\t\t\t\tcurrentYear = startDate.getFullYear();\r\n\t\t\t}\r\n\t\t\tsetDate();\r\n\t\t};\r\n\r\n\t\tfunction hide(){\r\n\t\t\tdocument.body.classList.remove('d-noscroll');\r\n\t\t\tvar handler = function(){\r\n\t\t\t\tthat.el.parentNode.removeChild(that.el);\r\n\t\t\t\topened = false;\r\n\t\t\t\tthat.el.classList.remove('d-hide');\r\n\t\t\t\tif(typeof onClose == 'function'){\r\n\t\t\t\t\tonClose.apply(that);\r\n\t\t\t\t}\r\n\t\t\t\tthat.el.removeEventListener(whichAnimationEvent(),handler);\r\n\t\t\t}\r\n\t\t\tthat.el.addEventListener(whichAnimationEvent(),handler);\r\n\t\t\tthat.el.classList.add('d-hide');\r\n\t\t};\r\n\r\n\t\tfunction bindEvents(){\r\n\t\t\tthat.el.header.childNodes[0].addEventListener(eventName,prevMonth);\r\n\t\t\tthat.el.header.childNodes[2].addEventListener(eventName,nextMonth);\r\n\t\t\tthat.el.header.childNodes[1].childNodes[0].addEventListener(eventName,function(){\r\n\t\t\t\tif(that.el.monthPicker.classList.contains('d-show')){\r\n\t\t\t\t\tthat.el.monthPicker.classList.remove('d-show');\r\n\t\t\t\t}else{\r\n\t\t\t\t\tthat.el.monthPicker.classList.add('d-show');\r\n\t\t\t\t}\r\n\t\t\t\tthat.el.yearPicker.classList.remove('d-show');\r\n\t\t\t});\r\n\t\t\tthat.el.header.childNodes[1].childNodes[1].addEventListener(eventName,function(){\r\n\t\t\t\tgenerateYears();\r\n\t\t\t\tif(that.el.yearPicker.classList.contains('d-show')){\r\n\t\t\t\t\tthat.el.yearPicker.classList.remove('d-show');\r\n\t\t\t\t}else{\r\n\t\t\t\t\tthat.el.yearPicker.classList.add('d-show');\r\n\t\t\t\t}\r\n\t\t\t\tthat.el.monthPicker.classList.remove('d-show');\r\n\t\t\t});\r\n\t\t\tthat.el.button.addEventListener(eventName,hide);\r\n\r\n\t\t\tthat.el.overlay.addEventListener(eventName,function(){\r\n\t\t\t\tif(closeOnClick){\r\n\t\t\t\t\tthat.hide();\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t[].slice.call(that.el.monthPicker.childNodes).forEach(function(monthPicker) {\r\n\t\t\t\tmonthPicker.addEventListener(eventName,function(){\r\n\t\t\t\t\tcurrentMonth = parseInt(this.getAttribute('data-month'));\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t\tthat.el.monthPicker.classList.remove('d-show');\r\n\t\t\t\t});\t\t\t\t\r\n\t\t\t});\r\n\r\n\t\t\t[].slice.call(that.el.yearPicker.childNodes).forEach(function(yearPicker) {\r\n\t\t\t\tyearPicker.addEventListener(eventName,function(){\r\n\t\t\t\t\tcurrentYear += parseInt(this.getAttribute('data-year'));\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t\tthat.el.yearPicker.classList.remove('d-show');\r\n\t\t\t\t});\t\t\t\t\r\n\t\t\t})\r\n\r\n\t\t\tvar startX = 0;\r\n\t\t\tvar distance = 0;\r\n\t\t\tthat.el.calendar.addEventListener('touchstart',function(e){\r\n\t\t\t\tstartX = e.changedTouches[0].clientX || e.originalEvent.changedTouches[0].clientX;\r\n\t\t\t\t//e.preventDefault();\r\n\t\t\t});\r\n\r\n\t\t\tthat.el.calendar.addEventListener('touchmove',function(e){\r\n\t\t\t\tdistance = e.changedTouches[0].clientX - startX || e.originalEvent.changedTouches[0].clientX - startX;\r\n\t\t\t\te.preventDefault();\r\n\t\t\t});\r\n\r\n\t\t\tthat.el.calendar.addEventListener('touchend',function(e){\r\n\t\t\t\tif(distance > 50){\r\n\t\t\t\t\tprevMonth();\r\n\t\t\t\t}else if(distance < -50){\r\n\t\t\t\t\tnextMonth();\r\n\t\t\t\t}\r\n\t\t\t\tdistance = 0;\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\tfunction setArgs(x){\r\n\t\t\tfor(var key in x){\r\n\t\t\t\tif(key in that){\r\n\t\t\t\t\tthat[key] = x[key];\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t};\r\n\r\n\t\tfunction init(){\r\n\t\t\tthat.el = document.createElement('div');\r\n\t\t\tthat.el.id = 'Datepickk';\r\n\t\t\tthat.el.classList.add(getBrowserVersion().type);\r\n\t\t\tthat.el.innerHTML = template;\r\n\t\t\tthat.el.calendar = that.el.childNodes[1];\r\n\t\t\tthat.el.titleBox = that.el.childNodes[0];\r\n\t\t\tthat.el.button = that.el.childNodes[3];\r\n\t\t\tthat.el.header = that.el.calendar.childNodes[0];\r\n\t\t\tthat.el.monthPicker = that.el.calendar.childNodes[1];\r\n\t\t\tthat.el.yearPicker = that.el.calendar.childNodes[2];\r\n\t\t\tthat.el.tables = that.el.calendar.childNodes[4];\r\n\t\t\tthat.el.days = that.el.calendar.childNodes[3];\r\n\t\t\tthat.el.overlay = that.el.childNodes[4];\r\n\t\t\tthat.el.legend = that.el.childNodes[2];\r\n\r\n\t\t\tsetArgs(args);\r\n\r\n\t\t\tgenerateInputs();\r\n\t\t\tgenerateDaynames();\r\n\t\t\tbindEvents();\r\n\r\n\t\t\tif(inline){\r\n\t\t\t\tshow();\r\n\t\t\t}\r\n\r\n\t\t\tif(window.FastClick != null){\r\n\t\t\t\tFastClick.attach(that.el);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthat.show = show;\r\n\t\tthat.hide = hide;\r\n\t\tthat.selectDate = selectDate;\r\n\t\tthat.unselectAll = unselectAll;\r\n\t\tthat.unselectDate = unselectDate;\r\n\r\n\t\tfunction currentDateGetter(){\r\n\t\t\treturn new Date(currentYear,currentMonth-1,1);\r\n\t\t}\r\n\t\tfunction currentDateSetter(x){\r\n\t\t\tx = new Date(x);\r\n\t\t\tcurrentMonth = x.getMonth() + 1;\r\n\t\t\tcurrentYear = x.getFullYear();\r\n\t\t\tsetDate();\r\n\t\t}\r\n\r\n\t\tObject.defineProperties(that,{\r\n\t\t\t\"selectedDates\": { \r\n\t\t\t\tget: function () { \r\n\t\t\t\t\treturn selectedDates.sort(function(a,b){return a.getTime() - b.getTime();}); \r\n\t\t\t\t} \r\n\t\t\t},\r\n\t\t\t\"range\": {\r\n\t\t\t\tget: function() {\r\n\t\t\t\t\treturn range;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x) {\r\n\t\t\t\t\tsetRange(x);\r\n\t\t\t\t\tif(x){maxSelections = 2;}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"button\": {\r\n\t\t\t\tget: function() {\r\n\t\t\t\t\treturn button;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(typeof x == 'string'){\r\n\t\t\t\t\t\tbutton = x;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tbutton = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthat.el.button.innerHTML = (button)?button:'';\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"title\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn title;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(typeof x == 'string'){\r\n\t\t\t\t\t\ttitle = x;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\ttitle = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthat.el.titleBox.innerText = (title)?title:'';\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"lang\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn lang;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x in languages){\r\n\t\t\t\t\t\tlang = x;\r\n\t\t\t\t\t\tgenerateDaynames();\r\n\t\t\t\t\t\tsetDate();\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tconsole.error('Language not found');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"months\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn months;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(typeof x == 'number' && x > 0){\r\n\t\t\t\t\t\tmonths = x;\r\n\t\t\t\t\t\tgenerateDaynames();\r\n\t\t\t\t\t\tgenerateInputs();\r\n\t\t\t\t\t\tsetDate();\r\n\r\n\t\t\t\t\t\tif(months == 1){\r\n\t\t\t\t\t\t\tthat.el.classList.remove('multi');\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tthat.el.classList.add('multi');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tconsole.error('months must be a number > 0');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"isOpen\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn opened;\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"closeOnSelect\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn closeOnSelect;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tcloseOnSelect = true; \r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tcloseOnSelect = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"disabledDays\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn disabledDays;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x instanceof Array){\r\n\t\t\t\t\t\tfor(var i = 0;i < x.length;i++){\r\n\t\t\t\t\t\t\tif(typeof x[i] == 'number'){\r\n\t\t\t\t\t\t\t\tdisabledDays.push(x[i]);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else if(typeof x == 'number'){\r\n\t\t\t\t\t\tdisabledDays = [x];\r\n\t\t\t\t\t}else if(!x){\r\n\t\t\t\t\t\tdisabledDays = [];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"disabledDates\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn disabledDates.map(function(x){return new Date(x);});\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x instanceof Array){\r\n\t\t\t\t\t\tx.forEach(function(date) {\r\n\t\t\t\t\t\t\tif(date instanceof Date){\r\n\t\t\t\t\t\t\t\tdisabledDates.push(new Date(date.getFullYear(),date.getMonth(),date.getDate()).getTime());\r\n\t\t\t\t\t\t\t}\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}else if(x instanceof Date){\r\n\t\t\t\t\t\tdisabledDates = [new Date(x.getFullYear(),x.getMonth(),x.getDate()).getTime()];\r\n\t\t\t\t\t}else if(!x){\r\n\t\t\t\t\t\tdisabledDates = [];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"highlight\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn highlight;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x instanceof Array){\r\n\t\t\t\t\t\tx.forEach(function(hl) {\r\n\t\t\t\t\t\t\tif(hl instanceof Object){\r\n\t\t\t\t\t\t\t\tvar highlightObj = {};\r\n\t\t\t\t\t\t\t\t\thighlightObj.dates = [];\r\n\r\n\t\t\t\t\t\t\t\tif('start' in hl){\r\n\t\t\t\t\t\t\t\t\thighlightObj.dates.push({\r\n\t\t\t\t\t\t\t\t\t\tstart: new Date(hl.start.getFullYear(),hl.start.getMonth(),hl.start.getDate()),\r\n\t\t\t\t\t\t\t\t\t\tend: ('end' in hl)?new Date(hl.end.getFullYear(),hl.end.getMonth(),hl.end.getDate()):new Date(hl.start.getFullYear(),hl.start.getMonth(),hl.start.getDate())\r\n\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t}else if('dates' in hl && hl.dates instanceof Array){\r\n\t\t\t\t\t\t\t\t\thl.dates.forEach(function(hlDate) {\r\n\t\t\t\t\t\t\t\t\t\thighlightObj.dates.push({\r\n\t\t\t\t\t\t\t\t\t\t\tstart: new Date(hlDate.start.getFullYear(),hlDate.start.getMonth(),hlDate.start.getDate()),\r\n\t\t\t\t\t\t\t\t\t\t\tend: ('end' in hlDate)?new Date(hlDate.end.getFullYear(),hlDate.end.getMonth(),hlDate.end.getDate()):new Date(hlDate.start.getFullYear(),hlDate.start.getMonth(),hlDate.start.getDate())\r\n\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t})\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\thighlightObj.color \t\t\t\t= hl.color;\r\n\t\t\t\t\t\t\t\thighlightObj.backgroundColor \t= hl.backgroundColor;\r\n\t\t\t\t\t\t\t\thighlightObj.legend\t\t\t\t= ('legend' in hl)?hl.legend:null;\r\n\r\n\t\t\t\t\t\t\t\thighlight.push(highlightObj);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}else if(x instanceof Object){\r\n\t\t\t\t\t\tvar highlightObj = {};\r\n\t\t\t\t\t\thighlightObj.dates = [];\r\n\r\n\t\t\t\t\t\tif('start' in x){\r\n\t\t\t\t\t\t\thighlightObj.dates.push({\r\n\t\t\t\t\t\t\t\tstart: new Date(x.start.getFullYear(),x.start.getMonth(),x.start.getDate()),\r\n\t\t\t\t\t\t\t\tend: ('end' in x)?new Date(x.end.getFullYear(),x.end.getMonth(),x.end.getDate()):new Date(x.start.getFullYear(),x.start.getMonth(),x.start.getDate())\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}else if('dates' in x && x.dates instanceof Array){\r\n\t\t\t\t\t\t\tx.dates.forEach(function(hlDate) {\r\n\t\t\t\t\t\t\t\thighlightObj.dates.push({\r\n\t\t\t\t\t\t\t\t\tstart: new Date(hlDate.start.getFullYear(),hlDate.start.getMonth(),hlDate.start.getDate()),\r\n\t\t\t\t\t\t\t\t\tend: ('end' in hlDate)?new Date(hlDate.end.getFullYear(),hlDate.end.getMonth(),hlDate.end.getDate()):new Date(hlDate.start.getFullYear(),hlDate.start.getMonth(),hlDate.start.getDate())\r\n\t\t\t\t\t\t\t\t});\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\thighlightObj.color \t\t\t\t= x.color;\r\n\t\t\t\t\t\thighlightObj.backgroundColor \t= x.backgroundColor;\r\n\t\t\t\t\t\thighlightObj.legend\t\t\t\t= ('legend' in x)?x.legend:null;\r\n\r\n\t\t\t\t\t\thighlight.push(highlightObj);\r\n\t\t\t\t\t}else if(!x){\r\n\t\t\t\t\t\thighlight = [];\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"onClose\": {\r\n\t\t\t\tset: function(callback){\r\n\t\t\t\t\tonClose = callback;\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"onSelect\": {\r\n\t\t\t\tset: function(callback){\r\n\t\t\t\t\tonSelect = callback;\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"today\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn today;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\ttoday = true;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\ttoday = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"daynames\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn daynames;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tdaynames = true;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tdaynames = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tgenerateDaynames();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"fullscreen\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn that.el.classList.contains('fullscreen');\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tthat.el.classList.add('fullscreen');\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tthat.el.classList.remove('fullscreen');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"locked\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn locked;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tlocked = true;\r\n\t\t\t\t\t\tthat.el.tables.classList.add('locked');\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tlocked = false;\r\n\t\t\t\t\t\tthat.el.tables.classList.remove('locked');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"maxSelections\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn maxSelections;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(typeof x == 'number' && !range){\r\n\t\t\t\t\t\tmaxSelections = x;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tif(range){\r\n\t\t\t\t\t\t\tmaxSelections = 2;\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tmaxSelections = null;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"onConfirm\": {\r\n\t\t\t\tset: function(callback){\r\n\t\t\t\t\tif(typeof callback == 'function'){\r\n\t\t\t\t\t\tonConfirm = callback.bind(that);\r\n\t\t\t\t\t\tthat.el.button.addEventListener(eventName,onConfirm);\r\n\t\t\t\t\t}else if(!callback){\r\n\t\t\t\t\t\tthat.el.button.removeEventListener(eventName,onConfirm);\r\n\t\t\t\t\t\tonConfirm = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"closeOnClick\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn closeOnClick;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tcloseOnClick = true;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tcloseOnClick = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"tooltips\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\tvar ret = [];\r\n\t\t\t\t\tfor(key in tooltips){\r\n\t\t\t\t\t\tret.push({\r\n\t\t\t\t\t\t\tdate: new Date(parseInt(key)),\r\n\t\t\t\t\t\t\ttext: tooltips[key]\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn ret;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x instanceof Array){\r\n\t\t\t\t\t\tx.forEach(function(item) {\r\n\t\t\t\t\t\t\tif(item.date && item.text && item.date instanceof Date){\r\n\t\t\t\t\t\t\t\ttooltips[new Date(item.date.getFullYear(),item.date.getMonth(),item.date.getDate()).getTime()] = item.text;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}else if(x instanceof Object){\r\n\t\t\t\t\t\tif(x.date && x.text && x.date instanceof Date){\r\n\t\t\t\t\t\t\ttooltips[new Date(x.date.getFullYear(),x.date.getMonth(),x.date.getDate()).getTime()] = x.text;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else if(!x){\r\n\t\t\t\t\t\ttooltips = [];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"currentDate\": {\r\n\t\t\t\tget: currentDateGetter,\r\n\t\t\t\tset: currentDateSetter\r\n\t\t\t},\r\n\t\t\t\"setDate\": {\r\n\t\t\t\tset: currentDateSetter\r\n\t\t\t},\r\n\t\t\t\"startDate\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn startDate;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tstartDate = new Date(x);\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tstartDate = null;\r\n\t\t\t\t\t\tcurrentYear = new Date().getFullYear();\r\n\t\t\t\t\t\tcurrentMonth = new Date().getMonth() + 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"minDate\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn minDate;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tminDate = new Date(x);\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"maxDate\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn maxDate;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tmaxDate = new Date(x);\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"container\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn container;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x instanceof String){\r\n\t\t\t\t\t\tvar y = document.querySelector(x);\r\n\t\t\t\t\t\tif(y){\r\n\t\t\t\t\t\t\tcontainer = y;\r\n\t\t\t\t\t\t\tif(container != document.body){\r\n\t\t\t\t\t\t\t\tthat.el.classList.add('wrapped');\r\n\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\tthat.el.classList.remove('wrapped');\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tconsole.error(\"Container doesn't exist\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else if(x instanceof HTMLElement){\r\n\t\t\t\t\t\tcontainer = x;\r\n\t\t\t\t\t\tif(container != document.body){\r\n\t\t\t\t\t\t\tthat.el.classList.add('wrapped');\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tthat.el.classList.remove('wrapped');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tconsole.error(\"Invalid type\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"inline\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn inline;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tinline = true;\r\n\t\t\t\t\t\tthat.el.classList.add('inline');\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tinline = false;\r\n\t\t\t\t\t\tthat.el.classList.remove('inline');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\r\n\t\t});\r\n\r\n\t\tinit();\r\n\t\tsetDate();\r\n\r\n\t\treturn Object.freeze(that);\r\n\t};\r\n\r\n\tfunction whichAnimationEvent(){\r\n\t var t;\r\n\t var el = document.createElement('fakeelement');\r\n\t var transitions = {\r\n\t 'animation':'animationend',\r\n\t 'OAnimation':'oanimationend',\r\n\t 'MozAnimation':'animationend',\r\n\t 'WebkitAnimation':'webkitAnimationEnd',\r\n\t '':'MSAnimationEnd'\r\n\t };\r\n\r\n\t for(t in transitions){\r\n\t if( el.style[t] !== undefined ){\r\n\t return transitions[t];\r\n\t }\r\n\t }\r\n\t}\r\n\r\n\tvar template = \t'
' +\r\n\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'' +\r\n\t\t\t\t\t\t\t'

' +\r\n\t\t\t\t\t\t\t'' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
1
' +\r\n\t\t\t\t\t\t\t'
2
' +\r\n\t\t\t\t\t\t\t'
3
' +\r\n\t\t\t\t\t\t\t'
4
' +\r\n\t\t\t\t\t\t\t'
5
' +\r\n\t\t\t\t\t\t\t'
6
' +\r\n\t\t\t\t\t\t\t'
7
' +\r\n\t\t\t\t\t\t\t'
8
' +\r\n\t\t\t\t\t\t\t'
9
' +\r\n\t\t\t\t\t\t\t'
10
' +\r\n\t\t\t\t\t\t\t'
11
' +\r\n\t\t\t\t\t\t\t'
12
' +\r\n\t\t\t\t\t\t'
' + \r\n\t\t\t\t\t\t'
' + \r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t'
' + \r\n\t\t\t\t\t'
' +\r\n\t\t\t\t\t'' + \r\n\t\t\t\t\t'
';\r\n\r\n\tvar getBrowserVersion = function(){\r\n\t\tvar browser = {\r\n\t\t\ttype: null,\r\n\t\t\tversion: null\r\n\t\t}\r\n\r\n\t\tvar ua= navigator.userAgent, tem, ios,\r\n\t M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\r\n\t ios = ua.match(/(iphone|ipad)\\s+OS\\s+([\\d+_]+\\d+)/i) || [];\r\n\t if(/trident/i.test(M[1])){\r\n\t tem= /\\brv[ :]+(\\d+)/g.exec(ua) || [];\r\n\t browser.type = 'MSIE';\r\n\t browser.version = parseInt(tem[1]);\r\n\t return browser;\r\n\t }\r\n\t if(M[1]=== 'Chrome'){\r\n\t tem= ua.match(/\\bOPR\\/(\\d+)/)\r\n\t if(tem!= null) return 'Opera '+tem[1];\r\n\t }\r\n\t if(ios[1]){\r\n\t \treturn browser = {\r\n\t \t\ttype: 'iOS',\r\n\t \t\tversion: ios[2]\r\n\t \t};\r\n\t }\r\n\t M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];\r\n\t if((tem= ua.match(/version\\/(\\d+)/i))!= null) M.splice(1, 1, tem[1]);\r\n\t browser.type = M[0];\r\n\t browser.version = parseInt(M[1]);\r\n\r\n\t return browser;\r\n\t}\r\n\r\n\t/* Spread it to the world! */\r\n\tif ( typeof define === 'function' && define.amd ) define('Datepickk', Datepickk);\r\n\telse if ( typeof exports === 'object' ) module.exports = Datepickk;\r\n\telse window.Datepickk = Datepickk;\r\n})();"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["datepickk.js"],"names":["Datepickk","args","generateDaynames","that","el","days","innerHTML","daynames","x","months","weekEl","document","createElement","setAttribute","i","dayEl","dayTextEl","languages","lang","dayNames","appendChild","generateYears","slice","call","yearPicker","childNodes","forEach","node","index","currentYear","parseInt","getAttribute","toString","substring","generateInputs","highlightLegend","e","hexToRgb","hex","result","exec","r","g","b","target","nodeName","legendIds","split","length","legendId","element","legend","querySelector","type","color","removeAttribute","tables","container","input","id","numInstances","label","text","tooltip","addEventListener","eventName","locked","event","preventDefault","inputChange","generateLegends","hoverLegend","querySelectorAll","this","classList","add","remove","start","Date","end","_highlights","highlight","filter","m","dates","legends","l","oldLegend","backgroundColor","legendItem","indexOf","legendItemPoint","push","item","removeEventListener","removeChild","parseMonth","month","generateDates","year","monthElements","weekStart","getDate","daysLast","startDay","getDay","monthText","monthNames","inputEl","labelEl","nextSibling","checked","className","date","toJSON","disabledDates","getTime","disabledDays","minDate","maxDate","today","setHours","tooltips","bgColor","percent","Math","round","z","Color","setDate","resetCalendar","currentMonth","getFullYear","getMonth","header","c","monthPicker","startmonth","endmonth","monthint","yearname","renderSelectedDates","onNavigation","selectedDates","range","currentDate","sorted","sort","a","first","monthPickEl","yearPickEl","nextMonth","prevMonth","selectDate","ignoreOnSelect","onSelect","apply","unselectDate","unselectAll","maxSelections","closeOnSelect","hide","setRange","val","show","properties","inline","body","setArgs","handler","calendar","whichAnimationEvent","opened","startDate","parentNode","onClose","bindEvents","contains","button","overlay","closeOnClick","startX","distance","changedTouches","clientX","originalEvent","key","init","getBrowserVersion","template","titleBox","window","FastClick","attach","currentDateGetter","currentDateSetter","no","en","de","title","onConfirm","Object","defineProperties","get","set","innerText","console","error","isOpen","Array","map","hl","highlightObj","hlDate","callback","fullscreen","bind","ret","String","y","HTMLElement","freeze","t","transitions","animation","OAnimation","MozAnimation","WebkitAnimation","","undefined","style","tem","ios","browser","version","ua","navigator","userAgent","M","match","test","appName","appVersion","splice","define","amd","exports","module"],"mappings":"CAKA,WAEC,QAASA,GAAUC,GAqDlB,QAASC,KAER,GADAC,EAAKC,GAAGC,KAAKC,UAAY,GACtBC,EACF,IAAI,GAAIC,GAAI,EAAIC,EAAFD,GAAc,EAAFA,EAAIA,IAAI,CACjC,GAAIE,GAASC,SAASC,cAAc,MACnCF,GAAOG,aAAa,QAAQ,SAC7B,KAAI,GAAIC,GAAI,EAAO,EAAJA,EAAMA,IAAI,CACxB,GAAIC,GAAQJ,SAASC,cAAc,OAC/BI,EAAYL,SAASC,cAAc,IACtCI,GAAUV,UAAYW,EAAUC,GAAMC,SAASL,GAE/CC,EAAMK,YAAYJ,GAClBN,EAAOU,YAAYL,GAGrBZ,EAAKC,GAAGC,KAAKe,YAAYV,IAK5B,QAASW,QACLC,MAAMC,KAAKpB,EAAKC,GAAGoB,WAAWC,YAAYC,QAAQ,SAASC,EAAKC,GAClED,EAAKrB,UAAY,KAAOuB,EA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K6B2C,GAAKC,EAL9BC,GACHrL,KAAM,KACNsL,QAAS,MAGNC,EAAIC,UAAUC,UACfC,EAAGH,EAAGI,MAAM,mEAEZ,OADAP,GAAMG,EAAGI,MAAM,0CACZ,WAAWC,KAAKF,EAAE,KACjBP,EAAM,kBAAkBhM,KAAKoM,OAC7BF,EAAQrL,KAAO,OACfqL,EAAQC,QAAU7M,SAAS0M,EAAI,IACxBE,GAEA,WAARK,EAAE,KACDP,EAAKI,EAAGI,MAAM,gBACL,MAANR,GAAmB,SAASA,EAAI,GAEpCC,EAAI,GACCC,GACNrL,KAAM,MACNsL,QAASF,EAAI,KAGfM,EAAGA,EAAE,IAAKA,EAAE,GAAIA,EAAE,KAAMF,UAAUK,QAASL,UAAUM,WAAY,MACzB,OAApCX,EAAKI,EAAGI,MAAM,qBAA4BD,EAAEK,OAAO,EAAG,EAAGZ,EAAI,IACjEE,EAAQrL,KAAO0L,EAAE,GACjBL,EAAQC,QAAU7M,SAASiN,EAAE,IAEtBL,GAIY,mBAAXW,SAAyBA,OAAOC,IAAMD,OAAO,YAAarP,GACzC,gBAAZuP,SAAuBC,OAAOD,QAAUvP,EACpDgM,OAAOhM,UAAYA","file":"datepickk.min.js","sourcesContent":["/*!\r\n * Datepickk\r\n * Docs & License: https://crsten.github.com/datepickk\r\n * (c) 2016 Carsten Jacobsen\r\n */\r\n(function(){\r\n\r\n\tfunction Datepickk(args){\r\n\t\tDatepickk.numInstances = (Datepickk.numInstances || 0) + 1;\r\n\t\tvar that = this;\r\n\t\tvar eventName = 'click';\r\n\t\tvar selectedDates = [];\r\n\r\n\t\tvar currentYear = new Date().getFullYear();\r\n\t\tvar currentMonth = new Date().getMonth() + 1;\r\n\r\n\t\tvar languages = {\r\n\t\t\tno: {\r\n\t\t\t\tmonthNames:['Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember'],\r\n\t\t\t\tdayNames:['ma','ti','on','to','fr','lø','sø'],\r\n\t\t\t\tweekStart:1\r\n\t\t\t},\r\n\t\t\ten: {\r\n\t\t\t\tmonthNames:['january','february','march','april','may','june','july','august','september','october','november','december'],\r\n\t\t\t\tdayNames:['su','mo','tu','we','th','fr','sa'],\r\n\t\t\t\tweekStart:0\r\n\t\t\t},\r\n\t\t\tde: {\r\n\t\t\t\tmonthNames:['Januar','Februar','März','April','Mai','Juni','Juli','August','September','Oktober','November','Dezember'],\r\n\t\t\t\tdayNames:['Mo','Di','Mi','Do','Fr','Sa','So'],\r\n\t\t\t\tweekStart:1\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tvar range = false;\r\n\t\tvar maxSelections = null;\r\n\t\tvar container = document.body;\r\n\t\tvar opened = false;\r\n\t\tvar months = 1;\r\n\t\tvar closeOnSelect = false;\r\n\t\tvar button = null;\r\n\t\tvar title = null;\r\n\t\tvar onNavigation = null;\r\n\t\tvar onClose = null;\r\n\t\tvar onConfirm = null;\r\n\t\tvar closeOnClick = true;\r\n\t\tvar inline = false;\r\n\t\tvar lang = 'en';\r\n\t\tvar onSelect = null;\r\n\t\tvar disabledDates = [];\r\n\t\tvar disabledDays = [];\r\n\t\tvar highlight = [];\r\n\t\tvar tooltips = {};\r\n\t\tvar daynames = true;\r\n\t\tvar today = true;\r\n\t\tvar startDate = null;\r\n\t\tvar minDate = null;\r\n\t\tvar maxDate = null;\r\n\t\tvar locked = false;\r\n\r\n\t\tfunction generateDaynames(){\r\n\t\t\tthat.el.days.innerHTML = '';\r\n\t\t\tif(daynames){\r\n\t\t\t\tfor(var x = 0;x start){\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\treturn false;\r\n\t\t\t});\r\n\t\t\tvar legends = [];\r\n\t\t\tfor(var l = 0;l<_highlights.length;l++){\r\n\t\t\t\tif('legend' in _highlights[l] && _highlights[l].legend){\r\n\t\t\t\t\tvar oldLegend = container.querySelector('.d-legend-item[data-legend=\"' + _highlights[l].legend + '\"][data-color=\"' + _highlights[l].backgroundColor + '\"]');\r\n\t\t\t\t\tif(oldLegend == null){\r\n\t\t\t\t\t\tvar legendItem = document.createElement('p');\r\n\t\t\t\t\t\t\tlegendItem.setAttribute('class','d-legend-item');\r\n\t\t\t\t\t\t\tlegendItem.setAttribute('data-legend',_highlights[l].legend);\r\n\t\t\t\t\t\t\tlegendItem.setAttribute('data-legend-id',highlight.indexOf(_highlights[l]));\r\n\t\t\t\t\t\t\tlegendItem.setAttribute('data-color',_highlights[l].backgroundColor);\r\n\t\t\t\t\t\tvar legendItemPoint = document.createElement('span');\r\n\t\t\t\t\t\t\tlegendItemPoint.setAttribute('style','background-color:' + _highlights[l].backgroundColor);\r\n\r\n\t\t\t\t\t\tlegendItem.appendChild(legendItemPoint);\r\n\r\n\t\t\t\t\t\tthat.el.legend.appendChild(legendItem);\r\n\t\t\t\t\t\tlegendItem.addEventListener('mouseover',hoverLegend);\r\n\t\t\t\t\t\tlegendItem.addEventListener('mouseout',hoverLegend);\r\n\t\t\t\t\t\tlegends.push(legendItem);\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tlegends.push(oldLegend);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t[].slice.call(that.el.legend.querySelectorAll('.d-legend-item')).forEach(function(item) {\r\n\t\t\t\tif(legends.indexOf(item) < 0){\r\n\t\t\t\t\titem.removeEventListener('mouseover',hoverLegend);\r\n\t\t\t\t\titem.removeEventListener('mouseout',hoverLegend);\r\n\t\t\t\t\tthat.el.legend.removeChild(item);\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tfunction hoverLegend(e){\r\n\t\t\t\t[].slice.call(that.el.tables.querySelectorAll('[data-legend-id*=\"' + this.getAttribute('data-legend-id') + '\"]')).forEach(function(element) {\r\n\t\t\t\t\tif(e.type == 'mouseover') element.classList.add('legend-hover');\r\n\t\t\t\t\telse element.classList.remove('legend-hover');\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tfunction parseMonth(month){\r\n\t\t\tif(month > 11) month -= 12;\r\n\t\t\telse if(month < 0) month += 12;\r\n\t\t\treturn month;\r\n\t\t}\r\n\r\n\t\tfunction generateDates(year,month){\r\n\t\t\tvar monthElements = that.el.querySelectorAll('.d-table');\r\n\t\t\tvar weekStart = languages[lang].weekStart;\r\n\r\n\t\t\t[].slice.call(that.el.querySelectorAll('.d-table')).forEach(function(element, index) {\r\n\t\t\t\tvar days = new Date(year,month + index,0).getDate();\r\n\t\t\t\tvar daysLast = new Date(year,month + index - 1,0).getDate();\r\n\t\t\t\tvar startDay = new Date(year,month + index - 1,1).getDay();\r\n\t\t\t\tvar startDate = null;\r\n\t\t\t\tvar endDate = null;\r\n\t\t\t\tif(startDay - weekStart < 0){\r\n\t\t\t\t\tstartDay = 7 - weekStart;\r\n\t\t\t\t}else{\r\n\t\t\t\t\tstartDay -= weekStart;\r\n\t\t\t\t}\r\n\t\t\t\tvar monthText = languages[lang].monthNames[parseMonth(month - 1 + index)];\r\n\t\t\t\telement.setAttribute('data-month',monthText);\r\n\r\n\t\t\t\t[].slice.call(element.querySelectorAll('.d-table input')).forEach(function(inputEl,i) {\r\n\t\t\t\t\tvar labelEl = inputEl.nextSibling;\r\n\r\n\t\t\t\t\tinputEl.checked = false;\r\n\t\t\t\t\tinputEl.removeAttribute('disabled');\r\n\t\t\t\t\tlabelEl.removeAttribute('style');\r\n\t\t\t\t\tlabelEl.removeAttribute('data-legend-id');\r\n\t\t\t\t\tlabelEl.className = '';\r\n\r\n\t\t\t\t\tvar date = null;\r\n\t\t\t\t\tif(i < startDay){\r\n\t\t\t\t\t\tlabelEl.childNodes[0].innerHTML = daysLast - (startDay - i - 1);\r\n\t\t\t\t\t\tif(index == 0){\r\n\t\t\t\t\t\t\tdate = new Date(year,month + index - 2,daysLast - (startDay - i - 1));\r\n\t\t\t\t\t\t\tlabelEl.className = 'prev';\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tdate = '';\r\n\t\t\t\t\t\t\tlabelEl.className = 'd-hidden';\r\n\t\t\t\t\t\t\tinputEl.setAttribute('disabled',true);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else if(i < days + startDay){\r\n\t\t\t\t\t\tdate = new Date(year,month + index - 1,i - startDay+1);\r\n\t\t\t\t\t\tlabelEl.childNodes[0].innerHTML = i - startDay + 1;\r\n\t\t\t\t\t\tlabelEl.className = '';\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tlabelEl.childNodes[0].innerHTML = i - days - startDay + 1;\r\n\t\t\t\t\t\tif(index == monthElements.length-1){\r\n\t\t\t\t\t\t\tdate = new Date(year,month + index,i - days - startDay + 1);\r\n\t\t\t\t\t\t\tlabelEl.className = 'next';\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tdate = '';\r\n\t\t\t\t\t\t\tlabelEl.className = 'd-hidden';\r\n\t\t\t\t\t\t\tinputEl.setAttribute('disabled',true);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif(date instanceof Date){\r\n\t\t\t\t\t\tinputEl.setAttribute('data-date',date.toJSON());\r\n\r\n\t\t\t\t\t\tif(disabledDates.indexOf(date.getTime()) != -1 || disabledDays.indexOf(date.getDay()) != -1){\r\n\t\t\t\t\t\t\tinputEl.setAttribute('disabled',true);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif((minDate && date < minDate) || (maxDate && date > maxDate)){\r\n\t\t\t\t\t\t\tinputEl.setAttribute('disabled',true);\r\n\t\t\t\t\t\t\tlabelEl.className = 'd-hidden';\r\n\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tif(today && date.getTime() == new Date().setHours(0,0,0,0)){\r\n\t\t\t\t\t\t\tlabelEl.classList.add('today');\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tlabelEl.classList.remove('today');\r\n\t\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\t\tif(tooltips[date.getTime()]){\r\n\t\t\t\t\t\t\tlabelEl.childNodes[0].setAttribute('data-tooltip',true);\r\n\t\t\t\t\t\t\tlabelEl.childNodes[1].innerHTML = tooltips[date.getTime()];\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tlabelEl.childNodes[0].removeAttribute('data-tooltip');\r\n\t\t\t\t\t\t\tlabelEl.childNodes[1].innerHTML = '';\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tvar _highlights = highlight.filter(function(x){\r\n\t\t\t\t\t\t\tfor(var m = 0;m < x.dates.length;m++){\r\n\t\t\t\t\t\t\t\tif(date.getTime() >= x.dates[m].start.getTime() && date.getTime() <= x.dates[m].end.getTime()){\r\n\t\t\t\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\t});\r\n\r\n\t\t\t\t\t\tif(_highlights.length > 0){\r\n\t\t\t\t\t\t\tvar bgColor = '';\r\n\t\t\t\t\t\t\tvar legendIds = '';\r\n\r\n\t\t\t\t\t\t\tif(_highlights.length > 1){\r\n\t\t\t\t\t\t\t\tvar percent = Math.round(100 / _highlights.length);\r\n\t\t\t\t\t\t\t\tbgColor = 'background: linear-gradient(-45deg,';\r\n\t\t\t\t\t\t\t\tfor(var z = 0;z < _highlights.length;z++){\r\n\t\t\t\t\t\t\t\t\tlegendIds += highlight.indexOf(_highlights[z]);\r\n\t\t\t\t\t\t\t\t\tif(z !== _highlights.length -1){legendIds += ' ';}\r\n\t\t\t\t\t\t\t\t\tbgColor += _highlights[z].backgroundColor + ' ' + (percent*z) + '%';\r\n\t\t\t\t\t\t\t\t\tif(z != _highlights.length - 1){\r\n\t\t\t\t\t\t\t\t\t\tbgColor += ',';\r\n\t\t\t\t\t\t\t\t\t\tbgColor += _highlights[z].backgroundColor + ' ' + (percent*(z+1)) + '%,';\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tbgColor += ');';\r\n\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\tbgColor = (_highlights[0].backgroundColor)?'background:'+ _highlights[0].backgroundColor + ';':'';\r\n\t\t\t\t\t\t\t\tlegendIds += highlight.indexOf(_highlights[0]);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tvar Color = (_highlights[0].color)?'color:'+ _highlights[0].color + ';':'';\r\n\t\t\t\t\t\t\tlabelEl.setAttribute('style',bgColor + Color);\r\n\t\t\t\t\t\t\tlabelEl.setAttribute('data-legend-id',legendIds);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\tgenerateLegends();\r\n\t\t};\r\n\r\n\t\tfunction setDate(){\r\n\t\t\tif(!that.el.tables.childNodes.length || !that.el.tables.childNodes[0].childNodes.length) return;\r\n\r\n\t\t\tresetCalendar();\r\n\r\n\t\t\tif(currentMonth > 12 || currentMonth < 1){\r\n\t\t\t\tif(currentMonth > 12){\r\n\t\t\t\t\tcurrentYear += 1;\r\n\t\t\t\t\tcurrentMonth -= 12;\r\n\t\t\t\t}else{\r\n\t\t\t\t\tcurrentYear -= 1;\r\n\t\t\t\t\tcurrentMonth += 12;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif(maxDate && new Date(currentYear,currentMonth-1+months-1,1) >= new Date(maxDate).setDate(1)){\r\n\t\t\t\tcurrentYear = maxDate.getFullYear();\r\n\t\t\t\tcurrentMonth = maxDate.getMonth() + 1 - months + 1;\r\n\t\t\t\tthat.el.header.childNodes[2].setAttribute('style','visibility:hidden');\r\n\t\t\t}else{\r\n\t\t\t\tthat.el.header.childNodes[2].removeAttribute('style');\r\n\t\t\t}\r\n\t\t\tif(minDate && new Date(currentYear,currentMonth -1,1) <= new Date(minDate).setDate(1)){\r\n\t\t\t\tcurrentYear = minDate.getFullYear();\r\n\t\t\t\tcurrentMonth = minDate.getMonth() + 1;\r\n\t\t\t\tthat.el.header.childNodes[0].setAttribute('style','visibility:hidden');\r\n\t\t\t}else{\r\n\t\t\t\tthat.el.header.childNodes[0].removeAttribute('style');\r\n\t\t\t}\r\n\r\n\t\t\tfor(var c = 0;c < months;c++){\r\n\t\t\t\tvar index = currentMonth-1+c;\r\n\t\t\t\tif(index > 11){\r\n\t\t\t\t\tindex -= 12;\r\n\t\t\t\t}else if(index < 0){\r\n\t\t\t\t\tindex += 12;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tthat.el.monthPicker.childNodes[index].classList.add('current');\r\n\t\t\t}\r\n\r\n\t\t\tgenerateDates(currentYear,currentMonth);\r\n\t\t\tgenerateYears();\r\n\t\t\tvar startmonth = languages[lang].monthNames[currentMonth-1];\r\n\t\t\tvar endmonth = '';\r\n\t\t\tif(months > 1){\r\n\t\t\t\tendmonth += ' - ';\r\n\t\t\t\tvar monthint = currentMonth-1+months-1;\r\n\t\t\t\tif(monthint > 11){\r\n\t\t\t\t\tmonthint -= 12;\r\n\t\t\t\t}else if(monthint < 0){\r\n\t\t\t\t\tmonthint += 12;\r\n\t\t\t\t}\r\n\t\t\t\tendmonth += languages[lang].monthNames[monthint];\r\n\t\t\t}\r\n\t\t\tvar yearname = (currentMonth-1+months-1 > 11)?currentYear.toString().substring(2,4) + '/' + (currentYear + 1).toString().substring(2,4):currentYear.toString().substring(2,4);\r\n\t\t\tthat.el.header.childNodes[1].childNodes[0].innerHTML = startmonth + endmonth;\r\n\t\t\tthat.el.header.childNodes[1].childNodes[1].innerHTML = yearname;\r\n\r\n\t\t\tthat.el.yearPicker.querySelector('[data-year=\"0\"]').classList.add('current');\r\n\t\t\tif(currentMonth-1+months-1>11){\r\n\t\t\t\tthat.el.yearPicker.querySelector('[data-year=\"1\"]').classList.add('current');\r\n\t\t\t}\r\n\r\n\t\t\trenderSelectedDates();\r\n\t\t\tif(onNavigation) onNavigation.call(that);\r\n\t\t};\r\n\r\n\t\tfunction renderSelectedDates(){\r\n\t\t\tselectedDates.forEach(function(date) {\r\n\t\t\t\tvar el = that.el.querySelector('[data-date=\"' + date.toJSON() + '\"]');\r\n\t\t\t\tif(el){\r\n\t\t\t\t\tel.checked = true;\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\tthat.el.tables.classList.remove('before');\r\n\t\t\tif(range && selectedDates.length > 1){\r\n\t\t\t\tvar currentDate = new Date(currentYear,currentMonth-1,1);\r\n\t\t\t\tvar sorted = selectedDates.sort(function(a,b){return a.getTime()-b.getTime()});\r\n\t\t\t\tvar first = that.el.querySelector('[data-date=\"'+ sorted[0].toJSON() +'\"]');\r\n\t\t\t\tif(!first && currentDate >= new Date(sorted[0].getFullYear(),sorted[0].getMonth(),1) && currentDate <= new Date(sorted[1].getFullYear(),sorted[1].getMonth(),1)){\r\n\t\t\t\t\tthat.el.tables.classList.add('before');\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tfunction resetCalendar(){\r\n\t\t\t[].slice.call(that.el.querySelectorAll('.d-table input')).forEach(function(inputEl) {\r\n\t\t\t\tinputEl.checked = false;\r\n\t\t\t});\r\n\r\n\t\t\t[].slice.call(that.el.monthPicker.querySelectorAll('.current')).forEach(function(monthPickEl) {\r\n\t\t\t\tmonthPickEl.classList.remove('current');\r\n\t\t\t});\r\n\r\n\t\t\t[].slice.call(that.el.yearPicker.querySelectorAll('.current')).forEach(function(yearPickEl) {\r\n\t\t\t\tyearPickEl.classList.remove('current');\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\tfunction nextMonth(){\r\n\t\t\tcurrentMonth += months;\r\n\t\t\tsetDate();\r\n\t\t};\r\n\r\n\t\tfunction prevMonth(){\r\n\t\t\tcurrentMonth -= months;\r\n\t\t\tsetDate();\r\n\t\t};\r\n\r\n\t\tfunction selectDate(date,ignoreOnSelect){\r\n\t\t\tdate = new Date(date);\r\n\t\t\tdate.setHours(0,0,0,0);\r\n\t\t\tvar el = that.el.querySelector('[data-date=\"'+ date.toJSON() +'\"]');\r\n\r\n\t\t\tif(range && el && el.checked) {\r\n\t\t\t\tel.classList.add('single');\r\n\t\t\t}\r\n\r\n\t\t\tif(el && !el.checked){\r\n\t\t\t\tel.checked = true;\r\n\t\t\t}\r\n\r\n\r\n\t\t\tselectedDates.push(date);\r\n\r\n\t\t\tif(onSelect && !ignoreOnSelect){\r\n\t\t\t\tonSelect.apply(date,[true]);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tfunction unselectDate(date,ignoreOnSelect){\r\n\t\t\tdate = new Date(date);\r\n\t\t\tdate.setHours(0,0,0,0);\r\n\t\t\tvar el = that.el.querySelector('[data-date=\"'+ date.toJSON() +'\"]');\r\n\t\t\tif(el){\r\n\t\t\t\tel.classList.remove('single');\r\n\t\t\t\tif(el.checked){el.checked = false;}\r\n\t\t\t}\r\n\r\n\t\t\tselectedDates = selectedDates.filter(function(x){return x.getTime() != date.getTime()});\r\n\r\n\t\t\tif(onSelect && !ignoreOnSelect){\r\n\t\t\t\tonSelect.call(date,false);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tfunction unselectAll(ignoreOnSelect){\r\n\t\t\tselectedDates.forEach(function(date) {\r\n\t\t\t\tunselectDate(date,ignoreOnSelect);\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\tfunction inputChange(e){\r\n\t\t\tvar input = this;\r\n\t\t\tvar date = new Date(input.getAttribute('data-date'));\r\n\t\t\tinput.classList.remove('single');\r\n\t\t\tif(locked){return;}\r\n\t\t\tif(range){\r\n\t\t\t\tthat.el.tables.classList.remove('before');\r\n\t\t\t}\r\n\t\t\tif(input.checked){\r\n\t\t\t\tif(maxSelections && selectedDates.length > maxSelections-1){\r\n\t\t\t\t\tvar length = selectedDates.length;\r\n\t\t\t\t\tfor(length; length > maxSelections-1; length --){\r\n\t\t\t\t\t\tunselectDate(selectedDates[0]);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\tif(range && selectedDates.length){\r\n\t\t\t\t\tvar first = that.el.querySelector('[data-date=\"'+ selectedDates[0].toJSON() +'\"]');\r\n\t\t\t\t\tif(!first && date > selectedDates[0]){\r\n\t\t\t\t\t\tthat.el.tables.classList.add('before');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tselectedDates.push(date);\r\n\r\n\t\t\t\tif(closeOnSelect){\r\n\t\t\t\t\tthat.hide();\r\n\t\t\t\t}\r\n\t\t\t}else{\r\n\t\t\t\tif(range && selectedDates.length == 1 && selectedDates[0].getTime() == date.getTime()){\r\n\t\t\t\t\tselectDate(date);\r\n\t\t\t\t\tinput.classList.add('single');\r\n\t\t\t\t}else{\r\n\t\t\t\t\tselectedDates = selectedDates.filter(function(x){return x.getTime() != date.getTime()})\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif(onSelect){\r\n\t\t\t\tonSelect.call(date,input.checked);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tfunction setRange(val){\r\n\t\t\tif(val){\r\n\t\t\t\trange = true;\r\n\t\t\t\tthat.el.tables.classList.add('range');\r\n\t\t\t}else{\r\n\t\t\t\trange = false;\r\n\t\t\t\tthat.el.tables.classList.remove('range');\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\tfunction show(properties){\r\n\t\t\tif(!that.inline && that.container === document.body){document.body.classList.add('d-noscroll');}\r\n\t\t\tsetArgs(properties);\r\n\t\t\tvar handler = function(){\r\n\t\t\t\tthat.el.classList.remove('d-show');\r\n\t\t\t\tthat.el.calendar.removeEventListener(whichAnimationEvent(),handler);\r\n\t\t\t};\r\n\t\t\tthat.el.calendar.addEventListener(whichAnimationEvent(),handler);\r\n\t\t\tthat.el.classList.add('d-show');\r\n\t\t\tcontainer.appendChild(that.el);\r\n\t\t\topened = true;\r\n\t\t\tif(startDate){\r\n\t\t\t\tcurrentMonth = startDate.getMonth() + 1;\r\n\t\t\t\tcurrentYear = startDate.getFullYear();\r\n\t\t\t}\r\n\t\t\tsetDate();\r\n\t\t};\r\n\r\n\t\tfunction hide(){\r\n\t\t\tdocument.body.classList.remove('d-noscroll');\r\n\t\t\tvar handler = function(){\r\n\t\t\t\tthat.el.parentNode.removeChild(that.el);\r\n\t\t\t\topened = false;\r\n\t\t\t\tthat.el.classList.remove('d-hide');\r\n\t\t\t\tif(typeof onClose == 'function'){\r\n\t\t\t\t\tonClose.apply(that);\r\n\t\t\t\t}\r\n\t\t\t\tthat.el.removeEventListener(whichAnimationEvent(),handler);\r\n\t\t\t}\r\n\t\t\tthat.el.addEventListener(whichAnimationEvent(),handler);\r\n\t\t\tthat.el.classList.add('d-hide');\r\n\t\t};\r\n\r\n\t\tfunction bindEvents(){\r\n\t\t\tthat.el.header.childNodes[0].addEventListener(eventName,prevMonth);\r\n\t\t\tthat.el.header.childNodes[2].addEventListener(eventName,nextMonth);\r\n\t\t\tthat.el.header.childNodes[1].childNodes[0].addEventListener(eventName,function(){\r\n\t\t\t\tif(that.el.monthPicker.classList.contains('d-show')){\r\n\t\t\t\t\tthat.el.monthPicker.classList.remove('d-show');\r\n\t\t\t\t}else{\r\n\t\t\t\t\tthat.el.monthPicker.classList.add('d-show');\r\n\t\t\t\t}\r\n\t\t\t\tthat.el.yearPicker.classList.remove('d-show');\r\n\t\t\t});\r\n\t\t\tthat.el.header.childNodes[1].childNodes[1].addEventListener(eventName,function(){\r\n\t\t\t\tgenerateYears();\r\n\t\t\t\tif(that.el.yearPicker.classList.contains('d-show')){\r\n\t\t\t\t\tthat.el.yearPicker.classList.remove('d-show');\r\n\t\t\t\t}else{\r\n\t\t\t\t\tthat.el.yearPicker.classList.add('d-show');\r\n\t\t\t\t}\r\n\t\t\t\tthat.el.monthPicker.classList.remove('d-show');\r\n\t\t\t});\r\n\t\t\tthat.el.button.addEventListener(eventName,hide);\r\n\r\n\t\t\tthat.el.overlay.addEventListener(eventName,function(){\r\n\t\t\t\tif(closeOnClick){\r\n\t\t\t\t\tthat.hide();\r\n\t\t\t\t}\r\n\t\t\t});\r\n\r\n\t\t\t[].slice.call(that.el.monthPicker.childNodes).forEach(function(monthPicker) {\r\n\t\t\t\tmonthPicker.addEventListener(eventName,function(){\r\n\t\t\t\t\tcurrentMonth = parseInt(this.getAttribute('data-month'));\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t\tthat.el.monthPicker.classList.remove('d-show');\r\n\t\t\t\t});\r\n\t\t\t});\r\n\r\n\t\t\t[].slice.call(that.el.yearPicker.childNodes).forEach(function(yearPicker) {\r\n\t\t\t\tyearPicker.addEventListener(eventName,function(){\r\n\t\t\t\t\tcurrentYear += parseInt(this.getAttribute('data-year'));\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t\tthat.el.yearPicker.classList.remove('d-show');\r\n\t\t\t\t});\r\n\t\t\t})\r\n\r\n\t\t\tvar startX = 0;\r\n\t\t\tvar distance = 0;\r\n\t\t\tthat.el.calendar.addEventListener('touchstart',function(e){\r\n\t\t\t\tstartX = e.changedTouches[0].clientX || e.originalEvent.changedTouches[0].clientX;\r\n\t\t\t\t//e.preventDefault();\r\n\t\t\t});\r\n\r\n\t\t\tthat.el.calendar.addEventListener('touchmove',function(e){\r\n\t\t\t\tdistance = e.changedTouches[0].clientX - startX || e.originalEvent.changedTouches[0].clientX - startX;\r\n\t\t\t\te.preventDefault();\r\n\t\t\t});\r\n\r\n\t\t\tthat.el.calendar.addEventListener('touchend',function(e){\r\n\t\t\t\tif(distance > 50){\r\n\t\t\t\t\tprevMonth();\r\n\t\t\t\t}else if(distance < -50){\r\n\t\t\t\t\tnextMonth();\r\n\t\t\t\t}\r\n\t\t\t\tdistance = 0;\r\n\t\t\t});\r\n\t\t};\r\n\r\n\t\tfunction setArgs(x){\r\n\t\t\tfor(var key in x){\r\n\t\t\t\tif(key in that){\r\n\t\t\t\t\tthat[key] = x[key];\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t};\r\n\r\n\t\tfunction init(){\r\n\t\t\tthat.el = document.createElement('div');\r\n\t\t\tthat.el.id = 'Datepickk';\r\n\t\t\tthat.el.classList.add(getBrowserVersion().type);\r\n\t\t\tthat.el.innerHTML = template;\r\n\t\t\tthat.el.calendar = that.el.childNodes[1];\r\n\t\t\tthat.el.titleBox = that.el.childNodes[0];\r\n\t\t\tthat.el.button = that.el.childNodes[3];\r\n\t\t\tthat.el.header = that.el.calendar.childNodes[0];\r\n\t\t\tthat.el.monthPicker = that.el.calendar.childNodes[1];\r\n\t\t\tthat.el.yearPicker = that.el.calendar.childNodes[2];\r\n\t\t\tthat.el.tables = that.el.calendar.childNodes[4];\r\n\t\t\tthat.el.days = that.el.calendar.childNodes[3];\r\n\t\t\tthat.el.overlay = that.el.childNodes[4];\r\n\t\t\tthat.el.legend = that.el.childNodes[2];\r\n\r\n\t\t\tsetArgs(args);\r\n\r\n\t\t\tgenerateInputs();\r\n\t\t\tgenerateDaynames();\r\n\t\t\tbindEvents();\r\n\r\n\t\t\tif(inline){\r\n\t\t\t\tshow();\r\n\t\t\t}\r\n\r\n\t\t\tif(window.FastClick != null){\r\n\t\t\t\tFastClick.attach(that.el);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthat.show = show;\r\n\t\tthat.hide = hide;\r\n\t\tthat.selectDate = selectDate;\r\n\t\tthat.unselectAll = unselectAll;\r\n\t\tthat.unselectDate = unselectDate;\r\n\r\n\t\tfunction currentDateGetter(){\r\n\t\t\treturn new Date(currentYear,currentMonth-1,1);\r\n\t\t}\r\n\t\tfunction currentDateSetter(x){\r\n\t\t\tx = new Date(x);\r\n\t\t\tcurrentMonth = x.getMonth() + 1;\r\n\t\t\tcurrentYear = x.getFullYear();\r\n\t\t\tsetDate();\r\n\t\t}\r\n\r\n\t\tObject.defineProperties(that,{\r\n\t\t\t\"selectedDates\": {\r\n\t\t\t\tget: function () {\r\n\t\t\t\t\treturn selectedDates.sort(function(a,b){return a.getTime() - b.getTime();});\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"range\": {\r\n\t\t\t\tget: function() {\r\n\t\t\t\t\treturn range;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x) {\r\n\t\t\t\t\tsetRange(x);\r\n\t\t\t\t\tif(x){maxSelections = 2;}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"button\": {\r\n\t\t\t\tget: function() {\r\n\t\t\t\t\treturn button;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(typeof x == 'string'){\r\n\t\t\t\t\t\tbutton = x;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tbutton = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthat.el.button.innerHTML = (button)?button:'';\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"title\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn title;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(typeof x == 'string'){\r\n\t\t\t\t\t\ttitle = x;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\ttitle = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthat.el.titleBox.innerText = (title)?title:'';\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"lang\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn lang;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x in languages){\r\n\t\t\t\t\t\tlang = x;\r\n\t\t\t\t\t\tgenerateDaynames();\r\n\t\t\t\t\t\tsetDate();\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tconsole.error('Language not found');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"months\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn months;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(typeof x == 'number' && x > 0){\r\n\t\t\t\t\t\tmonths = x;\r\n\t\t\t\t\t\tgenerateDaynames();\r\n\t\t\t\t\t\tgenerateInputs();\r\n\t\t\t\t\t\tsetDate();\r\n\r\n\t\t\t\t\t\tif(months == 1){\r\n\t\t\t\t\t\t\tthat.el.classList.remove('multi');\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tthat.el.classList.add('multi');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tconsole.error('months must be a number > 0');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"isOpen\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn opened;\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"closeOnSelect\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn closeOnSelect;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tcloseOnSelect = true;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tcloseOnSelect = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"disabledDays\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn disabledDays;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x instanceof Array){\r\n\t\t\t\t\t\tfor(var i = 0;i < x.length;i++){\r\n\t\t\t\t\t\t\tif(typeof x[i] == 'number'){\r\n\t\t\t\t\t\t\t\tdisabledDays.push(x[i]);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else if(typeof x == 'number'){\r\n\t\t\t\t\t\tdisabledDays = [x];\r\n\t\t\t\t\t}else if(!x){\r\n\t\t\t\t\t\tdisabledDays = [];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"disabledDates\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn disabledDates.map(function(x){return new Date(x);});\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x instanceof Array){\r\n\t\t\t\t\t\tx.forEach(function(date) {\r\n\t\t\t\t\t\t\tif(date instanceof Date){\r\n\t\t\t\t\t\t\t\tdisabledDates.push(new Date(date.getFullYear(),date.getMonth(),date.getDate()).getTime());\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}else if(x instanceof Date){\r\n\t\t\t\t\t\tdisabledDates = [new Date(x.getFullYear(),x.getMonth(),x.getDate()).getTime()];\r\n\t\t\t\t\t}else if(!x){\r\n\t\t\t\t\t\tdisabledDates = [];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"highlight\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn highlight;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x instanceof Array){\r\n\t\t\t\t\t\tx.forEach(function(hl) {\r\n\t\t\t\t\t\t\tif(hl instanceof Object){\r\n\t\t\t\t\t\t\t\tvar highlightObj = {};\r\n\t\t\t\t\t\t\t\t\thighlightObj.dates = [];\r\n\r\n\t\t\t\t\t\t\t\tif('start' in hl){\r\n\t\t\t\t\t\t\t\t\thighlightObj.dates.push({\r\n\t\t\t\t\t\t\t\t\t\tstart: new Date(hl.start.getFullYear(),hl.start.getMonth(),hl.start.getDate()),\r\n\t\t\t\t\t\t\t\t\t\tend: ('end' in hl)?new Date(hl.end.getFullYear(),hl.end.getMonth(),hl.end.getDate()):new Date(hl.start.getFullYear(),hl.start.getMonth(),hl.start.getDate())\r\n\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t}else if('dates' in hl && hl.dates instanceof Array){\r\n\t\t\t\t\t\t\t\t\thl.dates.forEach(function(hlDate) {\r\n\t\t\t\t\t\t\t\t\t\thighlightObj.dates.push({\r\n\t\t\t\t\t\t\t\t\t\t\tstart: new Date(hlDate.start.getFullYear(),hlDate.start.getMonth(),hlDate.start.getDate()),\r\n\t\t\t\t\t\t\t\t\t\t\tend: ('end' in hlDate)?new Date(hlDate.end.getFullYear(),hlDate.end.getMonth(),hlDate.end.getDate()):new Date(hlDate.start.getFullYear(),hlDate.start.getMonth(),hlDate.start.getDate())\r\n\t\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t\t})\r\n\t\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t\thighlightObj.color \t\t\t\t= hl.color;\r\n\t\t\t\t\t\t\t\thighlightObj.backgroundColor \t= hl.backgroundColor;\r\n\t\t\t\t\t\t\t\thighlightObj.legend\t\t\t\t= ('legend' in hl)?hl.legend:null;\r\n\r\n\t\t\t\t\t\t\t\thighlight.push(highlightObj);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}else if(x instanceof Object){\r\n\t\t\t\t\t\tvar highlightObj = {};\r\n\t\t\t\t\t\thighlightObj.dates = [];\r\n\r\n\t\t\t\t\t\tif('start' in x){\r\n\t\t\t\t\t\t\thighlightObj.dates.push({\r\n\t\t\t\t\t\t\t\tstart: new Date(x.start.getFullYear(),x.start.getMonth(),x.start.getDate()),\r\n\t\t\t\t\t\t\t\tend: ('end' in x)?new Date(x.end.getFullYear(),x.end.getMonth(),x.end.getDate()):new Date(x.start.getFullYear(),x.start.getMonth(),x.start.getDate())\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}else if('dates' in x && x.dates instanceof Array){\r\n\t\t\t\t\t\t\tx.dates.forEach(function(hlDate) {\r\n\t\t\t\t\t\t\t\thighlightObj.dates.push({\r\n\t\t\t\t\t\t\t\t\tstart: new Date(hlDate.start.getFullYear(),hlDate.start.getMonth(),hlDate.start.getDate()),\r\n\t\t\t\t\t\t\t\t\tend: ('end' in hlDate)?new Date(hlDate.end.getFullYear(),hlDate.end.getMonth(),hlDate.end.getDate()):new Date(hlDate.start.getFullYear(),hlDate.start.getMonth(),hlDate.start.getDate())\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\thighlightObj.color \t\t\t\t= x.color;\r\n\t\t\t\t\t\thighlightObj.backgroundColor \t= x.backgroundColor;\r\n\t\t\t\t\t\thighlightObj.legend\t\t\t\t= ('legend' in x)?x.legend:null;\r\n\r\n\t\t\t\t\t\thighlight.push(highlightObj);\r\n\t\t\t\t\t}else if(!x){\r\n\t\t\t\t\t\thighlight = [];\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"onClose\": {\r\n\t\t\t\tset: function(callback){\r\n\t\t\t\t\tonClose = callback;\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"onSelect\": {\r\n\t\t\t\tset: function(callback){\r\n\t\t\t\t\tonSelect = callback;\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"today\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn today;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\ttoday = true;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\ttoday = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"daynames\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn daynames;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tdaynames = true;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tdaynames = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tgenerateDaynames();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"fullscreen\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn that.el.classList.contains('fullscreen');\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tthat.el.classList.add('fullscreen');\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tthat.el.classList.remove('fullscreen');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"locked\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn locked;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tlocked = true;\r\n\t\t\t\t\t\tthat.el.tables.classList.add('locked');\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tlocked = false;\r\n\t\t\t\t\t\tthat.el.tables.classList.remove('locked');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"maxSelections\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn maxSelections;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(typeof x == 'number' && !range){\r\n\t\t\t\t\t\tmaxSelections = x;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tif(range){\r\n\t\t\t\t\t\t\tmaxSelections = 2;\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tmaxSelections = null;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"onConfirm\": {\r\n\t\t\t\tset: function(callback){\r\n\t\t\t\t\tif(typeof callback == 'function'){\r\n\t\t\t\t\t\tonConfirm = callback.bind(that);\r\n\t\t\t\t\t\tthat.el.button.addEventListener(eventName,onConfirm);\r\n\t\t\t\t\t}else if(!callback){\r\n\t\t\t\t\t\tthat.el.button.removeEventListener(eventName,onConfirm);\r\n\t\t\t\t\t\tonConfirm = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"onNavigation\": {\r\n\t\t\t\tset: function(callback){\r\n\t\t\t\t\tif(typeof callback == 'function'){\r\n\t\t\t\t\t\tonNavigation = callback.bind(that);\r\n\t\t\t\t\t}else if(!callback){\r\n\t\t\t\t\t\tonNavigation = null;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"closeOnClick\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn closeOnClick;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tcloseOnClick = true;\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tcloseOnClick = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"tooltips\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\tvar ret = [];\r\n\t\t\t\t\tfor(key in tooltips){\r\n\t\t\t\t\t\tret.push({\r\n\t\t\t\t\t\t\tdate: new Date(parseInt(key)),\r\n\t\t\t\t\t\t\ttext: tooltips[key]\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn ret;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x instanceof Array){\r\n\t\t\t\t\t\tx.forEach(function(item) {\r\n\t\t\t\t\t\t\tif(item.date && item.text && item.date instanceof Date){\r\n\t\t\t\t\t\t\t\ttooltips[new Date(item.date.getFullYear(),item.date.getMonth(),item.date.getDate()).getTime()] = item.text;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t}else if(x instanceof Object){\r\n\t\t\t\t\t\tif(x.date && x.text && x.date instanceof Date){\r\n\t\t\t\t\t\t\ttooltips[new Date(x.date.getFullYear(),x.date.getMonth(),x.date.getDate()).getTime()] = x.text;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else if(!x){\r\n\t\t\t\t\t\ttooltips = [];\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"currentDate\": {\r\n\t\t\t\tget: currentDateGetter,\r\n\t\t\t\tset: currentDateSetter\r\n\t\t\t},\r\n\t\t\t\"setDate\": {\r\n\t\t\t\tset: currentDateSetter\r\n\t\t\t},\r\n\t\t\t\"startDate\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn startDate;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tstartDate = new Date(x);\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tstartDate = null;\r\n\t\t\t\t\t\tcurrentYear = new Date().getFullYear();\r\n\t\t\t\t\t\tcurrentMonth = new Date().getMonth() + 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"minDate\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn minDate;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tminDate = new Date(x);\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"maxDate\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn maxDate;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tmaxDate = new Date(x);\r\n\t\t\t\t\tsetDate();\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"container\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn container;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x instanceof String){\r\n\t\t\t\t\t\tvar y = document.querySelector(x);\r\n\t\t\t\t\t\tif(y){\r\n\t\t\t\t\t\t\tcontainer = y;\r\n\t\t\t\t\t\t\tif(container != document.body){\r\n\t\t\t\t\t\t\t\tthat.el.classList.add('wrapped');\r\n\t\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\t\tthat.el.classList.remove('wrapped');\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tconsole.error(\"Container doesn't exist\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else if(x instanceof HTMLElement){\r\n\t\t\t\t\t\tcontainer = x;\r\n\t\t\t\t\t\tif(container != document.body){\r\n\t\t\t\t\t\t\tthat.el.classList.add('wrapped');\r\n\t\t\t\t\t\t}else{\r\n\t\t\t\t\t\t\tthat.el.classList.remove('wrapped');\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tconsole.error(\"Invalid type\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t\"inline\": {\r\n\t\t\t\tget: function(){\r\n\t\t\t\t\treturn inline;\r\n\t\t\t\t},\r\n\t\t\t\tset: function(x){\r\n\t\t\t\t\tif(x){\r\n\t\t\t\t\t\tinline = true;\r\n\t\t\t\t\t\tthat.el.classList.add('inline');\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\tinline = false;\r\n\t\t\t\t\t\tthat.el.classList.remove('inline');\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\r\n\t\t});\r\n\r\n\t\tinit();\r\n\t\tsetDate();\r\n\r\n\t\treturn Object.freeze(that);\r\n\t};\r\n\r\n\tfunction whichAnimationEvent(){\r\n\t var t;\r\n\t var el = document.createElement('fakeelement');\r\n\t var transitions = {\r\n\t 'animation':'animationend',\r\n\t 'OAnimation':'oanimationend',\r\n\t 'MozAnimation':'animationend',\r\n\t 'WebkitAnimation':'webkitAnimationEnd',\r\n\t '':'MSAnimationEnd'\r\n\t };\r\n\r\n\t for(t in transitions){\r\n\t if( el.style[t] !== undefined ){\r\n\t return transitions[t];\r\n\t }\r\n\t }\r\n\t}\r\n\r\n\tvar template = \t'
' +\r\n\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'' +\r\n\t\t\t\t\t\t\t'

' +\r\n\t\t\t\t\t\t\t'' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
1
' +\r\n\t\t\t\t\t\t\t'
2
' +\r\n\t\t\t\t\t\t\t'
3
' +\r\n\t\t\t\t\t\t\t'
4
' +\r\n\t\t\t\t\t\t\t'
5
' +\r\n\t\t\t\t\t\t\t'
6
' +\r\n\t\t\t\t\t\t\t'
7
' +\r\n\t\t\t\t\t\t\t'
8
' +\r\n\t\t\t\t\t\t\t'
9
' +\r\n\t\t\t\t\t\t\t'
10
' +\r\n\t\t\t\t\t\t\t'
11
' +\r\n\t\t\t\t\t\t\t'
12
' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t\t'
' +\r\n\t\t\t\t\t'
' +\r\n\t\t\t\t\t'
' +\r\n\t\t\t\t\t'' +\r\n\t\t\t\t\t'
';\r\n\r\n\tvar getBrowserVersion = function(){\r\n\t\tvar browser = {\r\n\t\t\ttype: null,\r\n\t\t\tversion: null\r\n\t\t}\r\n\r\n\t\tvar ua= navigator.userAgent, tem, ios,\r\n\t M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\\/))\\/?\\s*(\\d+)/i) || [];\r\n\t ios = ua.match(/(iphone|ipad)\\s+OS\\s+([\\d+_]+\\d+)/i) || [];\r\n\t if(/trident/i.test(M[1])){\r\n\t tem= /\\brv[ :]+(\\d+)/g.exec(ua) || [];\r\n\t browser.type = 'MSIE';\r\n\t browser.version = parseInt(tem[1]);\r\n\t return browser;\r\n\t }\r\n\t if(M[1]=== 'Chrome'){\r\n\t tem= ua.match(/\\bOPR\\/(\\d+)/)\r\n\t if(tem!= null) return 'Opera '+tem[1];\r\n\t }\r\n\t if(ios[1]){\r\n\t \treturn browser = {\r\n\t \t\ttype: 'iOS',\r\n\t \t\tversion: ios[2]\r\n\t \t};\r\n\t }\r\n\t M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];\r\n\t if((tem= ua.match(/version\\/(\\d+)/i))!= null) M.splice(1, 1, tem[1]);\r\n\t browser.type = M[0];\r\n\t browser.version = parseInt(M[1]);\r\n\r\n\t return browser;\r\n\t}\r\n\r\n\t/* Spread it to the world! */\r\n\tif ( typeof define === 'function' && define.amd ) define('Datepickk', Datepickk);\r\n\telse if ( typeof exports === 'object' ) module.exports = Datepickk;\r\n\telse window.Datepickk = Datepickk;\r\n})();\r\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/index.html b/index.html index 140f347..4dad969 100644 --- a/index.html +++ b/index.html @@ -154,14 +154,15 @@

Callbacks

  • onConfirm
  • onClose
  • onSelect
  • +
  • onNavigation
  • - +

    Take a tour

    - +

    startDate Setting Go up

    @@ -322,7 +323,7 @@ 

    months Setting Go up

    -

    Showing multiple months at once needs much space! Be careful, the pretty looking datepicker might get ulgy

    +

    Showing multiple months at once needs much space! Be careful, the pretty looking datepicker might get ulgy

    - +

    today Setting Go up

    Show little line on todays date

    @@ -1009,7 +1010,7 @@

    unselectDate( Date, ignoreOnSelectEvent ) Function

    unselectAll( ignoreOnSelectEvent ) Function Go up

    @@ -1107,10 +1108,35 @@ 

    onSelect Callback Go up

    +
    +

    onNavigation Callback Go up

    +
    +					
    +						//Type: Function
    + datepicker.onNavigation = function(){
    + alert('Navigation happened!')
    + }; +
    +
    + +

    The context(this) is the datepicker object.

    + +
    - \ No newline at end of file + diff --git a/src/js/datepickk.js b/src/js/datepickk.js index f71046d..789ba46 100644 --- a/src/js/datepickk.js +++ b/src/js/datepickk.js @@ -4,7 +4,7 @@ * (c) 2016 Carsten Jacobsen */ (function(){ - + function Datepickk(args){ Datepickk.numInstances = (Datepickk.numInstances || 0) + 1; var that = this; @@ -31,7 +31,7 @@ weekStart:1 } }; - + var range = false; var maxSelections = null; var container = document.body; @@ -40,6 +40,7 @@ var closeOnSelect = false; var button = null; var title = null; + var onNavigation = null; var onClose = null; var onConfirm = null; var closeOnClick = true; @@ -56,7 +57,7 @@ var minDate = null; var maxDate = null; var locked = false; - + function generateDaynames(){ that.el.days.innerHTML = ''; if(daynames){ @@ -79,7 +80,7 @@ function generateYears(){ [].slice.call(that.el.yearPicker.childNodes).forEach(function(node,index) { - node.innerHTML = "'" + (currentYear + parseInt(node.getAttribute('data-year'))).toString().substring(2,4); + node.innerHTML = "'" + (currentYear + parseInt(node.getAttribute('data-year'))).toString().substring(2,4); }) } @@ -110,7 +111,7 @@ input.addEventListener(eventName,function(){ if(locked){ event.preventDefault(); - } + } }); input.addEventListener('change',inputChange); } @@ -131,7 +132,7 @@ var element = that.el.legend.querySelector('[data-legend-id="' + legendId + '"]'); if(e.type == 'mouseover' && element){ var color = (element.getAttribute('data-color'))?hexToRgb(element.getAttribute('data-color')):null; - element.setAttribute('style','background-color:rgba(' + color.r + ',' + color.g + ',' + color.b + ',0.35);'); + element.setAttribute('style','background-color:rgba(' + color.r + ',' + color.g + ',' + color.b + ',0.35);'); }else if(element){ element.removeAttribute('style'); } @@ -183,7 +184,7 @@ } } } - + [].slice.call(that.el.legend.querySelectorAll('.d-legend-item')).forEach(function(item) { if(legends.indexOf(item) < 0){ item.removeEventListener('mouseover',hoverLegend); @@ -195,7 +196,7 @@ function hoverLegend(e){ [].slice.call(that.el.tables.querySelectorAll('[data-legend-id*="' + this.getAttribute('data-legend-id') + '"]')).forEach(function(element) { if(e.type == 'mouseover') element.classList.add('legend-hover'); - else element.classList.remove('legend-hover'); + else element.classList.remove('legend-hover'); }); } } @@ -262,7 +263,7 @@ if(date instanceof Date){ inputEl.setAttribute('data-date',date.toJSON()); - + if(disabledDates.indexOf(date.getTime()) != -1 || disabledDays.indexOf(date.getDay()) != -1){ inputEl.setAttribute('disabled',true); } @@ -270,7 +271,7 @@ if((minDate && date < minDate) || (maxDate && date > maxDate)){ inputEl.setAttribute('disabled',true); labelEl.className = 'd-hidden'; - + } if(today && date.getTime() == new Date().setHours(0,0,0,0)){ @@ -392,8 +393,9 @@ if(currentMonth-1+months-1>11){ that.el.yearPicker.querySelector('[data-year="1"]').classList.add('current'); } - + renderSelectedDates(); + if(onNavigation) onNavigation.call(that); }; function renderSelectedDates(){ @@ -443,7 +445,7 @@ date = new Date(date); date.setHours(0,0,0,0); var el = that.el.querySelector('[data-date="'+ date.toJSON() +'"]'); - + if(range && el && el.checked) { el.classList.add('single'); } @@ -478,7 +480,7 @@ function unselectAll(ignoreOnSelect){ selectedDates.forEach(function(date) { - unselectDate(date,ignoreOnSelect); + unselectDate(date,ignoreOnSelect); }); }; @@ -496,18 +498,18 @@ for(length; length > maxSelections-1; length --){ unselectDate(selectedDates[0]); } - + } - + if(range && selectedDates.length){ var first = that.el.querySelector('[data-date="'+ selectedDates[0].toJSON() +'"]'); if(!first && date > selectedDates[0]){ that.el.tables.classList.add('before'); } } - + selectedDates.push(date); - + if(closeOnSelect){ that.hide(); } @@ -601,7 +603,7 @@ currentMonth = parseInt(this.getAttribute('data-month')); setDate(); that.el.monthPicker.classList.remove('d-show'); - }); + }); }); [].slice.call(that.el.yearPicker.childNodes).forEach(function(yearPicker) { @@ -609,7 +611,7 @@ currentYear += parseInt(this.getAttribute('data-year')); setDate(); that.el.yearPicker.classList.remove('d-show'); - }); + }); }) var startX = 0; @@ -690,10 +692,10 @@ } Object.defineProperties(that,{ - "selectedDates": { - get: function () { - return selectedDates.sort(function(a,b){return a.getTime() - b.getTime();}); - } + "selectedDates": { + get: function () { + return selectedDates.sort(function(a,b){return a.getTime() - b.getTime();}); + } }, "range": { get: function() { @@ -776,7 +778,7 @@ }, set: function(x){ if(x){ - closeOnSelect = true; + closeOnSelect = true; }else{ closeOnSelect = false; } @@ -810,7 +812,7 @@ x.forEach(function(date) { if(date instanceof Date){ disabledDates.push(new Date(date.getFullYear(),date.getMonth(),date.getDate()).getTime()); - } + } }); }else if(x instanceof Date){ disabledDates = [new Date(x.getFullYear(),x.getMonth(),x.getDate()).getTime()]; @@ -866,7 +868,7 @@ highlightObj.dates.push({ start: new Date(hlDate.start.getFullYear(),hlDate.start.getMonth(),hlDate.start.getDate()), end: ('end' in hlDate)?new Date(hlDate.end.getFullYear(),hlDate.end.getMonth(),hlDate.end.getDate()):new Date(hlDate.start.getFullYear(),hlDate.start.getMonth(),hlDate.start.getDate()) - }); + }); }); } @@ -970,6 +972,15 @@ } } }, + "onNavigation": { + set: function(callback){ + if(typeof callback == 'function'){ + onNavigation = callback.bind(that); + }else if(!callback){ + onNavigation = null; + } + } + }, "closeOnClick": { get: function(){ return closeOnClick; @@ -1141,8 +1152,8 @@ '
    10
    ' + '
    11
    ' + '
    12
    ' + - '' + - '
    ' + + '
    ' + + '
    ' + '
    ' + '
    ' + '
    ' + @@ -1157,9 +1168,9 @@ '
    ' + '
    ' + '
    ' + - '' + + '' + '
    ' + - '' + + '' + '
    '; var getBrowserVersion = function(){ @@ -1199,4 +1210,4 @@ if ( typeof define === 'function' && define.amd ) define('Datepickk', Datepickk); else if ( typeof exports === 'object' ) module.exports = Datepickk; else window.Datepickk = Datepickk; -})(); \ No newline at end of file +})();