tail.datetime
Advanced tools
Comparing version 0.4.11 to 0.4.12
@@ -22,3 +22,3 @@ { | ||
"main": [ | ||
"js/tail.datetime.js", | ||
"js/tail.datetime-full.js", | ||
"css/tail.datetime-default.css" | ||
@@ -25,0 +25,0 @@ ], |
CHANGELOG | ||
========= | ||
Version 0.4.12 - Beta | ||
--------------------- | ||
- Bugfix: The new `classList` helper methods didn't worked as expected. | ||
- Bugfix: Add correct file to the `main` bower variable. | ||
- Bugfix: Add correct file to the `jsdelivr` package variable. | ||
Version 0.4.11 - Beta | ||
@@ -8,3 +14,3 @@ --------------------- | ||
- Add: The new Norwegian Translation. Many Thanks to [Lars Athle Larsen](https://github.com/larsathle) | ||
[#30](https://github.com/pytesNET/tail.DateTime/pull/30)! | ||
[#31](https://github.com/pytesNET/tail.DateTime/pull/31)! | ||
- Add: Support for MooTools. | ||
@@ -11,0 +17,0 @@ - Add: Global `window` implementation using `datetime`, next to the existing `DateTime`, variable. |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -44,9 +44,9 @@ | @website https://github.com/pytesNET/tail.DateTime | ||
function cHAS(el, name){ | ||
return (el.classList)? el.classList.contains(name): false; | ||
return (!el.classList)? false: el.classList.contains(name); | ||
} | ||
function cADD(el, name){ | ||
return (el.classList && el.classList.add(name))? el: false; | ||
return (!el.classList)? false: (el.classList.add(name))? el: el; | ||
} | ||
function cREM(el, name){ | ||
return (el.classList.remove && el.classList.remove(name))? el: false; | ||
return (!el.classList)? false: (el.classList.remove(name))? el: el; | ||
} | ||
@@ -111,3 +111,3 @@ function trigger(el, event, opt){ | ||
}; | ||
datetime.version = "0.4.11"; | ||
datetime.version = "0.4.12"; | ||
datetime.status = "beta"; | ||
@@ -114,0 +114,0 @@ datetime.count = 0; |
@@ -1,2 +0,2 @@ | ||
/* pytesNET/tail.DateTime v.0.4.11 | Full Version | @author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */ | ||
!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):"object"==typeof module&&module.exports?module.exports=e(t):(void 0===t.tail&&(t.tail={}),t.tail.DateTime=t.tail.datetime=e(t),"undefined"!=typeof jQuery&&(jQuery.fn.DateTime=jQuery.fn.datetime=function(t){var e,i=[];return this.each(function(){!1!==(e=tail.DateTime(this,t))&&i.push(e)}),1===i.length?i[0]:0!==i.length&&i}),"undefined"!=typeof MooTools&&(Element.implement({DateTime:function(t){return new tail.DateTime(this,t)}}),Element.implement({datetime:function(t){return new tail.DateTime(this,t)}})))}(this,function(t){"use strict";var o=t,c=t.document;function d(t,e){return!!t.classList&&t.classList.contains(e)}function a(t,e){return!(!t.classList||!t.classList.add(e))&&t}function n(t,e){return!(!t.classList.remove||!t.classList.remove(e))&&t}function s(t,e,i){if(CustomEvent&&CustomEvent.name)var a=new CustomEvent(e,i);else(a=c.createEvent("CustomEvent")).initCustomEvent(e,!!i.bubbles,!!i.cancelable,i.detail);return t.dispatchEvent(a)}function h(t,e){return Object.assign({},t,e||{})}function r(t){return t.charAt(0).toUpperCase()+t.slice(1)}function u(t,e,i){var a=t instanceof Date?t:!!t&&new Date(t);return a instanceof Date&&!isNaN(a.getDate())&&(i&&a.setHours(0,0,0,0),!0===e?a.getTime():a)}var p=function(t,e){if((t="string"==typeof t?c.querySelectorAll(t):t)instanceof NodeList||t instanceof HTMLCollection||t instanceof Array){for(var i=[],a=t.length,n=0;n<a;n++)i.push(new p(t[n],e));return 1===i.length?i[0]:0!==i.length&&i}if(!(t instanceof Element))return!1;if(!(this instanceof p))return new p(t,e);if(p.inst[t.getAttribute("data-tail-datetime")])return p.inst[t.getAttribute("data-tail-datetime")];if(t.getAttribute("data-datetime")){var s=JSON.parse(t.getAttribute("data-datetime").replace(/\'/g,'"'));s instanceof Object&&(e=h(e,s))}return this.e=t,this.id=++p.count,this.con=h(p.defaults,e),(p.inst["tail-"+this.id]=this).init()};return p.version="0.4.11",p.status="beta",p.count=0,p.inst={},p.defaults={animate:!0,classNames:!1,closeButton:!0,dateFormat:"YYYY-mm-dd",dateStart:!1,dateRanges:[],dateBlacklist:!0,dateEnd:!1,locale:"en",position:"bottom",rtl:"auto",startOpen:!1,stayOpen:!1,timeFormat:"HH:ii:ss",timeHours:null,timeMinutes:null,timeSeconds:0,timeIncrement:!0,timeStepHours:1,timeStepMinutes:5,timeStepSeconds:5,today:!0,tooltips:[],viewDefault:"days",viewDecades:!0,viewYears:!0,viewMonths:!0,viewDays:!0,weekStart:0},p.strings={ar:{months:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"],days:["الأحد","الإثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"],shorts:["أحد","إثن","ثلا","أرب","خمي","جمع","سبت"],time:["ساعة","دقيقة","ثانية"],header:["إختر الشهر","إخنر السنة","إختر العقد","إختر الوقت"]},de:{months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],days:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],shorts:["SO","MO","DI","MI","DO","FR","SA"],time:["Stunden","Minuten","Sekunden"],header:["Wähle einen Monat","Wähle ein Jahr","Wähle ein Jahrzehnt","Wähle eine Uhrzeit"]},de_AT:{months:["Jänner","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],days:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],shorts:["SO","MO","DI","MI","DO","FR","SA"],time:["Stunden","Minuten","Sekunden"],header:["Wähle einen Monat","Wähle ein Jahr","Wähle ein Jahrzehnt","Wähle eine Uhrzeit"]},en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shorts:["SUN","MON","TUE","WED","THU","FRI","SAT"],time:["Hours","Minutes","Seconds"],header:["Select a Month","Select a Year","Select a Decade","Select a Time"]},es:{months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],days:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],shorts:["DOM","LUN","MAR","MIÉ","JUE","VIE","SÁB"],time:["Horas","Minutos","Segundos"],header:["Selecciona un mes","Seleccione un año","Seleccione un década","Seleccione una hora"]},fi:{months:["Tammikuu","Helmikuu","Maaliskuu","Huhtikuu","Toukokuu","Kesäkuu","Heinäkuu","Elokuu","Syyskuu","Lokakuu","Marraskuu","Joulukuu"],days:["Sunnuntai","Maanantai","Tiistai","Keskiviikko","Torstai","Perjantai","Lauantai"],shorts:["Su","Ma","Ti","Ke","To","Pe","La"],time:["Tunnit","Minuutit","Sekuntit"],header:["Valitse kuukausi","Valitse vuosi","Valitse vuosikymmen","Valitse aika"]},fr:{months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],days:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],shorts:["DIM","LUN","MAR","MER","JEU","VEN","SAM"],time:["Heure","Minute","Seconde"],header:["Choisissez un mois","Choisissez une année","Choisissez une décénie","Kies een Tijdstip"]},it:{months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],days:["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"],shorts:["DOM","LUN","MAR","MER","GIO","VEN","SAB"],time:["Ore","Minuti","Secondi"],header:["Seleziona un mese","Seleziona un anno","Seleziona un decennio","Seleziona un orario"]},nl:{months:["Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"],days:["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"],shorts:["ZO","MA","DI","WO","DO","VR","ZA"],time:["Uur","Minuten","Seconden"],header:["Kies een Maand","Kies een Jaar","Kies een Decennium","Kies een Tijdstip"]},no:{months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],days:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"],shorts:["SØN","MAN","TIR","ONS","TOR","FRE","LØR"],time:["Timer","Minutter","Sekunder"],header:["Velg måned","Velg år","Velg tiår","Velg klokkeslett"]},pt_BR:{months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],days:["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"],shorts:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],time:["Horas","Minutos","Segundos"],header:["Escolha um mês","Escolha um ano","Escolha uma década","Escolha um horário"]},ru:{months:["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"],days:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],shorts:["вс","пн","вт","ср","чт","пт","сб"],time:["часов","минут","секунд"],header:["Выберите месяц","Выберите год","Выберите Десятилетие","Выберите время"]},tr:{months:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],days:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],shorts:["PA","PT","SA","ÇA","PE","CU","CT"],time:["Saat","Dakika","Saniye"],header:["Ay Seçin","Yıl Seçin","On Yıl Seçin","Zaman Seçin"]},modify:function(t,e,i){if(!(t in this))return!1;if(e instanceof Object)for(var a in e)this.modify(t,a,e[a]);else this[t][e]="string"==typeof i?i:this[t][e];return!0},register:function(t,e){return"string"==typeof t&&e instanceof Object&&(this[t]=e,!0)}},p.prototype={init:function(){var t,e=this;if(this.__=h(p.strings.en,p.strings[this.con.locale]||{}),this.con.dateStart=u(this.con.dateStart,!0,!0)||0,this.con.dateEnd=u(this.con.dateEnd,!0,!0)||9999999999999,this.con.viewDefault=this.con.dateFormat?this.con.viewDefault:"time","string"==typeof this.con.weekStart&&(this.con.weekStart=p.strings.en.shorts.indexOf(this.con.weekStart)),this.con.weekStart<0&&6<this.con.weekStart&&(this.con.weekStart=0),0<this.con.dateRanges.length){for(var i=[],a=(l=this.con.dateRanges).length,n=0;n<a;n++)l[n]instanceof Object&&(l[n].start||l[n].days)&&(!1===(l[n].start=u(l[n].start||!1,!0,!0))?l[n].start=l[n].end=1/0:(!1===(l[n].end=u(l[n].end||!1,!0,!0))&&(l[n].end=l[n].start),l[n].start=l[n].start>l[n].end?[l[n].end,l[n].end=l[n].start][0]:l[n].start),l[n].days=!("days"in l[n])||l[n].days,l[n].days="boolean"!=typeof l[n].days?function(t){for(var e=[],i=t.length,a=0;a<i;a++)"string"==typeof t[a]&&(t[a]=p.strings.en.shorts.indexOf(t[a])),0<=t[a]&&t[a]<=6&&e.push(t[a]);return e}(l[n].days instanceof Array?l[n].days:[l[n].days]):[0,1,2,3,4,5,6],i.push({start:l[n].start,end:l[n].end,days:l[n].days}));this.con.dateRanges=i}if(0<this.con.tooltips.length){i=[];var s,r=this.con.tooltips;for(a=r.length,n=0;n<a;n++)r[n]instanceof Object&&r[n].date&&(r[n].date instanceof Array?(s=u(r[n].date[0]||!1,!0,!0),l=u(r[n].date[1]||!1,!0,!0)||s):s=l=u(r[n].date||!1,!0,!0),s&&i.push({date:s!==l?[s,l]:s,text:r[n].text||"Tooltip",color:r[n].color||"inherit",element:r[n].element||(t=c.createElement("DIV"),t.className="calendar-tooltip",t.innerHTML='<div class="tooltip-inner">'+r[n].text||"Tooltip</div>",t)}));this.con.tooltips=i}var o=this.__.shorts.slice(this.con.weekStart).concat(this.__.shorts.slice(0,this.con.weekStart));this.weekdays="<thead>\n<tr>\n";for(n=0;n<7;n++)this.weekdays+='<th class="calendar-week">'+o[n]+"</th>";this.weekdays+="\n</tr>\n</thead>",this.select=u(this.e.getAttribute("data-value")||this.e.value),(!this.select||this.select<this.con.dateStart||this.select>this.con.dateEnd)&&(this.select=null),null==this.view&&(this.view={type:this.con.viewDefault,date:this.select||new Date});for(a=["Hours","Minutes","Seconds"],n=0;n<3;n++)"number"==typeof this.con["time"+a[n]]&&this.view.date["set"+a[n]](this.con["time"+a[n]]);if(this.events={},this.dt=this.renderCalendar(),null==this._bind){var l="addEventListener";this.e[l]("focusin",function(t){e.open.call(e)}),this.e[l]("keyup",function(t){e.bind.call(e,t)}),c[l]("keyup",function(t){e.dt.contains(t.target)&&e.bind.call(e,t)}),c[l]("click",function(t){e.dt.contains(t.target)?e.bind.call(e,t):!e.e.contains(t.target)&&d(e.dt,"calendar-open")&&(t.target==e.dt||t.target==e.e||e.con.stayOpen||e.close.call(e))}),c[l]("mouseover",function(t){e.dt.contains(t.target)&&e.bind.call(e,t)}),this._bind=!0}return this.e.setAttribute("data-tail-datetime","tail-"+this.id),this.con.startOpen&&this.open(),this.select&&this.selectDate(this.select),this},bind:function(t){var e,i=t.target,a="getAttribute",n="data-action",s=i[a](n)?i:i.parentElement[a](n)?i.parentElement:i,r="data-tooltip";if("mouseover"==t.type&&(!1!==(e=i[a](r)?i:!!s[a](r)&&s)?this.dt.querySelector("#tooltip-"+e[a](r)+"-"+e[a](r+"-time"))||this.showTooltip(e[a](r),e,e[a](r+"-time")):this.dt.querySelector(".calendar-tooltip:not(.remove)")&&this.hideTooltip(this.dt.querySelector(".calendar-tooltip").id.slice(8))),"click"==t.type){if(!s||1!=t.buttons&&1!=(t.which||t.button))return;if(s.hasAttribute("data-disabled"))return;switch(s[a](n)){case"prev":case"next":return this.browseView(s[a](n));case"cancel":this.con.stayOpen||this.close();break;case"submit":return this.con.stayOpen||this.close(),this.selectDate(this.fetchDate(parseInt(s[a]("data-date"))));case"view":return this.switchDate(s[a]("data-year")||null,s[a]("data-month")||null,s[a]("data-day")||null),this.switchView(s[a]("data-view"))}}if("keyup"==t.type){if("INPUT"!=t.target.tagName&&t.target!==this.e&&/calendar-(static|close)/i.test(this.dt.className))return!1;13==(t.keyCode||t.which)&&(this.selectDate(this.fetchDate(this.select)),t.stopPropagation(),this.con.stayOpen||this.close()),27==(t.keyCode||t.which)&&(this.con.stayOpen||this.close())}},trigger:function(t){var e={bubbles:!1,cancelable:!0,detail:{args:arguments,self:this}};"change"==t&&(s(this.e,"input",e),s(this.e,"change",e)),s(this.dt,"tail::"+t,e);for(var i=(this.events[t]||[]).length,a=0;a<i;a++)this.events[t][a].cb.apply(this,function(t,e,i){for(var a=e.length,n=0;n<a;++n)t[n-1]=e[n];return t[n]=i,t}(new Array(arguments.length),arguments,this.events[t][a].args));return!0},calcPosition:function(){var t=this.dt.style,e=o.getComputedStyle(this.dt),i=parseInt(e.marginLeft)+parseInt(e.marginRight),a=parseInt(e.marginTop)+parseInt(e.marginBottom),n=function(t,e){for(e={top:t.offsetTop||0,left:t.offsetLeft||0,width:t.offsetWidth||0,height:t.offsetHeight||0};t=t.offsetParent;)e.top+=t.offsetTop,e.left+=t.offsetLeft;return e}(this.e,{});switch(t.visibility="hidden",this.con.position){case"top":var s=n.top-(this.dt.offsetHeight+a),r=n.left+n.width/2-(this.dt.offsetWidth/2+i/2);break;case"left":s=n.top+n.height/2-(this.dt.offsetHeight/2+a),r=n.left-(this.dt.offsetWidth+i);break;case"right":s=n.top+n.height/2-(this.dt.offsetHeight/2+a),r=n.left+n.width;break;default:s=n.top+n.height,r=n.left+n.width/2-(this.dt.offsetWidth/2+i/2)}return t.top=(0<=s?s:this.e.offsetTop)+"px",t.left=(0<=r?r:0)+"px",t.visibility="visible",this},convertDate:function(t,e){var i,a={H:String("00"+t.getHours()).toString().slice(-2),G:(i=t.getHours(),i%12?i%12:12),A:12<=t.getHours()?"PM":"AM",a:12<=t.getHours()?"pm":"am",i:String("00"+t.getMinutes()).toString().slice(-2),s:String("00"+t.getSeconds()).toString().slice(-2),Y:t.getFullYear(),y:parseInt(t.getFullYear().toString().slice(2)),m:String("00"+(t.getMonth()+1)).toString().slice(-2),M:this.__.months[t.getMonth()].slice(0,3),F:this.__.months[t.getMonth()],d:String("00"+t.getDate()).toString().slice(-2),D:this.__.days[t.getDay()],l:this.__.shorts[t.getDay()].toLowerCase()};return e.replace(/([HGismd]{1,2}|[Y]{2,4}|y{2})/g,function(t){return 4==t.length||2==t.length?a[t.slice(-1)].toString().slice(-Math.abs(t.length)):1==t.length&&"0"==t[0]?a[t.slice(-1)].toString().slice(-1):a[t.slice(-1)].toString()}).replace(/(A|a|M|F|D|l)/g,function(t){return a[t]})},renderCalendar:function(){var t,e=["tail-datetime-calendar","calendar-close"],i=c.createElement("DIV"),a=!0===this.con.classNames?this.e.className:this.con.classNames;["top","left","right","bottom"].indexOf(this.con.position)<0&&(t=c.querySelector(this.con.position),e.push("calendar-static")),("string"==typeof a||a instanceof Array)&&(e=e.concat("string"==typeof a?a.split(" "):a));var n=this.con.rtl;if((!0===n||"auto"===n&&0<=["ar","he","mdr","sam","syr"].indexOf(this.con.locale))&&e.push("rtl"),this.con.stayOpen&&e.push("calendar-stay"),i.id="tail-datetime-"+this.id,i.className=e.join(" "),i.style.cssText=this.con.rtl?"direction:rtl;":"direction:ltr;",this.con.dateFormat)var s='<span class="action action-prev" data-action="prev"></span><span class="label" data-action="view" data-view="up"></span><span class="action action-next" data-action="next"></span>';else if(this.con.timeFormat)s='<span class="action action-submit" data-action="submit"></span><span class="label"></span><span class="action action-cancel" data-action="cancel"></span>';if(void 0!==s&&(i.innerHTML='<div class="calendar-actions">'+s+"</div>"),this.con.dateFormat&&this.renderDatePicker(i,this.con.viewDefault),this.con.timeFormat&&this.renderTimePicker(i),this.con.closeButton&&!t){var r=c.createElement("BUTTON"),o=this;r.className="calendar-close",r.addEventListener("click",function(t){t.preventDefault(),o.close()}),i.appendChild(r)}return i.style.cssText=t?"position:static;visibility:visible;":"top:0;left:0;z-index:999;position:absolute;visibility:hidden;",(t||document.body).appendChild(i),i},renderDatePicker:function(t,e){if((!e||["decades","years","months","days"].indexOf(e)<0)&&(e=this.con.viewDays?"days":this.con.viewMonths?"months":this.con.viewYears?"years":!!this.con.viewDecades&&"decades"),!e||!this.con["view"+r(e)]||!this.con.dateFormat)return!1;var i=c.createElement("DIV");return i.className="calendar-datepicker calendar-view-"+e,i.innerHTML=this["view"+r(e)](),t.querySelector(".calendar-datepicker")?t.replaceChild(i,t.querySelector(".calendar-datepicker")):t.appendChild(i),this.view.type=e,this.handleLabel(t)},renderTimePicker:function(t){if(!this.con.timeFormat)return!1;var e=this.con.timeStepHours,i=this.con.timeStepMinutes,a=this.con.timeStepSeconds;e='<div class="timepicker-field timepicker-hours"><input type="number" name="dt[h]" value="" min="00" max="23" step="'+e+'" /><label>'+this.__.time[0]+"</label></div>",i='<div class="timepicker-field timepicker-minutes"><input type="number" name="dt[m]" value="" min="00" max="59" step="'+i+'" /><label>'+this.__.time[1]+"</label></div>",a='<div class="timepicker-field timepicker-seconds"><input type="number" name="dt[s]" value="" min="00" max="59" step="'+a+'" /><label>'+this.__.time[2]+"</label></div>";var n=c.createElement("DIV");n.className="calendar-timepicker",n.innerHTML=e+i+a;for(var s=this,r=n.querySelectorAll("input"),o=["Hours","Minutes","Seconds"],l=0;l<3;l++)r[l].value=this.view.date["get"+o[l]](),r[l].disabled=!1===this.con["time"+o[l]],r[l].addEventListener("input",function(t){s.handleTime.call(s,t,this)}),r[l].addEventListener("keydown",function(t){s.handleTime.call(s,t,this)});return t.querySelector(".calendar-timepicker")?t.replaceChild(n,t.querySelector(".calendar-timepicker")):t.appendChild(n),this.handleLabel(t)},handleTime:function(t,e){var i=parseInt(e.getAttribute("min")),a=parseInt(e.getAttribute("max")),n=parseInt(e.getAttribute("step")),s=parseInt(e.value),r="none";if(38==(t.keyCode||t.which)||a<s)r="up";if(40==(t.keyCode||t.which)||s<i)r="down";if("up"==r&&a<s+n){var o=1;e.value=s-(a+1)}else if("down"==r&&s-n<0){o=-1;e.value=a+1+s}if(o&&this.con.timeIncrement&&e.parentElement.previousElementSibling){var l=e.parentElement.previousElementSibling.querySelector("input");if(!1===l.disabled)return l.value=parseInt(l.value)+o,this.handleTime({},l)}var c=e.parentElement.parentElement.querySelectorAll("input");this.selectTime(c[0].value,c[1].value,c[2].value)},handleLabel:function(t){var e,i,a=t.querySelector(".label");switch(this.view.type){case"days":e=this.__.months[this.view.date.getMonth()]+", "+this.view.date.getFullYear();break;case"months":e=this.view.date.getFullYear();break;case"years":e=(i=parseInt(this.view.date.getFullYear().toString().slice(0,3)+"0"))+" - "+(i+10);break;case"decades":e=(i=parseInt(this.view.date.getFullYear().toString().slice(0,2)+"00"))+" - "+(i+100);break;case"time":e=this.__.header[3]}return a.innerText=e,t},viewDecades:function(){var t=this.view.date.getFullYear(),e=new Date(this.view.date.getTime()),i=this.con.today?(new Date).getYear():0;e.setFullYear(t-parseInt(t.toString()[3])-30);for(var a,n,s=[],r=[],o=1;o<=16;o++)a="calendar-decade"+(i>=e.getYear()&&i<=e.getYear()+10?" date-today":""),n='data-action="view" data-view="down" data-year="'+e.getFullYear()+'"',s.push('<td class="'+a+'" '+n+'><span class="inner">'+e.getFullYear()+" - "+(e.getFullYear()+10)+"</span></td>"),4<=o&&o%4==0&&(r.push("<tr>\n"+s.join("\n")+"\n</tr>"),s=[]),e.setFullYear(e.getFullYear()+10);return'<table class="calendar-decades"><thead><tr><th colspan="4">'+this.__.header[2]+"</th></tr></thead><tbody>"+r.join("\n")+"</tbody></table>"},viewYears:function(){var t=this.view.date.getFullYear(),e=new Date(this.view.date.getTime()),i=this.con.today?(new Date).getYear():0;e.setFullYear(t-parseInt(t.toString()[3])-2);for(var a,n,s=[],r=[],o=1;o<=16;o++)a="calendar-year"+(e.getYear()==i?" date-today":""),n='data-action="view" data-view="down" data-year="'+e.getFullYear()+'"',s.push('<td class="'+a+'" '+n+'><span class="inner">'+e.getFullYear()+"</span></td>"),4<=o&&o%4==0&&(r.push("<tr>\n"+s.join("\n")+"\n</tr>"),s=[]),e.setFullYear(e.getFullYear()+1);return'<table class="calendar-years"><thead><tr><th colspan="4">'+this.__.header[1]+"</th></tr></thead><tbody>"+r.join("\n")+"</tbody></table>"},viewMonths:function(){var t=this.__.months,e=this.con.today?(new Date).getMonth():-1;e=this.view.date.getYear()==(new Date).getYear()?e:-1;for(var i,a,n=[],s=[],r=0;r<12;r++)i="calendar-month"+(e==r?" date-today":""),a='data-action="view" data-view="down" data-month="'+r+'"',n.push('<td class="'+i+'" '+a+'><span class="inner">'+t[r]+"</span></td>"),3==n.length&&(s.push("<tr>\n"+n.join("\n")+"\n</tr>"),n=[]);return'<table class="calendar-months"><thead><tr><th colspan="3">'+this.__.header[0]+"</th></tr></thead><tbody>"+s.join("\n")+"</tbody></table>"},viewDays:function(){var i,t,e,a,n,s=new Date(this.view.date.getTime()),r=(new Date).toDateString(),o=s.getMonth(),l=[],c=[],d=[0,[]],h=[].concat(this.con.dateRanges),u=([].concat(this.con.tooltips),[0,0]);for(s.setHours(0,0,0,0),s.setDate(1),s.setDate(1-(s.getDay()-this.con.weekStart));c.length<6;)i=s.getTime(),e='data-action="submit" data-date="'+s.getTime()+'"',t="calendar-day date-"+(s.getMonth()>o?"next":s.getMonth()<o?"previous":"current"),this.con.today&&r==s.toDateString()&&(t+=" date-today"),this.con.dateBlacklist&&(i<this.con.dateStart||i>this.con.dateEnd)?d=[i<this.con.dateStart?this.con.dateStart:1/0,[0,1,2,3,4,5,6],!0]:0==d[0]?h=h.filter(function(t){return t.start==1/0||i>=t.start&&i<=t.end?!(d=[t.end,t.days]):t.start>i},this):3==d.length&&(d=[0,[0,1,2,3,4,5,6]]),0<this.con.tooltips.length&&this.con.tooltips.filter(function(t,e){t.date instanceof Array?t.date[0]<=i&&t.date[1]>=i&&(u=[t.date[1],e,t.color]):t.date==i&&(u=[t.date,e,t.color])},this),u[0]<i&&(u=[0,0]),(n=d[0]>=i&&0<=d[1].indexOf(s.getDay()))&&this.con.dateBlacklist||!n&&!this.con.dateBlacklist?(t+=" date-disabled",e+=' data-disabled="true"'):0!==d[0]&&d[0]<=i&&(d=[0,[]]),this.select&&this.select.toDateString()==s.toDateString()&&(t+=" date-select"),a='<span class="inner">'+s.getDate()+"</span>",0<u[0]&&(t+=" date-tooltip",e+=' data-tooltip="'+u[1]+'" data-tooltip-time="'+i+'"',"inherit"!==u[2]?a+='<span class="tooltip-tick" style="background:'+u[2]+';"></span>':a+='<span class="tooltip-tick"></span>'),l.push('<td class="'+t+'" '+e+">"+a+"</td>"),7==l.length&&(c.push("<tr>\n"+l.join("\n")+"\n</tr>"),l=[]),s.setDate(s.getDate()+1);return c="<tbody>"+c.join("\n")+"</tbody>",'<table class="calendar-days">'+this.weekdays+c+"</table>"},showTooltip:function(t,e,i){var a,n=this.con.tooltips[t].element,s=n.style,r=this.dt.querySelector(".calendar-datepicker");s.cssText="opacity:0;visibility:hidden;",n.id="tooltip-"+t+"-"+i,r.appendChild(n),a=n.offsetWidth,n.offsetHeight,s.top=e.offsetTop+e.offsetHeight+"px",s.left=e.offsetLeft+e.offsetWidth/2-a/2+"px",s.visibility="visible",this.con.animate?(n.setAttribute("data-top",parseInt(s.top)),s.top=parseInt(s.top)+5+"px",function t(){parseFloat(s.top)>n.getAttribute("data-top")&&(s.top=parseFloat(s.top)-.5+"px"),(s.opacity=parseFloat(s.opacity)+.125)<1&&setTimeout(t,20)}()):s.opacity=1},hideTooltip:function(t){var e=this.dt.querySelector("#tooltip-"+t),i=e.style;this.con.animate?(e.className+=" remove",function t(){if(parseFloat(i.top)<parseInt(e.getAttribute("data-top"))+5&&(i.top=parseFloat(i.top)+.5+"px"),(i.opacity-=.125)<0)return(e.className="calendar-tooltip")?e.parentElement.removeChild(e):"";setTimeout(t,20)}()):e.parentElement.removeChild(e)},switchView:function(t){var e=[null,"days","months","years","decades",null];return-1==e.indexOf(t)&&("up"==t?t=e[(e.indexOf(this.view.type)||5)+1]||null:"down"==t&&(t=e[(e.indexOf(this.view.type)||1)-1]||null),t&&this.con["view"+r(t)]||(t=!1)),!!t&&(this.renderDatePicker(this.dt,t),this.trigger("view",t))},switchDate:function(t,e,i,a){if(this.view.date.setFullYear(null==t?this.view.date.getFullYear():t),this.view.date.setMonth(null==e?this.view.date.getMonth():e),"auto"==i){var n=this.view.date,s=new Date;i=n.getMonth()==s.getMonth()&&n.getYear()==s.getYear()?s.getDate():1}return this.view.date.setDate(i||this.view.date.getDate()),!0===a||this.switchView(this.view.type)},switchMonth:function(t,e){return"string"==typeof t&&(t=0<=["previous","prev"].indexOf(t)?-1:1,t=this.view.date.getMonth()+type),this.switchDate(e||this.getFullYear(),t)},switchYear:function(t){return"string"==typeof t&&(t=0<=["previous","prev"].indexOf(t)?-1:1,t=this.view.date.getFullYear()+type),this.switchDate(t)},browseView:function(t){switch(t=0<=["previous","prev"].indexOf(t)?-1:1,this.view.type){case"days":return this.switchDate(null,this.view.date.getMonth()+t,"auto");case"months":return this.switchDate(this.view.date.getFullYear()+t,null,"auto");case"years":return this.switchDate(this.view.date.getFullYear()+10*t,null,"auto");case"decades":return this.switchDate(this.view.date.getFullYear()+100*t,null,"auto")}return!1},fetchDate:function(t){t=u(t||!1)||this.view.date;var e=this.dt.querySelectorAll("input[type=number]");return e&&3==e.length&&t.setHours(e[0].value||0,e[1].value||0,e[2].value||0,0),t},selectDate:function(t,e,i,a,n,s){var r=new Date,o=[];return this.con.dateFormat&&o.push(this.con.dateFormat),this.con.timeFormat&&o.push(this.con.timeFormat),this.select=t instanceof Date?t:new Date(t||(null==t?this.view.date.getFullYear():r.getFullYear()),e||(null==e?this.view.date.getMonth():r.getMonth()),i||(null==i?this.view.date.getDate():r.getDate()),a||(null==a?this.view.date.getHours():0),n||(null==n?this.view.date.getMinutes():0),s||(null==s?this.view.date.getSeconds():0)),this.view.date=new Date(this.select.getTime()),this.e.value=this.convertDate(this.select,o.join(" ")),this.e.setAttribute("data-value",this.select.getTime()),this.switchView("days"),this.trigger("change")},selectTime:function(t,e,i){return this.selectDate(void 0,void 0,void 0,t,e,i)},open:function(){if(!d(this.dt,"calendar-close"))return this;var e=this,i=this.dt.style;return i.opacity=this.con.animate?0:1,i.display="block",a(n(this.dt,"calendar-close"),"calender-idle"),!d(this.dt,"calendar-static")&&this.calcPosition(),function t(){if(1<=(i.opacity=parseFloat(i.opacity)+.125))return a(n(e.dt,"calendar-idle"),"calendar-open"),e.trigger("open");setTimeout(t,20)}(),this},close:function(){if(!d(this.dt,"calendar-open"))return this;var e=this,i=this.dt.style;return a(n(this.dt,"calendar-open"),"calender-idle"),i.opacity=this.con.animate?1:0,i.display="block",function t(){if((i.opacity-=.125)<=0)return a(n(e.dt,"calendar-idle"),"calendar-close"),i.display="none",e.trigger("close");setTimeout(t,20)}(),this},toggle:function(){return d(this.dt,"calendar-open")?this.close():d(this.dt,"calendar-close")?this.open():this},on:function(t,e,i){return!(["open","close","change","view"].indexOf(t)<0||"function"!=typeof e)&&(t in this.events||(this.events[t]=[]),this.events[t].push({cb:e,args:i instanceof Array?i:[]}),this)},remove:function(){return this.e.removeAttribute("data-tail-datetime"),this.e.removeAttribute("data-value"),this.dt.parentElement.removeChild(this.dt),this},reload:function(){return this.remove(),this.init()},config:function(t,e,i){if(t instanceof Object){for(var a in t)this.config(a,t[a],!1);return this.reload(),this.con}return void 0===t?this.con:t in this.con&&(void 0===e?this.con[t]:(this.con[t]=e,!1!==this.rebuild&&this.reload(),this))}},p}); | ||
/* pytesNET/tail.DateTime v.0.4.12 | Full Version | @author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */ | ||
!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):"object"==typeof module&&module.exports?module.exports=e(t):(void 0===t.tail&&(t.tail={}),t.tail.DateTime=t.tail.datetime=e(t),"undefined"!=typeof jQuery&&(jQuery.fn.DateTime=jQuery.fn.datetime=function(t){var e,i=[];return this.each(function(){!1!==(e=tail.DateTime(this,t))&&i.push(e)}),1===i.length?i[0]:0!==i.length&&i}),"undefined"!=typeof MooTools&&(Element.implement({DateTime:function(t){return new tail.DateTime(this,t)}}),Element.implement({datetime:function(t){return new tail.DateTime(this,t)}})))}(this,function(t){"use strict";var o=t,c=t.document;function d(t,e){return!!t.classList&&t.classList.contains(e)}function a(t,e){return!!t.classList&&(t.classList.add(e),t)}function n(t,e){return!!t.classList&&(t.classList.remove(e),t)}function s(t,e,i){if(CustomEvent&&CustomEvent.name)var a=new CustomEvent(e,i);else(a=c.createEvent("CustomEvent")).initCustomEvent(e,!!i.bubbles,!!i.cancelable,i.detail);return t.dispatchEvent(a)}function h(t,e){return Object.assign({},t,e||{})}function r(t){return t.charAt(0).toUpperCase()+t.slice(1)}function u(t,e,i){var a=t instanceof Date?t:!!t&&new Date(t);return a instanceof Date&&!isNaN(a.getDate())&&(i&&a.setHours(0,0,0,0),!0===e?a.getTime():a)}var p=function(t,e){if((t="string"==typeof t?c.querySelectorAll(t):t)instanceof NodeList||t instanceof HTMLCollection||t instanceof Array){for(var i=[],a=t.length,n=0;n<a;n++)i.push(new p(t[n],e));return 1===i.length?i[0]:0!==i.length&&i}if(!(t instanceof Element))return!1;if(!(this instanceof p))return new p(t,e);if(p.inst[t.getAttribute("data-tail-datetime")])return p.inst[t.getAttribute("data-tail-datetime")];if(t.getAttribute("data-datetime")){var s=JSON.parse(t.getAttribute("data-datetime").replace(/\'/g,'"'));s instanceof Object&&(e=h(e,s))}return this.e=t,this.id=++p.count,this.con=h(p.defaults,e),(p.inst["tail-"+this.id]=this).init()};return p.version="0.4.12",p.status="beta",p.count=0,p.inst={},p.defaults={animate:!0,classNames:!1,closeButton:!0,dateFormat:"YYYY-mm-dd",dateStart:!1,dateRanges:[],dateBlacklist:!0,dateEnd:!1,locale:"en",position:"bottom",rtl:"auto",startOpen:!1,stayOpen:!1,timeFormat:"HH:ii:ss",timeHours:null,timeMinutes:null,timeSeconds:0,timeIncrement:!0,timeStepHours:1,timeStepMinutes:5,timeStepSeconds:5,today:!0,tooltips:[],viewDefault:"days",viewDecades:!0,viewYears:!0,viewMonths:!0,viewDays:!0,weekStart:0},p.strings={ar:{months:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"],days:["الأحد","الإثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"],shorts:["أحد","إثن","ثلا","أرب","خمي","جمع","سبت"],time:["ساعة","دقيقة","ثانية"],header:["إختر الشهر","إخنر السنة","إختر العقد","إختر الوقت"]},de:{months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],days:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],shorts:["SO","MO","DI","MI","DO","FR","SA"],time:["Stunden","Minuten","Sekunden"],header:["Wähle einen Monat","Wähle ein Jahr","Wähle ein Jahrzehnt","Wähle eine Uhrzeit"]},de_AT:{months:["Jänner","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],days:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],shorts:["SO","MO","DI","MI","DO","FR","SA"],time:["Stunden","Minuten","Sekunden"],header:["Wähle einen Monat","Wähle ein Jahr","Wähle ein Jahrzehnt","Wähle eine Uhrzeit"]},en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shorts:["SUN","MON","TUE","WED","THU","FRI","SAT"],time:["Hours","Minutes","Seconds"],header:["Select a Month","Select a Year","Select a Decade","Select a Time"]},es:{months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],days:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],shorts:["DOM","LUN","MAR","MIÉ","JUE","VIE","SÁB"],time:["Horas","Minutos","Segundos"],header:["Selecciona un mes","Seleccione un año","Seleccione un década","Seleccione una hora"]},fi:{months:["Tammikuu","Helmikuu","Maaliskuu","Huhtikuu","Toukokuu","Kesäkuu","Heinäkuu","Elokuu","Syyskuu","Lokakuu","Marraskuu","Joulukuu"],days:["Sunnuntai","Maanantai","Tiistai","Keskiviikko","Torstai","Perjantai","Lauantai"],shorts:["Su","Ma","Ti","Ke","To","Pe","La"],time:["Tunnit","Minuutit","Sekuntit"],header:["Valitse kuukausi","Valitse vuosi","Valitse vuosikymmen","Valitse aika"]},fr:{months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],days:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],shorts:["DIM","LUN","MAR","MER","JEU","VEN","SAM"],time:["Heure","Minute","Seconde"],header:["Choisissez un mois","Choisissez une année","Choisissez une décénie","Kies een Tijdstip"]},it:{months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],days:["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"],shorts:["DOM","LUN","MAR","MER","GIO","VEN","SAB"],time:["Ore","Minuti","Secondi"],header:["Seleziona un mese","Seleziona un anno","Seleziona un decennio","Seleziona un orario"]},nl:{months:["Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"],days:["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"],shorts:["ZO","MA","DI","WO","DO","VR","ZA"],time:["Uur","Minuten","Seconden"],header:["Kies een Maand","Kies een Jaar","Kies een Decennium","Kies een Tijdstip"]},no:{months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],days:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"],shorts:["SØN","MAN","TIR","ONS","TOR","FRE","LØR"],time:["Timer","Minutter","Sekunder"],header:["Velg måned","Velg år","Velg tiår","Velg klokkeslett"]},pt_BR:{months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],days:["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"],shorts:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],time:["Horas","Minutos","Segundos"],header:["Escolha um mês","Escolha um ano","Escolha uma década","Escolha um horário"]},ru:{months:["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"],days:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],shorts:["вс","пн","вт","ср","чт","пт","сб"],time:["часов","минут","секунд"],header:["Выберите месяц","Выберите год","Выберите Десятилетие","Выберите время"]},tr:{months:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],days:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],shorts:["PA","PT","SA","ÇA","PE","CU","CT"],time:["Saat","Dakika","Saniye"],header:["Ay Seçin","Yıl Seçin","On Yıl Seçin","Zaman Seçin"]},modify:function(t,e,i){if(!(t in this))return!1;if(e instanceof Object)for(var a in e)this.modify(t,a,e[a]);else this[t][e]="string"==typeof i?i:this[t][e];return!0},register:function(t,e){return"string"==typeof t&&e instanceof Object&&(this[t]=e,!0)}},p.prototype={init:function(){var t,e=this;if(this.__=h(p.strings.en,p.strings[this.con.locale]||{}),this.con.dateStart=u(this.con.dateStart,!0,!0)||0,this.con.dateEnd=u(this.con.dateEnd,!0,!0)||9999999999999,this.con.viewDefault=this.con.dateFormat?this.con.viewDefault:"time","string"==typeof this.con.weekStart&&(this.con.weekStart=p.strings.en.shorts.indexOf(this.con.weekStart)),this.con.weekStart<0&&6<this.con.weekStart&&(this.con.weekStart=0),0<this.con.dateRanges.length){for(var i=[],a=(l=this.con.dateRanges).length,n=0;n<a;n++)l[n]instanceof Object&&(l[n].start||l[n].days)&&(!1===(l[n].start=u(l[n].start||!1,!0,!0))?l[n].start=l[n].end=1/0:(!1===(l[n].end=u(l[n].end||!1,!0,!0))&&(l[n].end=l[n].start),l[n].start=l[n].start>l[n].end?[l[n].end,l[n].end=l[n].start][0]:l[n].start),l[n].days=!("days"in l[n])||l[n].days,l[n].days="boolean"!=typeof l[n].days?function(t){for(var e=[],i=t.length,a=0;a<i;a++)"string"==typeof t[a]&&(t[a]=p.strings.en.shorts.indexOf(t[a])),0<=t[a]&&t[a]<=6&&e.push(t[a]);return e}(l[n].days instanceof Array?l[n].days:[l[n].days]):[0,1,2,3,4,5,6],i.push({start:l[n].start,end:l[n].end,days:l[n].days}));this.con.dateRanges=i}if(0<this.con.tooltips.length){i=[];var s,r=this.con.tooltips;for(a=r.length,n=0;n<a;n++)r[n]instanceof Object&&r[n].date&&(r[n].date instanceof Array?(s=u(r[n].date[0]||!1,!0,!0),l=u(r[n].date[1]||!1,!0,!0)||s):s=l=u(r[n].date||!1,!0,!0),s&&i.push({date:s!==l?[s,l]:s,text:r[n].text||"Tooltip",color:r[n].color||"inherit",element:r[n].element||(t=c.createElement("DIV"),t.className="calendar-tooltip",t.innerHTML='<div class="tooltip-inner">'+r[n].text||"Tooltip</div>",t)}));this.con.tooltips=i}var o=this.__.shorts.slice(this.con.weekStart).concat(this.__.shorts.slice(0,this.con.weekStart));this.weekdays="<thead>\n<tr>\n";for(n=0;n<7;n++)this.weekdays+='<th class="calendar-week">'+o[n]+"</th>";this.weekdays+="\n</tr>\n</thead>",this.select=u(this.e.getAttribute("data-value")||this.e.value),(!this.select||this.select<this.con.dateStart||this.select>this.con.dateEnd)&&(this.select=null),null==this.view&&(this.view={type:this.con.viewDefault,date:this.select||new Date});for(a=["Hours","Minutes","Seconds"],n=0;n<3;n++)"number"==typeof this.con["time"+a[n]]&&this.view.date["set"+a[n]](this.con["time"+a[n]]);if(this.events={},this.dt=this.renderCalendar(),null==this._bind){var l="addEventListener";this.e[l]("focusin",function(t){e.open.call(e)}),this.e[l]("keyup",function(t){e.bind.call(e,t)}),c[l]("keyup",function(t){e.dt.contains(t.target)&&e.bind.call(e,t)}),c[l]("click",function(t){e.dt.contains(t.target)?e.bind.call(e,t):!e.e.contains(t.target)&&d(e.dt,"calendar-open")&&(t.target==e.dt||t.target==e.e||e.con.stayOpen||e.close.call(e))}),c[l]("mouseover",function(t){e.dt.contains(t.target)&&e.bind.call(e,t)}),this._bind=!0}return this.e.setAttribute("data-tail-datetime","tail-"+this.id),this.con.startOpen&&this.open(),this.select&&this.selectDate(this.select),this},bind:function(t){var e,i=t.target,a="getAttribute",n="data-action",s=i[a](n)?i:i.parentElement[a](n)?i.parentElement:i,r="data-tooltip";if("mouseover"==t.type&&(!1!==(e=i[a](r)?i:!!s[a](r)&&s)?this.dt.querySelector("#tooltip-"+e[a](r)+"-"+e[a](r+"-time"))||this.showTooltip(e[a](r),e,e[a](r+"-time")):this.dt.querySelector(".calendar-tooltip:not(.remove)")&&this.hideTooltip(this.dt.querySelector(".calendar-tooltip").id.slice(8))),"click"==t.type){if(!s||1!=t.buttons&&1!=(t.which||t.button))return;if(s.hasAttribute("data-disabled"))return;switch(s[a](n)){case"prev":case"next":return this.browseView(s[a](n));case"cancel":this.con.stayOpen||this.close();break;case"submit":return this.con.stayOpen||this.close(),this.selectDate(this.fetchDate(parseInt(s[a]("data-date"))));case"view":return this.switchDate(s[a]("data-year")||null,s[a]("data-month")||null,s[a]("data-day")||null),this.switchView(s[a]("data-view"))}}if("keyup"==t.type){if("INPUT"!=t.target.tagName&&t.target!==this.e&&/calendar-(static|close)/i.test(this.dt.className))return!1;13==(t.keyCode||t.which)&&(this.selectDate(this.fetchDate(this.select)),t.stopPropagation(),this.con.stayOpen||this.close()),27==(t.keyCode||t.which)&&(this.con.stayOpen||this.close())}},trigger:function(t){var e={bubbles:!1,cancelable:!0,detail:{args:arguments,self:this}};"change"==t&&(s(this.e,"input",e),s(this.e,"change",e)),s(this.dt,"tail::"+t,e);for(var i=(this.events[t]||[]).length,a=0;a<i;a++)this.events[t][a].cb.apply(this,function(t,e,i){for(var a=e.length,n=0;n<a;++n)t[n-1]=e[n];return t[n]=i,t}(new Array(arguments.length),arguments,this.events[t][a].args));return!0},calcPosition:function(){var t=this.dt.style,e=o.getComputedStyle(this.dt),i=parseInt(e.marginLeft)+parseInt(e.marginRight),a=parseInt(e.marginTop)+parseInt(e.marginBottom),n=function(t,e){for(e={top:t.offsetTop||0,left:t.offsetLeft||0,width:t.offsetWidth||0,height:t.offsetHeight||0};t=t.offsetParent;)e.top+=t.offsetTop,e.left+=t.offsetLeft;return e}(this.e,{});switch(t.visibility="hidden",this.con.position){case"top":var s=n.top-(this.dt.offsetHeight+a),r=n.left+n.width/2-(this.dt.offsetWidth/2+i/2);break;case"left":s=n.top+n.height/2-(this.dt.offsetHeight/2+a),r=n.left-(this.dt.offsetWidth+i);break;case"right":s=n.top+n.height/2-(this.dt.offsetHeight/2+a),r=n.left+n.width;break;default:s=n.top+n.height,r=n.left+n.width/2-(this.dt.offsetWidth/2+i/2)}return t.top=(0<=s?s:this.e.offsetTop)+"px",t.left=(0<=r?r:0)+"px",t.visibility="visible",this},convertDate:function(t,e){var i,a={H:String("00"+t.getHours()).toString().slice(-2),G:(i=t.getHours(),i%12?i%12:12),A:12<=t.getHours()?"PM":"AM",a:12<=t.getHours()?"pm":"am",i:String("00"+t.getMinutes()).toString().slice(-2),s:String("00"+t.getSeconds()).toString().slice(-2),Y:t.getFullYear(),y:parseInt(t.getFullYear().toString().slice(2)),m:String("00"+(t.getMonth()+1)).toString().slice(-2),M:this.__.months[t.getMonth()].slice(0,3),F:this.__.months[t.getMonth()],d:String("00"+t.getDate()).toString().slice(-2),D:this.__.days[t.getDay()],l:this.__.shorts[t.getDay()].toLowerCase()};return e.replace(/([HGismd]{1,2}|[Y]{2,4}|y{2})/g,function(t){return 4==t.length||2==t.length?a[t.slice(-1)].toString().slice(-Math.abs(t.length)):1==t.length&&"0"==t[0]?a[t.slice(-1)].toString().slice(-1):a[t.slice(-1)].toString()}).replace(/(A|a|M|F|D|l)/g,function(t){return a[t]})},renderCalendar:function(){var t,e=["tail-datetime-calendar","calendar-close"],i=c.createElement("DIV"),a=!0===this.con.classNames?this.e.className:this.con.classNames;["top","left","right","bottom"].indexOf(this.con.position)<0&&(t=c.querySelector(this.con.position),e.push("calendar-static")),("string"==typeof a||a instanceof Array)&&(e=e.concat("string"==typeof a?a.split(" "):a));var n=this.con.rtl;if((!0===n||"auto"===n&&0<=["ar","he","mdr","sam","syr"].indexOf(this.con.locale))&&e.push("rtl"),this.con.stayOpen&&e.push("calendar-stay"),i.id="tail-datetime-"+this.id,i.className=e.join(" "),i.style.cssText=this.con.rtl?"direction:rtl;":"direction:ltr;",this.con.dateFormat)var s='<span class="action action-prev" data-action="prev"></span><span class="label" data-action="view" data-view="up"></span><span class="action action-next" data-action="next"></span>';else if(this.con.timeFormat)s='<span class="action action-submit" data-action="submit"></span><span class="label"></span><span class="action action-cancel" data-action="cancel"></span>';if(void 0!==s&&(i.innerHTML='<div class="calendar-actions">'+s+"</div>"),this.con.dateFormat&&this.renderDatePicker(i,this.con.viewDefault),this.con.timeFormat&&this.renderTimePicker(i),this.con.closeButton&&!t){var r=c.createElement("BUTTON"),o=this;r.className="calendar-close",r.addEventListener("click",function(t){t.preventDefault(),o.close()}),i.appendChild(r)}return i.style.cssText=t?"position:static;visibility:visible;":"top:0;left:0;z-index:999;position:absolute;visibility:hidden;",(t||document.body).appendChild(i),i},renderDatePicker:function(t,e){if((!e||["decades","years","months","days"].indexOf(e)<0)&&(e=this.con.viewDays?"days":this.con.viewMonths?"months":this.con.viewYears?"years":!!this.con.viewDecades&&"decades"),!e||!this.con["view"+r(e)]||!this.con.dateFormat)return!1;var i=c.createElement("DIV");return i.className="calendar-datepicker calendar-view-"+e,i.innerHTML=this["view"+r(e)](),t.querySelector(".calendar-datepicker")?t.replaceChild(i,t.querySelector(".calendar-datepicker")):t.appendChild(i),this.view.type=e,this.handleLabel(t)},renderTimePicker:function(t){if(!this.con.timeFormat)return!1;var e=this.con.timeStepHours,i=this.con.timeStepMinutes,a=this.con.timeStepSeconds;e='<div class="timepicker-field timepicker-hours"><input type="number" name="dt[h]" value="" min="00" max="23" step="'+e+'" /><label>'+this.__.time[0]+"</label></div>",i='<div class="timepicker-field timepicker-minutes"><input type="number" name="dt[m]" value="" min="00" max="59" step="'+i+'" /><label>'+this.__.time[1]+"</label></div>",a='<div class="timepicker-field timepicker-seconds"><input type="number" name="dt[s]" value="" min="00" max="59" step="'+a+'" /><label>'+this.__.time[2]+"</label></div>";var n=c.createElement("DIV");n.className="calendar-timepicker",n.innerHTML=e+i+a;for(var s=this,r=n.querySelectorAll("input"),o=["Hours","Minutes","Seconds"],l=0;l<3;l++)r[l].value=this.view.date["get"+o[l]](),r[l].disabled=!1===this.con["time"+o[l]],r[l].addEventListener("input",function(t){s.handleTime.call(s,t,this)}),r[l].addEventListener("keydown",function(t){s.handleTime.call(s,t,this)});return t.querySelector(".calendar-timepicker")?t.replaceChild(n,t.querySelector(".calendar-timepicker")):t.appendChild(n),this.handleLabel(t)},handleTime:function(t,e){var i=parseInt(e.getAttribute("min")),a=parseInt(e.getAttribute("max")),n=parseInt(e.getAttribute("step")),s=parseInt(e.value),r="none";if(38==(t.keyCode||t.which)||a<s)r="up";if(40==(t.keyCode||t.which)||s<i)r="down";if("up"==r&&a<s+n){var o=1;e.value=s-(a+1)}else if("down"==r&&s-n<0){o=-1;e.value=a+1+s}if(o&&this.con.timeIncrement&&e.parentElement.previousElementSibling){var l=e.parentElement.previousElementSibling.querySelector("input");if(!1===l.disabled)return l.value=parseInt(l.value)+o,this.handleTime({},l)}var c=e.parentElement.parentElement.querySelectorAll("input");this.selectTime(c[0].value,c[1].value,c[2].value)},handleLabel:function(t){var e,i,a=t.querySelector(".label");switch(this.view.type){case"days":e=this.__.months[this.view.date.getMonth()]+", "+this.view.date.getFullYear();break;case"months":e=this.view.date.getFullYear();break;case"years":e=(i=parseInt(this.view.date.getFullYear().toString().slice(0,3)+"0"))+" - "+(i+10);break;case"decades":e=(i=parseInt(this.view.date.getFullYear().toString().slice(0,2)+"00"))+" - "+(i+100);break;case"time":e=this.__.header[3]}return a.innerText=e,t},viewDecades:function(){var t=this.view.date.getFullYear(),e=new Date(this.view.date.getTime()),i=this.con.today?(new Date).getYear():0;e.setFullYear(t-parseInt(t.toString()[3])-30);for(var a,n,s=[],r=[],o=1;o<=16;o++)a="calendar-decade"+(i>=e.getYear()&&i<=e.getYear()+10?" date-today":""),n='data-action="view" data-view="down" data-year="'+e.getFullYear()+'"',s.push('<td class="'+a+'" '+n+'><span class="inner">'+e.getFullYear()+" - "+(e.getFullYear()+10)+"</span></td>"),4<=o&&o%4==0&&(r.push("<tr>\n"+s.join("\n")+"\n</tr>"),s=[]),e.setFullYear(e.getFullYear()+10);return'<table class="calendar-decades"><thead><tr><th colspan="4">'+this.__.header[2]+"</th></tr></thead><tbody>"+r.join("\n")+"</tbody></table>"},viewYears:function(){var t=this.view.date.getFullYear(),e=new Date(this.view.date.getTime()),i=this.con.today?(new Date).getYear():0;e.setFullYear(t-parseInt(t.toString()[3])-2);for(var a,n,s=[],r=[],o=1;o<=16;o++)a="calendar-year"+(e.getYear()==i?" date-today":""),n='data-action="view" data-view="down" data-year="'+e.getFullYear()+'"',s.push('<td class="'+a+'" '+n+'><span class="inner">'+e.getFullYear()+"</span></td>"),4<=o&&o%4==0&&(r.push("<tr>\n"+s.join("\n")+"\n</tr>"),s=[]),e.setFullYear(e.getFullYear()+1);return'<table class="calendar-years"><thead><tr><th colspan="4">'+this.__.header[1]+"</th></tr></thead><tbody>"+r.join("\n")+"</tbody></table>"},viewMonths:function(){var t=this.__.months,e=this.con.today?(new Date).getMonth():-1;e=this.view.date.getYear()==(new Date).getYear()?e:-1;for(var i,a,n=[],s=[],r=0;r<12;r++)i="calendar-month"+(e==r?" date-today":""),a='data-action="view" data-view="down" data-month="'+r+'"',n.push('<td class="'+i+'" '+a+'><span class="inner">'+t[r]+"</span></td>"),3==n.length&&(s.push("<tr>\n"+n.join("\n")+"\n</tr>"),n=[]);return'<table class="calendar-months"><thead><tr><th colspan="3">'+this.__.header[0]+"</th></tr></thead><tbody>"+s.join("\n")+"</tbody></table>"},viewDays:function(){var i,t,e,a,n,s=new Date(this.view.date.getTime()),r=(new Date).toDateString(),o=s.getMonth(),l=[],c=[],d=[0,[]],h=[].concat(this.con.dateRanges),u=([].concat(this.con.tooltips),[0,0]);for(s.setHours(0,0,0,0),s.setDate(1),s.setDate(1-(s.getDay()-this.con.weekStart));c.length<6;)i=s.getTime(),e='data-action="submit" data-date="'+s.getTime()+'"',t="calendar-day date-"+(s.getMonth()>o?"next":s.getMonth()<o?"previous":"current"),this.con.today&&r==s.toDateString()&&(t+=" date-today"),this.con.dateBlacklist&&(i<this.con.dateStart||i>this.con.dateEnd)?d=[i<this.con.dateStart?this.con.dateStart:1/0,[0,1,2,3,4,5,6],!0]:0==d[0]?h=h.filter(function(t){return t.start==1/0||i>=t.start&&i<=t.end?!(d=[t.end,t.days]):t.start>i},this):3==d.length&&(d=[0,[0,1,2,3,4,5,6]]),0<this.con.tooltips.length&&this.con.tooltips.filter(function(t,e){t.date instanceof Array?t.date[0]<=i&&t.date[1]>=i&&(u=[t.date[1],e,t.color]):t.date==i&&(u=[t.date,e,t.color])},this),u[0]<i&&(u=[0,0]),(n=d[0]>=i&&0<=d[1].indexOf(s.getDay()))&&this.con.dateBlacklist||!n&&!this.con.dateBlacklist?(t+=" date-disabled",e+=' data-disabled="true"'):0!==d[0]&&d[0]<=i&&(d=[0,[]]),this.select&&this.select.toDateString()==s.toDateString()&&(t+=" date-select"),a='<span class="inner">'+s.getDate()+"</span>",0<u[0]&&(t+=" date-tooltip",e+=' data-tooltip="'+u[1]+'" data-tooltip-time="'+i+'"',"inherit"!==u[2]?a+='<span class="tooltip-tick" style="background:'+u[2]+';"></span>':a+='<span class="tooltip-tick"></span>'),l.push('<td class="'+t+'" '+e+">"+a+"</td>"),7==l.length&&(c.push("<tr>\n"+l.join("\n")+"\n</tr>"),l=[]),s.setDate(s.getDate()+1);return c="<tbody>"+c.join("\n")+"</tbody>",'<table class="calendar-days">'+this.weekdays+c+"</table>"},showTooltip:function(t,e,i){var a,n=this.con.tooltips[t].element,s=n.style,r=this.dt.querySelector(".calendar-datepicker");s.cssText="opacity:0;visibility:hidden;",n.id="tooltip-"+t+"-"+i,r.appendChild(n),a=n.offsetWidth,n.offsetHeight,s.top=e.offsetTop+e.offsetHeight+"px",s.left=e.offsetLeft+e.offsetWidth/2-a/2+"px",s.visibility="visible",this.con.animate?(n.setAttribute("data-top",parseInt(s.top)),s.top=parseInt(s.top)+5+"px",function t(){parseFloat(s.top)>n.getAttribute("data-top")&&(s.top=parseFloat(s.top)-.5+"px"),(s.opacity=parseFloat(s.opacity)+.125)<1&&setTimeout(t,20)}()):s.opacity=1},hideTooltip:function(t){var e=this.dt.querySelector("#tooltip-"+t),i=e.style;this.con.animate?(e.className+=" remove",function t(){if(parseFloat(i.top)<parseInt(e.getAttribute("data-top"))+5&&(i.top=parseFloat(i.top)+.5+"px"),(i.opacity-=.125)<0)return(e.className="calendar-tooltip")?e.parentElement.removeChild(e):"";setTimeout(t,20)}()):e.parentElement.removeChild(e)},switchView:function(t){var e=[null,"days","months","years","decades",null];return-1==e.indexOf(t)&&("up"==t?t=e[(e.indexOf(this.view.type)||5)+1]||null:"down"==t&&(t=e[(e.indexOf(this.view.type)||1)-1]||null),t&&this.con["view"+r(t)]||(t=!1)),!!t&&(this.renderDatePicker(this.dt,t),this.trigger("view",t))},switchDate:function(t,e,i,a){if(this.view.date.setFullYear(null==t?this.view.date.getFullYear():t),this.view.date.setMonth(null==e?this.view.date.getMonth():e),"auto"==i){var n=this.view.date,s=new Date;i=n.getMonth()==s.getMonth()&&n.getYear()==s.getYear()?s.getDate():1}return this.view.date.setDate(i||this.view.date.getDate()),!0===a||this.switchView(this.view.type)},switchMonth:function(t,e){return"string"==typeof t&&(t=0<=["previous","prev"].indexOf(t)?-1:1,t=this.view.date.getMonth()+type),this.switchDate(e||this.getFullYear(),t)},switchYear:function(t){return"string"==typeof t&&(t=0<=["previous","prev"].indexOf(t)?-1:1,t=this.view.date.getFullYear()+type),this.switchDate(t)},browseView:function(t){switch(t=0<=["previous","prev"].indexOf(t)?-1:1,this.view.type){case"days":return this.switchDate(null,this.view.date.getMonth()+t,"auto");case"months":return this.switchDate(this.view.date.getFullYear()+t,null,"auto");case"years":return this.switchDate(this.view.date.getFullYear()+10*t,null,"auto");case"decades":return this.switchDate(this.view.date.getFullYear()+100*t,null,"auto")}return!1},fetchDate:function(t){t=u(t||!1)||this.view.date;var e=this.dt.querySelectorAll("input[type=number]");return e&&3==e.length&&t.setHours(e[0].value||0,e[1].value||0,e[2].value||0,0),t},selectDate:function(t,e,i,a,n,s){var r=new Date,o=[];return this.con.dateFormat&&o.push(this.con.dateFormat),this.con.timeFormat&&o.push(this.con.timeFormat),this.select=t instanceof Date?t:new Date(t||(null==t?this.view.date.getFullYear():r.getFullYear()),e||(null==e?this.view.date.getMonth():r.getMonth()),i||(null==i?this.view.date.getDate():r.getDate()),a||(null==a?this.view.date.getHours():0),n||(null==n?this.view.date.getMinutes():0),s||(null==s?this.view.date.getSeconds():0)),this.view.date=new Date(this.select.getTime()),this.e.value=this.convertDate(this.select,o.join(" ")),this.e.setAttribute("data-value",this.select.getTime()),this.switchView("days"),this.trigger("change")},selectTime:function(t,e,i){return this.selectDate(void 0,void 0,void 0,t,e,i)},open:function(){if(!d(this.dt,"calendar-close"))return this;var e=this,i=this.dt.style;return i.opacity=this.con.animate?0:1,i.display="block",a(n(this.dt,"calendar-close"),"calender-idle"),!d(this.dt,"calendar-static")&&this.calcPosition(),function t(){if(1<=(i.opacity=parseFloat(i.opacity)+.125))return a(n(e.dt,"calendar-idle"),"calendar-open"),e.trigger("open");setTimeout(t,20)}(),this},close:function(){if(!d(this.dt,"calendar-open"))return this;var e=this,i=this.dt.style;return a(n(this.dt,"calendar-open"),"calender-idle"),i.opacity=this.con.animate?1:0,i.display="block",function t(){if((i.opacity-=.125)<=0)return a(n(e.dt,"calendar-idle"),"calendar-close"),i.display="none",e.trigger("close");setTimeout(t,20)}(),this},toggle:function(){return d(this.dt,"calendar-open")?this.close():d(this.dt,"calendar-close")?this.open():this},on:function(t,e,i){return!(["open","close","change","view"].indexOf(t)<0||"function"!=typeof e)&&(t in this.events||(this.events[t]=[]),this.events[t].push({cb:e,args:i instanceof Array?i:[]}),this)},remove:function(){return this.e.removeAttribute("data-tail-datetime"),this.e.removeAttribute("data-value"),this.dt.parentElement.removeChild(this.dt),this},reload:function(){return this.remove(),this.init()},config:function(t,e,i){if(t instanceof Object){for(var a in t)this.config(a,t[a],!1);return this.reload(),this.con}return void 0===t?this.con:t in this.con&&(void 0===e?this.con[t]:(this.con[t]=e,!1!==this.rebuild&&this.reload(),this))}},p}); |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -44,9 +44,9 @@ | @website https://github.com/pytesNET/tail.DateTime | ||
function cHAS(el, name){ | ||
return (el.classList)? el.classList.contains(name): false; | ||
return (!el.classList)? false: el.classList.contains(name); | ||
} | ||
function cADD(el, name){ | ||
return (el.classList && el.classList.add(name))? el: false; | ||
return (!el.classList)? false: (el.classList.add(name))? el: el; | ||
} | ||
function cREM(el, name){ | ||
return (el.classList.remove && el.classList.remove(name))? el: false; | ||
return (!el.classList)? false: (el.classList.remove(name))? el: el; | ||
} | ||
@@ -111,3 +111,3 @@ function trigger(el, event, opt){ | ||
}; | ||
datetime.version = "0.4.11"; | ||
datetime.version = "0.4.12"; | ||
datetime.status = "beta"; | ||
@@ -114,0 +114,0 @@ datetime.count = 0; |
@@ -1,2 +0,2 @@ | ||
/* pytesNET/tail.DateTime v.0.4.11 | Basic Version | @author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */ | ||
(function(a,b){"function"==typeof define&&define.amd?define(function(){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(a):("undefined"==typeof a.tail&&(a.tail={}),a.tail.DateTime=a.tail.datetime=b(a),"undefined"!=typeof jQuery&&(jQuery.fn.DateTime=jQuery.fn.datetime=function(a){var b,c=[];return this.each(function(){!1!==(b=tail.DateTime(this,a))&&c.push(b)}),1===c.length?c[0]:0!==c.length&&c}),"undefined"!=typeof MooTools&&(Element.implement({DateTime:function(a){return new tail.DateTime(this,a)}}),Element.implement({datetime:function(a){return new tail.DateTime(this,a)}})))})(this,function(c){"use strict";function f(a,b){return!!a.classList&&a.classList.contains(b)}function g(a,b){return!!(a.classList&&a.classList.add(b))&&a}function h(a,b){return!!(a.classList.remove&&a.classList.remove(b))&&a}function j(a,b,c){if(CustomEvent&&CustomEvent.name)var d=new CustomEvent(b,c);else{var d=n.createEvent("CustomEvent");d.initCustomEvent(b,!!c.bubbles,!!c.cancelable,c.detail)}return a.dispatchEvent(d)}function k(a,b){return Object.assign({},a,b||{})}function l(a){return a.charAt(0).toUpperCase()+a.slice(1)}function m(a,b,c){var d=a instanceof Date?a:!!a&&new Date(a);return d instanceof Date&&!isNaN(d.getDate())&&(c?d.setHours(0,0,0,0):d,!0===b?d.getTime():d)}var n=c.document,a=function(b,c){if(b="string"==typeof b?n.querySelectorAll(b):b,b instanceof NodeList||b instanceof HTMLCollection||b instanceof Array){for(var d=[],e=b.length,f=0;f<e;f++)d.push(new a(b[f],c));return 1===d.length?d[0]:0!==d.length&&d}if(!(b instanceof Element))return!1;if(!(this instanceof a))return new a(b,c);if(a.inst[b.getAttribute("data-tail-datetime")])return a.inst[b.getAttribute("data-tail-datetime")];if(b.getAttribute("data-datetime")){var g=JSON.parse(b.getAttribute("data-datetime").replace(/\'/g,"\""));g instanceof Object&&(c=k(c,g))}return this.e=b,this.id=++a.count,this.con=k(a.defaults,c),a.inst["tail-"+this.id]=this,this.init()};return a.version="0.4.11",a.status="beta",a.count=0,a.inst={},a.defaults={animate:!0,classNames:!1,closeButton:!0,dateFormat:"YYYY-mm-dd",dateStart:!1,dateRanges:[],dateBlacklist:!0,dateEnd:!1,locale:"en",position:"bottom",rtl:"auto",startOpen:!1,stayOpen:!1,timeFormat:"HH:ii:ss",timeHours:null,timeMinutes:null,timeSeconds:0,timeIncrement:!0,timeStepHours:1,timeStepMinutes:5,timeStepSeconds:5,today:!0,tooltips:[],viewDefault:"days",viewDecades:!0,viewYears:!0,viewMonths:!0,viewDays:!0,weekStart:0},a.strings={en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shorts:["SUN","MON","TUE","WED","THU","FRI","SAT"],time:["Hours","Minutes","Seconds"],header:["Select a Month","Select a Year","Select a Decade","Select a Time"]},modify:function(a,b,c){if(!(a in this))return!1;if(b instanceof Object)for(var d in b)this.modify(a,d,b[d]);else this[a][b]="string"==typeof c?c:this[a][b];return!0},register:function(a,b){return!!("string"==typeof a&&b instanceof Object)&&(this[a]=b,!0)}},a.prototype={init:function(){var b=this;if(this.__=k(a.strings.en,a.strings[this.con.locale]||{}),this.con.dateStart=m(this.con.dateStart,!0,!0)||0,this.con.dateEnd=m(this.con.dateEnd,!0,!0)||9999999999999,this.con.viewDefault=this.con.dateFormat?this.con.viewDefault:"time","string"==typeof this.con.weekStart&&(this.con.weekStart=a.strings.en.shorts.indexOf(this.con.weekStart)),0>this.con.weekStart&&6<this.con.weekStart&&(this.con.weekStart=0),0<this.con.dateRanges.length){for(var c=[],d=this.con.dateRanges,g=d.length,h=0;h<g;h++)d[h]instanceof Object&&(d[h].start||d[h].days)&&(!1===(d[h].start=m(d[h].start||!1,!0,!0))?d[h].start=d[h].end=1/0:(!1===(d[h].end=m(d[h].end||!1,!0,!0))&&(d[h].end=d[h].start),d[h].start=d[h].start>d[h].end?d[h].end:d[h].start),d[h].days=!("days"in d[h])||d[h].days,d[h].days="boolean"==typeof d[h].days?[0,1,2,3,4,5,6]:function(b){for(var c=[],d=b.length,e=0;e<d;e++)"string"==typeof b[e]&&(b[e]=a.strings.en.shorts.indexOf(b[e])),0<=b[e]&&6>=b[e]&&c.push(b[e]);return c}(d[h].days instanceof Array?d[h].days:[d[h].days]),c.push({start:d[h].start,end:d[h].end,days:d[h].days}));this.con.dateRanges=c}if(0<this.con.tooltips.length){for(var j,d,c=[],o=this.con.tooltips,g=o.length,h=0;h<g;h++)o[h]instanceof Object&&o[h].date&&(o[h].date instanceof Array?(j=m(o[h].date[0]||!1,!0,!0),d=m(o[h].date[1]||!1,!0,!0)||j):j=d=m(o[h].date||!1,!0,!0),!!j)&&c.push({date:j===d?j:[j,d],text:o[h].text||"Tooltip",color:o[h].color||"inherit",element:o[h].element||function(a){return a.className="calendar-tooltip",a.innerHTML="<div class=\"tooltip-inner\">"+o[h].text||"Tooltip</div>",a}(n.createElement("DIV"))});this.con.tooltips=c}var p=this.__.shorts.slice(this.con.weekStart).concat(this.__.shorts.slice(0,this.con.weekStart));this.weekdays="<thead>\n<tr>\n";for(var h=0;7>h;h++)this.weekdays+="<th class=\"calendar-week\">"+p[h]+"</th>";this.weekdays+="\n</tr>\n</thead>",this.select=m(this.e.getAttribute("data-value")||this.e.value),(!this.select||this.select<this.con.dateStart||this.select>this.con.dateEnd)&&(this.select=null),null==this.view&&(this.view={type:this.con.viewDefault,date:this.select||new Date});for(var g=["Hours","Minutes","Seconds"],h=0;3>h;h++)"number"==typeof this.con["time"+g[h]]&&this.view.date["set"+g[h]](this.con["time"+g[h]]);if(this.events={},this.dt=this.renderCalendar(),null==this._bind){var d="addEventListener";this.e[d]("focusin",function(){b.open.call(b)}),this.e[d]("keyup",function(a){b.bind.call(b,a)}),n[d]("keyup",function(a){b.dt.contains(a.target)&&b.bind.call(b,a)}),n[d]("click",function(a){b.dt.contains(a.target)?b.bind.call(b,a):!b.e.contains(a.target)&&f(b.dt,"calendar-open")&&a.target!=b.dt&&a.target!=b.e&&!b.con.stayOpen&&b.close.call(b)}),n[d]("mouseover",function(a){b.dt.contains(a.target)&&b.bind.call(b,a)}),this._bind=!0}return this.e.setAttribute("data-tail-datetime","tail-"+this.id),this.con.startOpen&&this.open(),this.select&&this.selectDate(this.select),this},bind:function(a){var b,c=a.target,d=c.getAttribute("data-action")?c:c.parentElement.getAttribute("data-action")?c.parentElement:c,e="data-tooltip";if("mouseover"==a.type&&(!1===(b=c.getAttribute(e)?c:!!d.getAttribute(e)&&d)?this.dt.querySelector(".calendar-tooltip:not(.remove)")&&this.hideTooltip(this.dt.querySelector(".calendar-tooltip").id.slice(8)):!this.dt.querySelector("#tooltip-"+b.getAttribute(e)+"-"+b.getAttribute(e+"-time"))&&this.showTooltip(b.getAttribute(e),b,b.getAttribute(e+"-time"))),"click"==a.type){if(!d||1!=a.buttons&&1!=(a.which||a.button))return;if(d.hasAttribute("data-disabled"))return;switch(d.getAttribute("data-action")){case"prev":case"next":return this.browseView(d.getAttribute("data-action"));case"cancel":this.con.stayOpen||this.close();break;case"submit":return this.con.stayOpen||this.close(),this.selectDate(this.fetchDate(parseInt(d.getAttribute("data-date"))));case"view":return this.switchDate(d.getAttribute("data-year")||null,d.getAttribute("data-month")||null,d.getAttribute("data-day")||null),this.switchView(d.getAttribute("data-view"));}}if("keyup"==a.type){if("INPUT"!=a.target.tagName&&a.target!==this.e&&/calendar-(static|close)/i.test(this.dt.className))return!1;13==(a.keyCode||a.which)&&(this.selectDate(this.fetchDate(this.select)),a.stopPropagation(),!this.con.stayOpen&&this.close()),27!=(a.keyCode||a.which)||this.con.stayOpen||this.close()}},trigger:function(a){var b={bubbles:!1,cancelable:!0,detail:{args:arguments,self:this}};"change"==a&&(j(this.e,"input",b),j(this.e,"change",b)),j(this.dt,"tail::"+a,b);for(var c=(this.events[a]||[]).length,d=0;d<c;d++)this.events[a][d].cb.apply(this,function(c,d,a){for(var b=d.length,e=0;e<b;++e)c[e-1]=d[e];return c[e]=a,c}(Array(arguments.length),arguments,this.events[a][d].args));return!0},calcPosition:function(){var d=this.dt.style,a=c.getComputedStyle(this.dt),b=parseInt(a.marginLeft)+parseInt(a.marginRight),e=parseInt(a.marginTop)+parseInt(a.marginBottom),f=function(a,b){for(b={top:a.offsetTop||0,left:a.offsetLeft||0,width:a.offsetWidth||0,height:a.offsetHeight||0};a=a.offsetParent;)b.top+=a.offsetTop,b.left+=a.offsetLeft;return b}(this.e,{});switch(d.visibility="hidden",this.con.position){case"top":var g=f.top-(this.dt.offsetHeight+e),h=f.left+f.width/2-(this.dt.offsetWidth/2+b/2);break;case"left":var g=f.top+f.height/2-(this.dt.offsetHeight/2+e),h=f.left-(this.dt.offsetWidth+b);break;case"right":var g=f.top+f.height/2-(this.dt.offsetHeight/2+e),h=f.left+f.width;break;default:var g=f.top+f.height,h=f.left+f.width/2-(this.dt.offsetWidth/2+b/2);}return d.top=(0<=g?g:this.e.offsetTop)+"px",d.left=(0<=h?h:0)+"px",d.visibility="visible",this},convertDate:function(a,b){var c={H:("00"+a.getHours()+"").toString().slice(-2),G:function(a){return a%12?a%12:12}(a.getHours()),A:12<=a.getHours()?"PM":"AM",a:12<=a.getHours()?"pm":"am",i:("00"+a.getMinutes()+"").toString().slice(-2),s:("00"+a.getSeconds()+"").toString().slice(-2),Y:a.getFullYear(),y:parseInt(a.getFullYear().toString().slice(2)),m:("00"+(a.getMonth()+1)+"").toString().slice(-2),M:this.__.months[a.getMonth()].slice(0,3),F:this.__.months[a.getMonth()],d:("00"+a.getDate()+"").toString().slice(-2),D:this.__.days[a.getDay()],l:this.__.shorts[a.getDay()].toLowerCase()};return b.replace(/([HGismd]{1,2}|[Y]{2,4}|y{2})/g,function(a){return 4==a.length||2==a.length?c[a.slice(-1)].toString().slice(-Math.abs(a.length)):1==a.length&&"0"==a[0]?c[a.slice(-1)].toString().slice(-1):c[a.slice(-1)].toString()}).replace(/(A|a|M|F|D|l)/g,function(a){return c[a]})},renderCalendar:function(){var a,b=["tail-datetime-calendar","calendar-close"],c=n.createElement("DIV"),d=!0===this.con.classNames?this.e.className:this.con.classNames;0>["top","left","right","bottom"].indexOf(this.con.position)&&(a=n.querySelector(this.con.position),b.push("calendar-static")),("string"==typeof d||d instanceof Array)&&(b=b.concat("string"==typeof d?d.split(" "):d));var e=this.con.rtl;if((!0===e||"auto"===e&&0<=["ar","he","mdr","sam","syr"].indexOf(this.con.locale))&&b.push("rtl"),this.con.stayOpen&&b.push("calendar-stay"),c.id="tail-datetime-"+this.id,c.className=b.join(" "),c.style.cssText=this.con.rtl?"direction:rtl;":"direction:ltr;",this.con.dateFormat)var f="<span class=\"action action-prev\" data-action=\"prev\"></span><span class=\"label\" data-action=\"view\" data-view=\"up\"></span><span class=\"action action-next\" data-action=\"next\"></span>";else if(this.con.timeFormat)var f="<span class=\"action action-submit\" data-action=\"submit\"></span><span class=\"label\"></span><span class=\"action action-cancel\" data-action=\"cancel\"></span>";if("undefined"!=typeof f&&(c.innerHTML="<div class=\"calendar-actions\">"+f+"</div>"),this.con.dateFormat&&this.renderDatePicker(c,this.con.viewDefault),this.con.timeFormat&&this.renderTimePicker(c),this.con.closeButton&&!a){var g=n.createElement("BUTTON"),h=this;g.className="calendar-close",g.addEventListener("click",function(a){a.preventDefault(),h.close()}),c.appendChild(g)}return c.style.cssText=a?"position:static;visibility:visible;":"top:0;left:0;z-index:999;position:absolute;visibility:hidden;",(a||document.body).appendChild(c),c},renderDatePicker:function(a,b){if((!b||0>["decades","years","months","days"].indexOf(b))&&(b=this.con.viewDays?"days":this.con.viewMonths?"months":this.con.viewYears?"years":!!this.con.viewDecades&&"decades"),!b||!this.con["view"+l(b)]||!this.con.dateFormat)return!1;var c=n.createElement("DIV");return c.className="calendar-datepicker calendar-view-"+b,c.innerHTML=this["view"+l(b)](),a.querySelector(".calendar-datepicker")?a.replaceChild(c,a.querySelector(".calendar-datepicker")):a.appendChild(c),this.view.type=b,this.handleLabel(a)},renderTimePicker:function(a){if(!this.con.timeFormat)return!1;var b=this.con.timeStepHours,c=this.con.timeStepMinutes,d=this.con.timeStepSeconds;b="<div class=\"timepicker-field timepicker-hours\"><input type=\"number\" name=\"dt[h]\" value=\"\" min=\"00\" max=\"23\" step=\""+b+"\" /><label>"+this.__.time[0]+"</label></div>",c="<div class=\"timepicker-field timepicker-minutes\"><input type=\"number\" name=\"dt[m]\" value=\"\" min=\"00\" max=\"59\" step=\""+c+"\" /><label>"+this.__.time[1]+"</label></div>",d="<div class=\"timepicker-field timepicker-seconds\"><input type=\"number\" name=\"dt[s]\" value=\"\" min=\"00\" max=\"59\" step=\""+d+"\" /><label>"+this.__.time[2]+"</label></div>";var e=n.createElement("DIV");e.className="calendar-timepicker",e.innerHTML=b+c+d;for(var f=this,g=e.querySelectorAll("input"),j=["Hours","Minutes","Seconds"],k=0;3>k;k++)g[k].value=this.view.date["get"+j[k]](),g[k].disabled=!1===this.con["time"+j[k]],g[k].addEventListener("input",function(a){f.handleTime.call(f,a,this)}),g[k].addEventListener("keydown",function(a){f.handleTime.call(f,a,this)});return a.querySelector(".calendar-timepicker")?a.replaceChild(e,a.querySelector(".calendar-timepicker")):a.appendChild(e),this.handleLabel(a)},handleTime:function(a,b){var c=parseInt(b.getAttribute("min")),d=parseInt(b.getAttribute("max")),e=parseInt(b.getAttribute("step")),f=parseInt(b.value),g="none";if(38==(a.keyCode||a.which)||f>d)var g="up";if(40==(a.keyCode||a.which)||f<c)var g="down";if("up"==g&&f+e>d){var h=1;b.value=f-(d+1)}else if("down"==g&&0>f-e){var h=-1;b.value=d+1+f}if(h&&this.con.timeIncrement&&b.parentElement.previousElementSibling){var i=b.parentElement.previousElementSibling.querySelector("input");if(!1===i.disabled)return i.value=parseInt(i.value)+h,this.handleTime({},i)}var j=b.parentElement.parentElement.querySelectorAll("input");this.selectTime(j[0].value,j[1].value,j[2].value)},handleLabel:function(a){var b,c,d=a.querySelector(".label");switch(this.view.type){case"days":b=this.__.months[this.view.date.getMonth()]+", "+this.view.date.getFullYear();break;case"months":b=this.view.date.getFullYear();break;case"years":c=parseInt(this.view.date.getFullYear().toString().slice(0,3)+"0"),b=c+" - "+(c+10);break;case"decades":c=parseInt(this.view.date.getFullYear().toString().slice(0,2)+"00"),b=c+" - "+(c+100);break;case"time":b=this.__.header[3];}return d.innerText=b,a},viewDecades:function(){var b=this.view.date.getFullYear(),d=new Date(this.view.date.getTime()),e=this.con.today?new Date().getYear():0;d.setFullYear(b-parseInt(b.toString()[3])-30);for(var f,g,h=[],j=[],k=1;16>=k;k++)f="calendar-decade"+(e>=d.getYear()&&e<=d.getYear()+10?" date-today":""),g="data-action=\"view\" data-view=\"down\" data-year=\""+d.getFullYear()+"\"",h.push("<td class=\""+f+"\" "+g+"><span class=\"inner\">"+d.getFullYear()+" - "+(d.getFullYear()+10)+"</span></td>"),4<=k&&0==k%4&&(j.push("<tr>\n"+h.join("\n")+"\n</tr>"),h=[]),d.setFullYear(d.getFullYear()+10);return"<table class=\"calendar-decades\"><thead><tr><th colspan=\"4\">"+this.__.header[2]+"</th></tr></thead><tbody>"+j.join("\n")+"</tbody></table>"},viewYears:function(){var b=this.view.date.getFullYear(),d=new Date(this.view.date.getTime()),e=this.con.today?new Date().getYear():0;d.setFullYear(b-parseInt(b.toString()[3])-2);for(var f,g,h=[],j=[],k=1;16>=k;k++)f="calendar-year"+(d.getYear()==e?" date-today":""),g="data-action=\"view\" data-view=\"down\" data-year=\""+d.getFullYear()+"\"",h.push("<td class=\""+f+"\" "+g+"><span class=\"inner\">"+d.getFullYear()+"</span></td>"),4<=k&&0==k%4&&(j.push("<tr>\n"+h.join("\n")+"\n</tr>"),h=[]),d.setFullYear(d.getFullYear()+1);return"<table class=\"calendar-years\"><thead><tr><th colspan=\"4\">"+this.__.header[1]+"</th></tr></thead><tbody>"+j.join("\n")+"</tbody></table>"},viewMonths:function(){var b=this.__.months,d=this.con.today?new Date().getMonth():-1;d=this.view.date.getYear()==new Date().getYear()?d:-1;for(var e,f,g=[],h=[],j=0;12>j;j++)e="calendar-month"+(d==j?" date-today":""),f="data-action=\"view\" data-view=\"down\" data-month=\""+j+"\"",g.push("<td class=\""+e+"\" "+f+"><span class=\"inner\">"+b[j]+"</span></td>"),3==g.length&&(h.push("<tr>\n"+g.join("\n")+"\n</tr>"),g=[]);return"<table class=\"calendar-months\"><thead><tr><th colspan=\"3\">"+this.__.header[0]+"</th></tr></thead><tbody>"+h.join("\n")+"</tbody></table>"},viewDays:function(){var b,d,e,f,g,h=new Date(this.view.date.getTime()),j=new Date().toDateString(),k=h.getMonth(),l=[],m=[],n=[0,[]],o=[].concat(this.con.dateRanges),p=[].concat(this.con.tooltips),q=[0,0];for(h.setHours(0,0,0,0),h.setDate(1),h.setDate(1-(h.getDay()-this.con.weekStart));6>m.length;)b=h.getTime(),e="data-action=\"submit\" data-date=\""+h.getTime()+"\"",d="calendar-day date-"+(h.getMonth()>k?"next":h.getMonth()<k?"previous":"current"),this.con.today&&j==h.toDateString()&&(d+=" date-today"),this.con.dateBlacklist&&(b<this.con.dateStart||b>this.con.dateEnd)?n=[b<this.con.dateStart?this.con.dateStart:1/0,[0,1,2,3,4,5,6],!0]:0==n[0]?o=o.filter(function(a){return a.start==1/0||b>=a.start&&b<=a.end?(n=[a.end,a.days],!1):a.start>b},this):3==n.length&&(n=[0,[0,1,2,3,4,5,6]]),0<this.con.tooltips.length&&(p=this.con.tooltips.filter(function(a,c){a.date instanceof Array?a.date[0]<=b&&a.date[1]>=b&&(q=[a.date[1],c,a.color]):a.date==b&&(q=[a.date,c,a.color])},this)),q[0]<b&&(q=[0,0]),g=n[0]>=b&&0<=n[1].indexOf(h.getDay()),g&&this.con.dateBlacklist||!g&&!this.con.dateBlacklist?(d+=" date-disabled",e+=" data-disabled=\"true\""):0!==n[0]&&n[0]<=b&&(n=[0,[]]),this.select&&this.select.toDateString()==h.toDateString()&&(d+=" date-select"),f="<span class=\"inner\">"+h.getDate()+"</span>",0<q[0]&&(d+=" date-tooltip",e+=" data-tooltip=\""+q[1]+"\" data-tooltip-time=\""+b+"\"",f+="inherit"===q[2]?"<span class=\"tooltip-tick\"></span>":"<span class=\"tooltip-tick\" style=\"background:"+q[2]+";\"></span>"),l.push("<td class=\""+d+"\" "+e+">"+f+"</td>"),7==l.length&&(m.push("<tr>\n"+l.join("\n")+"\n</tr>"),l=[]),h.setDate(h.getDate()+1);return m="<tbody>"+m.join("\n")+"</tbody>","<table class=\"calendar-days\">"+this.weekdays+m+"</table>"},showTooltip:function(a,b,c){var f,g,i=this.con.tooltips[a].element,j=i.style,e=this.dt.querySelector(".calendar-datepicker");j.cssText="opacity:0;visibility:hidden;",i.id="tooltip-"+a+"-"+c,e.appendChild(i),f=i.offsetWidth,g=i.offsetHeight,j.top=b.offsetTop+b.offsetHeight+"px",j.left=b.offsetLeft+b.offsetWidth/2-f/2+"px",j.visibility="visible",this.con.animate?(i.setAttribute("data-top",parseInt(j.top)),j.top=parseInt(j.top)+5+"px",function a(){parseFloat(j.top)>i.getAttribute("data-top")&&(j.top=parseFloat(j.top)-.5+"px"),1>(j.opacity=parseFloat(j.opacity)+.125)&&setTimeout(a,20)}()):j.opacity=1},hideTooltip:function(a){var b=this.dt.querySelector("#tooltip-"+a),c=b.style;this.con.animate?(b.className+=" remove",function a(){return parseFloat(c.top)<parseInt(b.getAttribute("data-top"))+5&&(c.top=parseFloat(c.top)+.5+"px"),0>(c.opacity-=.125)?(b.className="calendar-tooltip")?b.parentElement.removeChild(b):"":void setTimeout(a,20)}()):b.parentElement.removeChild(b)},switchView:function(a){var b=[null,"days","months","years","decades",null];return(-1==b.indexOf(a)&&("up"==a?a=b[(b.indexOf(this.view.type)||5)+1]||null:"down"==a&&(a=b[(b.indexOf(this.view.type)||1)-1]||null),!(a&&this.con["view"+l(a)])&&(a=!1)),!!a)&&(this.renderDatePicker(this.dt,a),this.trigger("view",a))},switchDate:function(a,b,c,d){if(this.view.date.setFullYear(null==a?this.view.date.getFullYear():a),this.view.date.setMonth(null==b?this.view.date.getMonth():b),"auto"==c){var e=this.view.date,f=new Date;c=e.getMonth()==f.getMonth()&&e.getYear()==f.getYear()?f.getDate():1}return this.view.date.setDate(c||this.view.date.getDate()),!0===d||this.switchView(this.view.type)},switchMonth:function(a,b){return"string"==typeof a&&(a=0<=["previous","prev"].indexOf(a)?-1:1,a=this.view.date.getMonth()+type),this.switchDate(b||this.getFullYear(),a)},switchYear:function(a){return"string"==typeof a&&(a=0<=["previous","prev"].indexOf(a)?-1:1,a=this.view.date.getFullYear()+type),this.switchDate(a)},browseView:function(a){switch(a=0<=["previous","prev"].indexOf(a)?-1:1,this.view.type){case"days":return this.switchDate(null,this.view.date.getMonth()+a,"auto");case"months":return this.switchDate(this.view.date.getFullYear()+a,null,"auto");case"years":return this.switchDate(this.view.date.getFullYear()+10*a,null,"auto");case"decades":return this.switchDate(this.view.date.getFullYear()+100*a,null,"auto");}return!1},fetchDate:function(a){a=m(a||!1)||this.view.date;var b=this.dt.querySelectorAll("input[type=number]");return b&&3==b.length&&a.setHours(b[0].value||0,b[1].value||0,b[2].value||0,0),a},selectDate:function(a,b,c,d,e,g){var h=new Date,i=[];return this.con.dateFormat?i.push(this.con.dateFormat):null,this.con.timeFormat?i.push(this.con.timeFormat):null,this.select=a instanceof Date?a:new Date(a?a:null==a?this.view.date.getFullYear():h.getFullYear(),b?b:null==b?this.view.date.getMonth():h.getMonth(),c?c:null==c?this.view.date.getDate():h.getDate(),d?d:null==d?this.view.date.getHours():0,e?e:null==e?this.view.date.getMinutes():0,g?g:null==g?this.view.date.getSeconds():0),this.view.date=new Date(this.select.getTime()),this.e.value=this.convertDate(this.select,i.join(" ")),this.e.setAttribute("data-value",this.select.getTime()),this.switchView("days"),this.trigger("change")},selectTime:function(a,b,c){return this.selectDate(void 0,void 0,void 0,a,b,c)},open:function(){if(!f(this.dt,"calendar-close"))return this;var a=this,b=this.dt.style;return b.opacity=this.con.animate?0:1,b.display="block",g(h(this.dt,"calendar-close"),"calender-idle"),f(this.dt,"calendar-static")?null:this.calcPosition(),function c(){return 1<=(b.opacity=parseFloat(b.opacity)+.125)?(g(h(a.dt,"calendar-idle"),"calendar-open"),a.trigger("open")):void setTimeout(c,20)}(),this},close:function(){if(!f(this.dt,"calendar-open"))return this;var a=this,b=this.dt.style;return g(h(this.dt,"calendar-open"),"calender-idle"),b.opacity=this.con.animate?1:0,b.display="block",function c(){return 0>=(b.opacity-=.125)?(g(h(a.dt,"calendar-idle"),"calendar-close"),b.display="none",a.trigger("close")):void setTimeout(c,20)}(),this},toggle:function(){return f(this.dt,"calendar-open")?this.close():f(this.dt,"calendar-close")?this.open():this},on:function(a,b,c){return!(0>["open","close","change","view"].indexOf(a)||"function"!=typeof b)&&(a in this.events||(this.events[a]=[]),this.events[a].push({cb:b,args:c instanceof Array?c:[]}),this)},remove:function(){return this.e.removeAttribute("data-tail-datetime"),this.e.removeAttribute("data-value"),this.dt.parentElement.removeChild(this.dt),this},reload:function(){return this.remove(),this.init()},config:function(a,b){if(a instanceof Object){for(var c in a)this.config(c,a[c],!1);return this.reload(),this.con}return"undefined"==typeof a?this.con:!!(a in this.con)&&("undefined"==typeof b?this.con[a]:(this.con[a]=b,!1!==this.rebuild&&this.reload(),this))}},a}); | ||
/* pytesNET/tail.DateTime v.0.4.12 | Basic Version | @author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */ | ||
!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):"object"==typeof module&&module.exports?module.exports=e(t):(void 0===t.tail&&(t.tail={}),t.tail.DateTime=t.tail.datetime=e(t),"undefined"!=typeof jQuery&&(jQuery.fn.DateTime=jQuery.fn.datetime=function(t){var e,i=[];return this.each(function(){!1!==(e=tail.DateTime(this,t))&&i.push(e)}),1===i.length?i[0]:0!==i.length&&i}),"undefined"!=typeof MooTools&&(Element.implement({DateTime:function(t){return new tail.DateTime(this,t)}}),Element.implement({datetime:function(t){return new tail.DateTime(this,t)}})))}(this,function(t){"use strict";var o=t,c=t.document;function d(t,e){return!!t.classList&&t.classList.contains(e)}function a(t,e){return!!t.classList&&(t.classList.add(e),t)}function n(t,e){return!!t.classList&&(t.classList.remove(e),t)}function s(t,e,i){if(CustomEvent&&CustomEvent.name)var a=new CustomEvent(e,i);else(a=c.createEvent("CustomEvent")).initCustomEvent(e,!!i.bubbles,!!i.cancelable,i.detail);return t.dispatchEvent(a)}function h(t,e){return Object.assign({},t,e||{})}function r(t){return t.charAt(0).toUpperCase()+t.slice(1)}function u(t,e,i){var a=t instanceof Date?t:!!t&&new Date(t);return a instanceof Date&&!isNaN(a.getDate())&&(i&&a.setHours(0,0,0,0),!0===e?a.getTime():a)}var p=function(t,e){if((t="string"==typeof t?c.querySelectorAll(t):t)instanceof NodeList||t instanceof HTMLCollection||t instanceof Array){for(var i=[],a=t.length,n=0;n<a;n++)i.push(new p(t[n],e));return 1===i.length?i[0]:0!==i.length&&i}if(!(t instanceof Element))return!1;if(!(this instanceof p))return new p(t,e);if(p.inst[t.getAttribute("data-tail-datetime")])return p.inst[t.getAttribute("data-tail-datetime")];if(t.getAttribute("data-datetime")){var s=JSON.parse(t.getAttribute("data-datetime").replace(/\'/g,'"'));s instanceof Object&&(e=h(e,s))}return this.e=t,this.id=++p.count,this.con=h(p.defaults,e),(p.inst["tail-"+this.id]=this).init()};return p.version="0.4.12",p.status="beta",p.count=0,p.inst={},p.defaults={animate:!0,classNames:!1,closeButton:!0,dateFormat:"YYYY-mm-dd",dateStart:!1,dateRanges:[],dateBlacklist:!0,dateEnd:!1,locale:"en",position:"bottom",rtl:"auto",startOpen:!1,stayOpen:!1,timeFormat:"HH:ii:ss",timeHours:null,timeMinutes:null,timeSeconds:0,timeIncrement:!0,timeStepHours:1,timeStepMinutes:5,timeStepSeconds:5,today:!0,tooltips:[],viewDefault:"days",viewDecades:!0,viewYears:!0,viewMonths:!0,viewDays:!0,weekStart:0},p.strings={en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shorts:["SUN","MON","TUE","WED","THU","FRI","SAT"],time:["Hours","Minutes","Seconds"],header:["Select a Month","Select a Year","Select a Decade","Select a Time"]},modify:function(t,e,i){if(!(t in this))return!1;if(e instanceof Object)for(var a in e)this.modify(t,a,e[a]);else this[t][e]="string"==typeof i?i:this[t][e];return!0},register:function(t,e){return"string"==typeof t&&e instanceof Object&&(this[t]=e,!0)}},p.prototype={init:function(){var t,e=this;if(this.__=h(p.strings.en,p.strings[this.con.locale]||{}),this.con.dateStart=u(this.con.dateStart,!0,!0)||0,this.con.dateEnd=u(this.con.dateEnd,!0,!0)||9999999999999,this.con.viewDefault=this.con.dateFormat?this.con.viewDefault:"time","string"==typeof this.con.weekStart&&(this.con.weekStart=p.strings.en.shorts.indexOf(this.con.weekStart)),this.con.weekStart<0&&6<this.con.weekStart&&(this.con.weekStart=0),0<this.con.dateRanges.length){for(var i=[],a=(l=this.con.dateRanges).length,n=0;n<a;n++)l[n]instanceof Object&&(l[n].start||l[n].days)&&(!1===(l[n].start=u(l[n].start||!1,!0,!0))?l[n].start=l[n].end=1/0:(!1===(l[n].end=u(l[n].end||!1,!0,!0))&&(l[n].end=l[n].start),l[n].start=l[n].start>l[n].end?[l[n].end,l[n].end=l[n].start][0]:l[n].start),l[n].days=!("days"in l[n])||l[n].days,l[n].days="boolean"!=typeof l[n].days?function(t){for(var e=[],i=t.length,a=0;a<i;a++)"string"==typeof t[a]&&(t[a]=p.strings.en.shorts.indexOf(t[a])),0<=t[a]&&t[a]<=6&&e.push(t[a]);return e}(l[n].days instanceof Array?l[n].days:[l[n].days]):[0,1,2,3,4,5,6],i.push({start:l[n].start,end:l[n].end,days:l[n].days}));this.con.dateRanges=i}if(0<this.con.tooltips.length){i=[];var s,r=this.con.tooltips;for(a=r.length,n=0;n<a;n++)r[n]instanceof Object&&r[n].date&&(r[n].date instanceof Array?(s=u(r[n].date[0]||!1,!0,!0),l=u(r[n].date[1]||!1,!0,!0)||s):s=l=u(r[n].date||!1,!0,!0),s&&i.push({date:s!==l?[s,l]:s,text:r[n].text||"Tooltip",color:r[n].color||"inherit",element:r[n].element||(t=c.createElement("DIV"),t.className="calendar-tooltip",t.innerHTML='<div class="tooltip-inner">'+r[n].text||"Tooltip</div>",t)}));this.con.tooltips=i}var o=this.__.shorts.slice(this.con.weekStart).concat(this.__.shorts.slice(0,this.con.weekStart));this.weekdays="<thead>\n<tr>\n";for(n=0;n<7;n++)this.weekdays+='<th class="calendar-week">'+o[n]+"</th>";this.weekdays+="\n</tr>\n</thead>",this.select=u(this.e.getAttribute("data-value")||this.e.value),(!this.select||this.select<this.con.dateStart||this.select>this.con.dateEnd)&&(this.select=null),null==this.view&&(this.view={type:this.con.viewDefault,date:this.select||new Date});for(a=["Hours","Minutes","Seconds"],n=0;n<3;n++)"number"==typeof this.con["time"+a[n]]&&this.view.date["set"+a[n]](this.con["time"+a[n]]);if(this.events={},this.dt=this.renderCalendar(),null==this._bind){var l="addEventListener";this.e[l]("focusin",function(t){e.open.call(e)}),this.e[l]("keyup",function(t){e.bind.call(e,t)}),c[l]("keyup",function(t){e.dt.contains(t.target)&&e.bind.call(e,t)}),c[l]("click",function(t){e.dt.contains(t.target)?e.bind.call(e,t):!e.e.contains(t.target)&&d(e.dt,"calendar-open")&&(t.target==e.dt||t.target==e.e||e.con.stayOpen||e.close.call(e))}),c[l]("mouseover",function(t){e.dt.contains(t.target)&&e.bind.call(e,t)}),this._bind=!0}return this.e.setAttribute("data-tail-datetime","tail-"+this.id),this.con.startOpen&&this.open(),this.select&&this.selectDate(this.select),this},bind:function(t){var e,i=t.target,a="getAttribute",n="data-action",s=i[a](n)?i:i.parentElement[a](n)?i.parentElement:i,r="data-tooltip";if("mouseover"==t.type&&(!1!==(e=i[a](r)?i:!!s[a](r)&&s)?this.dt.querySelector("#tooltip-"+e[a](r)+"-"+e[a](r+"-time"))||this.showTooltip(e[a](r),e,e[a](r+"-time")):this.dt.querySelector(".calendar-tooltip:not(.remove)")&&this.hideTooltip(this.dt.querySelector(".calendar-tooltip").id.slice(8))),"click"==t.type){if(!s||1!=t.buttons&&1!=(t.which||t.button))return;if(s.hasAttribute("data-disabled"))return;switch(s[a](n)){case"prev":case"next":return this.browseView(s[a](n));case"cancel":this.con.stayOpen||this.close();break;case"submit":return this.con.stayOpen||this.close(),this.selectDate(this.fetchDate(parseInt(s[a]("data-date"))));case"view":return this.switchDate(s[a]("data-year")||null,s[a]("data-month")||null,s[a]("data-day")||null),this.switchView(s[a]("data-view"))}}if("keyup"==t.type){if("INPUT"!=t.target.tagName&&t.target!==this.e&&/calendar-(static|close)/i.test(this.dt.className))return!1;13==(t.keyCode||t.which)&&(this.selectDate(this.fetchDate(this.select)),t.stopPropagation(),this.con.stayOpen||this.close()),27==(t.keyCode||t.which)&&(this.con.stayOpen||this.close())}},trigger:function(t){var e={bubbles:!1,cancelable:!0,detail:{args:arguments,self:this}};"change"==t&&(s(this.e,"input",e),s(this.e,"change",e)),s(this.dt,"tail::"+t,e);for(var i=(this.events[t]||[]).length,a=0;a<i;a++)this.events[t][a].cb.apply(this,function(t,e,i){for(var a=e.length,n=0;n<a;++n)t[n-1]=e[n];return t[n]=i,t}(new Array(arguments.length),arguments,this.events[t][a].args));return!0},calcPosition:function(){var t=this.dt.style,e=o.getComputedStyle(this.dt),i=parseInt(e.marginLeft)+parseInt(e.marginRight),a=parseInt(e.marginTop)+parseInt(e.marginBottom),n=function(t,e){for(e={top:t.offsetTop||0,left:t.offsetLeft||0,width:t.offsetWidth||0,height:t.offsetHeight||0};t=t.offsetParent;)e.top+=t.offsetTop,e.left+=t.offsetLeft;return e}(this.e,{});switch(t.visibility="hidden",this.con.position){case"top":var s=n.top-(this.dt.offsetHeight+a),r=n.left+n.width/2-(this.dt.offsetWidth/2+i/2);break;case"left":s=n.top+n.height/2-(this.dt.offsetHeight/2+a),r=n.left-(this.dt.offsetWidth+i);break;case"right":s=n.top+n.height/2-(this.dt.offsetHeight/2+a),r=n.left+n.width;break;default:s=n.top+n.height,r=n.left+n.width/2-(this.dt.offsetWidth/2+i/2)}return t.top=(0<=s?s:this.e.offsetTop)+"px",t.left=(0<=r?r:0)+"px",t.visibility="visible",this},convertDate:function(t,e){var i,a={H:String("00"+t.getHours()).toString().slice(-2),G:(i=t.getHours(),i%12?i%12:12),A:12<=t.getHours()?"PM":"AM",a:12<=t.getHours()?"pm":"am",i:String("00"+t.getMinutes()).toString().slice(-2),s:String("00"+t.getSeconds()).toString().slice(-2),Y:t.getFullYear(),y:parseInt(t.getFullYear().toString().slice(2)),m:String("00"+(t.getMonth()+1)).toString().slice(-2),M:this.__.months[t.getMonth()].slice(0,3),F:this.__.months[t.getMonth()],d:String("00"+t.getDate()).toString().slice(-2),D:this.__.days[t.getDay()],l:this.__.shorts[t.getDay()].toLowerCase()};return e.replace(/([HGismd]{1,2}|[Y]{2,4}|y{2})/g,function(t){return 4==t.length||2==t.length?a[t.slice(-1)].toString().slice(-Math.abs(t.length)):1==t.length&&"0"==t[0]?a[t.slice(-1)].toString().slice(-1):a[t.slice(-1)].toString()}).replace(/(A|a|M|F|D|l)/g,function(t){return a[t]})},renderCalendar:function(){var t,e=["tail-datetime-calendar","calendar-close"],i=c.createElement("DIV"),a=!0===this.con.classNames?this.e.className:this.con.classNames;["top","left","right","bottom"].indexOf(this.con.position)<0&&(t=c.querySelector(this.con.position),e.push("calendar-static")),("string"==typeof a||a instanceof Array)&&(e=e.concat("string"==typeof a?a.split(" "):a));var n=this.con.rtl;if((!0===n||"auto"===n&&0<=["ar","he","mdr","sam","syr"].indexOf(this.con.locale))&&e.push("rtl"),this.con.stayOpen&&e.push("calendar-stay"),i.id="tail-datetime-"+this.id,i.className=e.join(" "),i.style.cssText=this.con.rtl?"direction:rtl;":"direction:ltr;",this.con.dateFormat)var s='<span class="action action-prev" data-action="prev"></span><span class="label" data-action="view" data-view="up"></span><span class="action action-next" data-action="next"></span>';else if(this.con.timeFormat)s='<span class="action action-submit" data-action="submit"></span><span class="label"></span><span class="action action-cancel" data-action="cancel"></span>';if(void 0!==s&&(i.innerHTML='<div class="calendar-actions">'+s+"</div>"),this.con.dateFormat&&this.renderDatePicker(i,this.con.viewDefault),this.con.timeFormat&&this.renderTimePicker(i),this.con.closeButton&&!t){var r=c.createElement("BUTTON"),o=this;r.className="calendar-close",r.addEventListener("click",function(t){t.preventDefault(),o.close()}),i.appendChild(r)}return i.style.cssText=t?"position:static;visibility:visible;":"top:0;left:0;z-index:999;position:absolute;visibility:hidden;",(t||document.body).appendChild(i),i},renderDatePicker:function(t,e){if((!e||["decades","years","months","days"].indexOf(e)<0)&&(e=this.con.viewDays?"days":this.con.viewMonths?"months":this.con.viewYears?"years":!!this.con.viewDecades&&"decades"),!e||!this.con["view"+r(e)]||!this.con.dateFormat)return!1;var i=c.createElement("DIV");return i.className="calendar-datepicker calendar-view-"+e,i.innerHTML=this["view"+r(e)](),t.querySelector(".calendar-datepicker")?t.replaceChild(i,t.querySelector(".calendar-datepicker")):t.appendChild(i),this.view.type=e,this.handleLabel(t)},renderTimePicker:function(t){if(!this.con.timeFormat)return!1;var e=this.con.timeStepHours,i=this.con.timeStepMinutes,a=this.con.timeStepSeconds;e='<div class="timepicker-field timepicker-hours"><input type="number" name="dt[h]" value="" min="00" max="23" step="'+e+'" /><label>'+this.__.time[0]+"</label></div>",i='<div class="timepicker-field timepicker-minutes"><input type="number" name="dt[m]" value="" min="00" max="59" step="'+i+'" /><label>'+this.__.time[1]+"</label></div>",a='<div class="timepicker-field timepicker-seconds"><input type="number" name="dt[s]" value="" min="00" max="59" step="'+a+'" /><label>'+this.__.time[2]+"</label></div>";var n=c.createElement("DIV");n.className="calendar-timepicker",n.innerHTML=e+i+a;for(var s=this,r=n.querySelectorAll("input"),o=["Hours","Minutes","Seconds"],l=0;l<3;l++)r[l].value=this.view.date["get"+o[l]](),r[l].disabled=!1===this.con["time"+o[l]],r[l].addEventListener("input",function(t){s.handleTime.call(s,t,this)}),r[l].addEventListener("keydown",function(t){s.handleTime.call(s,t,this)});return t.querySelector(".calendar-timepicker")?t.replaceChild(n,t.querySelector(".calendar-timepicker")):t.appendChild(n),this.handleLabel(t)},handleTime:function(t,e){var i=parseInt(e.getAttribute("min")),a=parseInt(e.getAttribute("max")),n=parseInt(e.getAttribute("step")),s=parseInt(e.value),r="none";if(38==(t.keyCode||t.which)||a<s)r="up";if(40==(t.keyCode||t.which)||s<i)r="down";if("up"==r&&a<s+n){var o=1;e.value=s-(a+1)}else if("down"==r&&s-n<0){o=-1;e.value=a+1+s}if(o&&this.con.timeIncrement&&e.parentElement.previousElementSibling){var l=e.parentElement.previousElementSibling.querySelector("input");if(!1===l.disabled)return l.value=parseInt(l.value)+o,this.handleTime({},l)}var c=e.parentElement.parentElement.querySelectorAll("input");this.selectTime(c[0].value,c[1].value,c[2].value)},handleLabel:function(t){var e,i,a=t.querySelector(".label");switch(this.view.type){case"days":e=this.__.months[this.view.date.getMonth()]+", "+this.view.date.getFullYear();break;case"months":e=this.view.date.getFullYear();break;case"years":e=(i=parseInt(this.view.date.getFullYear().toString().slice(0,3)+"0"))+" - "+(i+10);break;case"decades":e=(i=parseInt(this.view.date.getFullYear().toString().slice(0,2)+"00"))+" - "+(i+100);break;case"time":e=this.__.header[3]}return a.innerText=e,t},viewDecades:function(){var t=this.view.date.getFullYear(),e=new Date(this.view.date.getTime()),i=this.con.today?(new Date).getYear():0;e.setFullYear(t-parseInt(t.toString()[3])-30);for(var a,n,s=[],r=[],o=1;o<=16;o++)a="calendar-decade"+(i>=e.getYear()&&i<=e.getYear()+10?" date-today":""),n='data-action="view" data-view="down" data-year="'+e.getFullYear()+'"',s.push('<td class="'+a+'" '+n+'><span class="inner">'+e.getFullYear()+" - "+(e.getFullYear()+10)+"</span></td>"),4<=o&&o%4==0&&(r.push("<tr>\n"+s.join("\n")+"\n</tr>"),s=[]),e.setFullYear(e.getFullYear()+10);return'<table class="calendar-decades"><thead><tr><th colspan="4">'+this.__.header[2]+"</th></tr></thead><tbody>"+r.join("\n")+"</tbody></table>"},viewYears:function(){var t=this.view.date.getFullYear(),e=new Date(this.view.date.getTime()),i=this.con.today?(new Date).getYear():0;e.setFullYear(t-parseInt(t.toString()[3])-2);for(var a,n,s=[],r=[],o=1;o<=16;o++)a="calendar-year"+(e.getYear()==i?" date-today":""),n='data-action="view" data-view="down" data-year="'+e.getFullYear()+'"',s.push('<td class="'+a+'" '+n+'><span class="inner">'+e.getFullYear()+"</span></td>"),4<=o&&o%4==0&&(r.push("<tr>\n"+s.join("\n")+"\n</tr>"),s=[]),e.setFullYear(e.getFullYear()+1);return'<table class="calendar-years"><thead><tr><th colspan="4">'+this.__.header[1]+"</th></tr></thead><tbody>"+r.join("\n")+"</tbody></table>"},viewMonths:function(){var t=this.__.months,e=this.con.today?(new Date).getMonth():-1;e=this.view.date.getYear()==(new Date).getYear()?e:-1;for(var i,a,n=[],s=[],r=0;r<12;r++)i="calendar-month"+(e==r?" date-today":""),a='data-action="view" data-view="down" data-month="'+r+'"',n.push('<td class="'+i+'" '+a+'><span class="inner">'+t[r]+"</span></td>"),3==n.length&&(s.push("<tr>\n"+n.join("\n")+"\n</tr>"),n=[]);return'<table class="calendar-months"><thead><tr><th colspan="3">'+this.__.header[0]+"</th></tr></thead><tbody>"+s.join("\n")+"</tbody></table>"},viewDays:function(){var i,t,e,a,n,s=new Date(this.view.date.getTime()),r=(new Date).toDateString(),o=s.getMonth(),l=[],c=[],d=[0,[]],h=[].concat(this.con.dateRanges),u=([].concat(this.con.tooltips),[0,0]);for(s.setHours(0,0,0,0),s.setDate(1),s.setDate(1-(s.getDay()-this.con.weekStart));c.length<6;)i=s.getTime(),e='data-action="submit" data-date="'+s.getTime()+'"',t="calendar-day date-"+(s.getMonth()>o?"next":s.getMonth()<o?"previous":"current"),this.con.today&&r==s.toDateString()&&(t+=" date-today"),this.con.dateBlacklist&&(i<this.con.dateStart||i>this.con.dateEnd)?d=[i<this.con.dateStart?this.con.dateStart:1/0,[0,1,2,3,4,5,6],!0]:0==d[0]?h=h.filter(function(t){return t.start==1/0||i>=t.start&&i<=t.end?!(d=[t.end,t.days]):t.start>i},this):3==d.length&&(d=[0,[0,1,2,3,4,5,6]]),0<this.con.tooltips.length&&this.con.tooltips.filter(function(t,e){t.date instanceof Array?t.date[0]<=i&&t.date[1]>=i&&(u=[t.date[1],e,t.color]):t.date==i&&(u=[t.date,e,t.color])},this),u[0]<i&&(u=[0,0]),(n=d[0]>=i&&0<=d[1].indexOf(s.getDay()))&&this.con.dateBlacklist||!n&&!this.con.dateBlacklist?(t+=" date-disabled",e+=' data-disabled="true"'):0!==d[0]&&d[0]<=i&&(d=[0,[]]),this.select&&this.select.toDateString()==s.toDateString()&&(t+=" date-select"),a='<span class="inner">'+s.getDate()+"</span>",0<u[0]&&(t+=" date-tooltip",e+=' data-tooltip="'+u[1]+'" data-tooltip-time="'+i+'"',"inherit"!==u[2]?a+='<span class="tooltip-tick" style="background:'+u[2]+';"></span>':a+='<span class="tooltip-tick"></span>'),l.push('<td class="'+t+'" '+e+">"+a+"</td>"),7==l.length&&(c.push("<tr>\n"+l.join("\n")+"\n</tr>"),l=[]),s.setDate(s.getDate()+1);return c="<tbody>"+c.join("\n")+"</tbody>",'<table class="calendar-days">'+this.weekdays+c+"</table>"},showTooltip:function(t,e,i){var a,n=this.con.tooltips[t].element,s=n.style,r=this.dt.querySelector(".calendar-datepicker");s.cssText="opacity:0;visibility:hidden;",n.id="tooltip-"+t+"-"+i,r.appendChild(n),a=n.offsetWidth,n.offsetHeight,s.top=e.offsetTop+e.offsetHeight+"px",s.left=e.offsetLeft+e.offsetWidth/2-a/2+"px",s.visibility="visible",this.con.animate?(n.setAttribute("data-top",parseInt(s.top)),s.top=parseInt(s.top)+5+"px",function t(){parseFloat(s.top)>n.getAttribute("data-top")&&(s.top=parseFloat(s.top)-.5+"px"),(s.opacity=parseFloat(s.opacity)+.125)<1&&setTimeout(t,20)}()):s.opacity=1},hideTooltip:function(t){var e=this.dt.querySelector("#tooltip-"+t),i=e.style;this.con.animate?(e.className+=" remove",function t(){if(parseFloat(i.top)<parseInt(e.getAttribute("data-top"))+5&&(i.top=parseFloat(i.top)+.5+"px"),(i.opacity-=.125)<0)return(e.className="calendar-tooltip")?e.parentElement.removeChild(e):"";setTimeout(t,20)}()):e.parentElement.removeChild(e)},switchView:function(t){var e=[null,"days","months","years","decades",null];return-1==e.indexOf(t)&&("up"==t?t=e[(e.indexOf(this.view.type)||5)+1]||null:"down"==t&&(t=e[(e.indexOf(this.view.type)||1)-1]||null),t&&this.con["view"+r(t)]||(t=!1)),!!t&&(this.renderDatePicker(this.dt,t),this.trigger("view",t))},switchDate:function(t,e,i,a){if(this.view.date.setFullYear(null==t?this.view.date.getFullYear():t),this.view.date.setMonth(null==e?this.view.date.getMonth():e),"auto"==i){var n=this.view.date,s=new Date;i=n.getMonth()==s.getMonth()&&n.getYear()==s.getYear()?s.getDate():1}return this.view.date.setDate(i||this.view.date.getDate()),!0===a||this.switchView(this.view.type)},switchMonth:function(t,e){return"string"==typeof t&&(t=0<=["previous","prev"].indexOf(t)?-1:1,t=this.view.date.getMonth()+type),this.switchDate(e||this.getFullYear(),t)},switchYear:function(t){return"string"==typeof t&&(t=0<=["previous","prev"].indexOf(t)?-1:1,t=this.view.date.getFullYear()+type),this.switchDate(t)},browseView:function(t){switch(t=0<=["previous","prev"].indexOf(t)?-1:1,this.view.type){case"days":return this.switchDate(null,this.view.date.getMonth()+t,"auto");case"months":return this.switchDate(this.view.date.getFullYear()+t,null,"auto");case"years":return this.switchDate(this.view.date.getFullYear()+10*t,null,"auto");case"decades":return this.switchDate(this.view.date.getFullYear()+100*t,null,"auto")}return!1},fetchDate:function(t){t=u(t||!1)||this.view.date;var e=this.dt.querySelectorAll("input[type=number]");return e&&3==e.length&&t.setHours(e[0].value||0,e[1].value||0,e[2].value||0,0),t},selectDate:function(t,e,i,a,n,s){var r=new Date,o=[];return this.con.dateFormat&&o.push(this.con.dateFormat),this.con.timeFormat&&o.push(this.con.timeFormat),this.select=t instanceof Date?t:new Date(t||(null==t?this.view.date.getFullYear():r.getFullYear()),e||(null==e?this.view.date.getMonth():r.getMonth()),i||(null==i?this.view.date.getDate():r.getDate()),a||(null==a?this.view.date.getHours():0),n||(null==n?this.view.date.getMinutes():0),s||(null==s?this.view.date.getSeconds():0)),this.view.date=new Date(this.select.getTime()),this.e.value=this.convertDate(this.select,o.join(" ")),this.e.setAttribute("data-value",this.select.getTime()),this.switchView("days"),this.trigger("change")},selectTime:function(t,e,i){return this.selectDate(void 0,void 0,void 0,t,e,i)},open:function(){if(!d(this.dt,"calendar-close"))return this;var e=this,i=this.dt.style;return i.opacity=this.con.animate?0:1,i.display="block",a(n(this.dt,"calendar-close"),"calender-idle"),!d(this.dt,"calendar-static")&&this.calcPosition(),function t(){if(1<=(i.opacity=parseFloat(i.opacity)+.125))return a(n(e.dt,"calendar-idle"),"calendar-open"),e.trigger("open");setTimeout(t,20)}(),this},close:function(){if(!d(this.dt,"calendar-open"))return this;var e=this,i=this.dt.style;return a(n(this.dt,"calendar-open"),"calender-idle"),i.opacity=this.con.animate?1:0,i.display="block",function t(){if((i.opacity-=.125)<=0)return a(n(e.dt,"calendar-idle"),"calendar-close"),i.display="none",e.trigger("close");setTimeout(t,20)}(),this},toggle:function(){return d(this.dt,"calendar-open")?this.close():d(this.dt,"calendar-close")?this.open():this},on:function(t,e,i){return!(["open","close","change","view"].indexOf(t)<0||"function"!=typeof e)&&(t in this.events||(this.events[t]=[]),this.events[t].push({cb:e,args:i instanceof Array?i:[]}),this)},remove:function(){return this.e.removeAttribute("data-tail-datetime"),this.e.removeAttribute("data-value"),this.dt.parentElement.removeChild(this.dt),this},reload:function(){return this.remove(),this.init()},config:function(t,e,i){if(t instanceof Object){for(var a in t)this.config(a,t[a],!1);return this.reload(),this.con}return void 0===t?this.con:t in this.con&&(void 0===e?this.con[t]:(this.con[t]=e,!1!==this.rebuild&&this.reload(),this))}},p}); |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -1,2 +0,2 @@ | ||
/* pytesNET/tail.select v.0.4.11 | Language Packages | @author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */ | ||
/* pytesNET/tail.select v.0.4.12 | Language Packages | @author SamBrishes, pytesNET <sam@pytes.net> | @license MIT */ | ||
!function(i){"function"==typeof define&&define.amd?define(function(){return function(e){i(e)}}):void 0!==window.tail&&window.tail.DateTime&&i(window.tail.DateTime)}(function(e){return e.strings.register("ar",{months:["يناير","فبراير","مارس","أبريل","مايو","يونيو","يوليو","أغسطس","سبتمبر","أكتوبر","نوفمبر","ديسمبر"],days:["الأحد","الإثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت"],shorts:["أحد","إثن","ثلا","أرب","خمي","جمع","سبت"],time:["ساعة","دقيقة","ثانية"],header:["إختر الشهر","إخنر السنة","إختر العقد","إختر الوقت"]}),e.strings.register("de",{months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],days:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],shorts:["SO","MO","DI","MI","DO","FR","SA"],time:["Stunden","Minuten","Sekunden"],header:["Wähle einen Monat","Wähle ein Jahr","Wähle ein Jahrzehnt","Wähle eine Uhrzeit"]}),e.strings.register("de_AT",{months:["Jänner","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],days:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],shorts:["SO","MO","DI","MI","DO","FR","SA"],time:["Stunden","Minuten","Sekunden"],header:["Wähle einen Monat","Wähle ein Jahr","Wähle ein Jahrzehnt","Wähle eine Uhrzeit"]}),e.strings.register("es",{months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],days:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"],shorts:["DOM","LUN","MAR","MIÉ","JUE","VIE","SÁB"],time:["Horas","Minutos","Segundos"],header:["Selecciona un mes","Seleccione un año","Seleccione un década","Seleccione una hora"]}),e.strings.register("fi",{months:["Tammikuu","Helmikuu","Maaliskuu","Huhtikuu","Toukokuu","Kesäkuu","Heinäkuu","Elokuu","Syyskuu","Lokakuu","Marraskuu","Joulukuu"],days:["Sunnuntai","Maanantai","Tiistai","Keskiviikko","Torstai","Perjantai","Lauantai"],shorts:["Su","Ma","Ti","Ke","To","Pe","La"],time:["Tunnit","Minuutit","Sekuntit"],header:["Valitse kuukausi","Valitse vuosi","Valitse vuosikymmen","Valitse aika"]}),e.strings.register("fr",{months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],days:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],shorts:["DIM","LUN","MAR","MER","JEU","VEN","SAM"],time:["Heure","Minute","Seconde"],header:["Choisissez un mois","Choisissez une année","Choisissez une décénie","Kies een Tijdstip"]}),e.strings.register("it",{months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],days:["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"],shorts:["DOM","LUN","MAR","MER","GIO","VEN","SAB"],time:["Ore","Minuti","Secondi"],header:["Seleziona un mese","Seleziona un anno","Seleziona un decennio","Seleziona un orario"]}),e.strings.register("nl",{months:["Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"],days:["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"],shorts:["ZO","MA","DI","WO","DO","VR","ZA"],time:["Uur","Minuten","Seconden"],header:["Kies een Maand","Kies een Jaar","Kies een Decennium","Kies een Tijdstip"]}),e.strings.register("no",{months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],days:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"],shorts:["SØN","MAN","TIR","ONS","TOR","FRE","LØR"],time:["Timer","Minutter","Sekunder"],header:["Velg måned","Velg år","Velg tiår","Velg klokkeslett"]}),e.strings.register("pt_BR",{months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],days:["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"],shorts:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],time:["Horas","Minutos","Segundos"],header:["Escolha um mês","Escolha um ano","Escolha uma década","Escolha um horário"]}),e.strings.register("ru",{months:["январь","февраль","март","апрель","май","июнь","июль","август","сентябрь","октябрь","ноябрь","декабрь"],days:["воскресенье","понедельник","вторник","среда","четверг","пятница","суббота"],shorts:["вс","пн","вт","ср","чт","пт","сб"],time:["часов","минут","секунд"],header:["Выберите месяц","Выберите год","Выберите Десятилетие","Выберите время"]}),e.strings.register("tr",{months:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],days:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"],shorts:["PA","PT","SA","ÇA","PE","CU","CT"],time:["Saat","Dakika","Saniye"],header:["Ay Seçin","Yıl Seçin","On Yıl Seçin","Zaman Seçin"]}),e}); |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.11 - Beta | ||
| @version 0.4.12 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
{ | ||
"name": "tail.datetime", | ||
"version": "0.4.11", | ||
"version": "0.4.12", | ||
"description": "A powerful, translat- and configurable DateTime Picker, written in Vanilla JavaScript without any dependencies!", | ||
@@ -28,6 +28,9 @@ "keywords": [ | ||
}, | ||
"devDependencies": { | ||
"less": ">=3.5.0" | ||
}, | ||
"reveal": true, | ||
"browser": "js/tail.datetime.full.js", | ||
"jsdelivr": "js/tail.datetime.full.js" | ||
"browser": "js/tail.datetime-full.js", | ||
"jsdelivr": "js/tail.datetime-full.js" | ||
} |
tail.DateTime | ||
============= | ||
[![npm Version](https://s.pytes.me/a7034683)](https://s.pytes.net/64a7f3a3) | ||
[![npm Downloads](https://s.pytes.me/e3024ed7)](https://s.pytes.net/64a7f3a3) | ||
[![npm Version](https://s.pytes.me/a7034683)](https://s.pytes.me/64a7f3a3) | ||
[![npm Downloads](https://s.pytes.me/e3024ed7)](https://s.pytes.me/64a7f3a3) | ||
[![Support Me](https://s.pytes.me/4a1717aa)](https://buymeacoffee.com/pytesNET) | ||
@@ -28,10 +28,10 @@ [![plainJS](https://s.pytes.me/3fd80118)](https://s.pytes.me/e0b6ce86) | ||
-------- | ||
- A beautiful Date/Time Picker (in 2 Designs + 6 Color Schemes) | ||
- Definable ranges of selectable dates (Blacklist / Whitelist) | ||
- Colorable Tooltips with an cute animation | ||
- Different Views to navigate quickly: Days, Months, Years & Decades | ||
- Completely Translatable and already available in 9 languages | ||
- Extendable and Bindable through different Events | ||
- Compatible with AMD, tested with requireJS | ||
- Many Settings to adapt and configure the design and behavior | ||
- A beautiful Date/Time Picker (in 2 Designs + 6 Color Schemes). | ||
- Definable ranges of selectable dates (Blacklist / Whitelist). | ||
- Colorable Tooltips with an cute animation. | ||
- Different Views to navigate quickly: Days, Months, Years & Decades. | ||
- Completely Translatable and already available in 9 languages. | ||
- Extendable and Bindable through different Events. | ||
- Many Settings to adapt and configure the design and behaviour. | ||
- Supports AMD (requireJS) and available as browserify module. | ||
- Compatible with all modern browsers **(including IE 10+)** | ||
@@ -38,0 +38,0 @@ - No Dependencies, just embed and use |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
296074
1
4410