tail.datetime
Advanced tools
Comparing version 0.4.4 to 0.4.5
CHANGELOG | ||
========= | ||
Version 0.4.4 | ||
------------- | ||
- Add: The new `jsdelivr` key => value in the `package.json` file! | ||
Version 0.4.5 - Beta | ||
-------------------- | ||
- Add: The new Dutch Translation. Many Thanks to [mickeybyte](https://github.com/mickeybyte) | ||
[#15](https://github.com/pytesNET/tail.DateTime/issues/15)! | ||
- Add: Increase and Loop the Time fields by clicking Up and Down. | ||
- Add: The new option `timeIncrement`, which increase the next unit on loop of the previous one. | ||
- Add: The new option `closeButton`, which adds a close Button to the DateTime picker. | ||
- Add: The new internal method `handleTime()` which handles the time events. | ||
- Update: The `time*` options allows now also `false` as parameter to disable the field. | ||
Version 0.4.4 - Beta | ||
-------------------- | ||
- Remove: The `project.synder` file until the new Synder Format is finished! | ||
- Bugfix: CDN / NPM Hotfix (because I uploaded the wrong branch to NPM)! | ||
Version 0.4.3 | ||
------------- | ||
Version 0.4.3 - Beta | ||
-------------------- | ||
- Add: The new Italian Translation. Many Thanks to [Fabio Di Stasio](https://github.com/Fabio286) | ||
@@ -21,4 +30,4 @@ [#10](https://github.com/pytesNET/tail.DateTime/issues/10)! | ||
Version 0.4.2 | ||
------------- | ||
Version 0.4.2 - Beta | ||
-------------------- | ||
- Add: The new `modify()` method on the string Storage to change the strings globally. | ||
@@ -25,0 +34,0 @@ - Update: The `.register()` method checks now if locale is a string and object a object. |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.4 - Beta | ||
| @version 0.4.5 - Beta | ||
| | ||
@@ -106,3 +106,3 @@ | @website https://github.com/pytesNET/tail.DateTime | ||
}; | ||
tailDateTime.version = "0.4.4"; | ||
tailDateTime.version = "0.4.5"; | ||
tailDateTime.status = "beta"; | ||
@@ -118,2 +118,3 @@ tailDateTime.count = 0; | ||
classNames: false, | ||
closeButton: true, | ||
dateFormat: "YYYY-mm-dd", | ||
@@ -133,2 +134,3 @@ dateStart: false, | ||
timeSeconds: 0, | ||
timeIncrement: true, | ||
timeStepHours: 1, | ||
@@ -193,2 +195,9 @@ timeStepMinutes: 5, | ||
}, | ||
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"] | ||
}, | ||
pt_BR: { | ||
@@ -550,3 +559,3 @@ months: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"], | ||
| RENDER :: CALENDAR | ||
| @version 0.4.1 [0.4.0] | ||
| @version 0.4.5 [0.4.0] | ||
*/ | ||
@@ -599,2 +608,13 @@ renderCalendar: function(){ | ||
// Render Close Button | ||
if(this.con.closeButton && !_s){ | ||
var close = d.createElement("BUTTON"), self = this; | ||
close.className = "calendar-close"; | ||
close.addEventListener("click", function(event){ | ||
event.preventDefault(); | ||
self.close(); | ||
}); | ||
dt.appendChild(close); | ||
} | ||
// Append Calendar | ||
@@ -638,18 +658,19 @@ if(_s){ | ||
| RENDER :: TIME PICKER | ||
| @version 0.4.3 [0.4.0] | ||
| @version 0.4.5 [0.4.0] | ||
*/ | ||
renderTimePicker: function(dt){ | ||
if(!this.con.timeFormat){ return false; } | ||
var h ='<div class="timepicker-field timepicker-hours">' | ||
+ '<input type="number" name="dt[h]" value="" min="00" max="23" step="' + this.con.timeStepHours + '" />' | ||
+ '<label>' + this.__["time"][0] + '</label>' | ||
+ '</div>', | ||
m = '<div class="timepicker-field timepicker-minutes">' | ||
+ '<input type="number" name="dt[m]" value="" min="00" max="59" step="' + this.con.timeStepMinutes + '" />' | ||
+ '<label>' + this.__["time"][1] + '</label>' | ||
+ '</div>', | ||
s = '<div class="timepicker-field timepicker-seconds">' | ||
+ '<input type="number" name="dt[s]" value="" min="00" max="59" step="' + this.con.timeStepSeconds + '" />' | ||
+ '<label>' + this.__["time"][2] + '</label>' | ||
+ '</div>'; | ||
var h = this.con.timeStepHours, m = this.con.timeStepMinutes, s = this.con.timeStepSeconds; | ||
h ='<div class="timepicker-field timepicker-hours">' | ||
+ '<input type="number" name="dt[h]" value="" min="00" max="23" step="' + h + '" />' | ||
+ '<label>' + this.__["time"][0] + '</label>' | ||
+ '</div>', | ||
m = '<div class="timepicker-field timepicker-minutes">' | ||
+ '<input type="number" name="dt[m]" value="" min="00" max="59" step="' + m + '" />' | ||
+ '<label>' + this.__["time"][1] + '</label>' | ||
+ '</div>', | ||
s = '<div class="timepicker-field timepicker-seconds">' | ||
+ '<input type="number" name="dt[s]" value="" min="00" max="59" step="' + s + '" />' | ||
+ '<label>' + this.__["time"][2] + '</label>' | ||
+ '</div>'; | ||
@@ -662,12 +683,9 @@ // Render View | ||
// Set Data | ||
var selectTime = function(event){ | ||
var time = this.parentElement.parentElement.querySelectorAll("input"); | ||
self.selectTime(time[0].value, time[1].value, time[2].value); | ||
}, self = this, inp = div.querySelectorAll("input"); | ||
inp[0].value = this.view.date.getHours(); | ||
inp[0].addEventListener("input", selectTime); | ||
inp[1].value = this.view.date.getMinutes(); | ||
inp[1].addEventListener("input", selectTime); | ||
inp[2].value = this.view.date.getSeconds(); | ||
inp[2].addEventListener("input", selectTime); | ||
var self = this, inp = div.querySelectorAll("input"); | ||
for(var l = ["Hours", "Minutes", "Seconds"], i = 0; i < 3; i++){ | ||
inp[i].value = this.view.date["get" + l[i]](); | ||
inp[i].disabled = (this.con["time" + l[i]] === false); | ||
inp[i].addEventListener("input", function(ev){ self.handleTime.call(self, ev, this) }); | ||
inp[i].addEventListener("keydown", function(ev){ self.handleTime.call(self, ev, this) }); | ||
} | ||
@@ -684,2 +702,39 @@ // Append Element | ||
/* | ||
| HANDLE :: TIME FIELDs | ||
| @version 0.4.5 [0.4.5] | ||
*/ | ||
handleTime: function(event, element){ | ||
var min = parseInt(element.getAttribute("min")), | ||
max = parseInt(element.getAttribute("max")), | ||
step = parseInt(element.getAttribute("step")), | ||
value = parseInt(element.value), action = "none"; | ||
if((event.keyCode || event.which) == 38 || value > max){ | ||
var action = "up"; | ||
} if((event.keyCode || event.which) == 40 || value < min){ | ||
var action = "down"; | ||
} | ||
// Increase Time | ||
if(action == "up" && value + step > max){ | ||
var add = 1; | ||
element.value = value - (max+1); | ||
} else if(action == "down" && value - step < 0){ | ||
var add = -1; | ||
element.value = (max+1) + value; | ||
} | ||
if(add && this.con.timeIncrement && element.parentElement.previousElementSibling){ | ||
var next = element.parentElement.previousElementSibling.querySelector("input"); | ||
if(next.disabled === false){ | ||
next.value = parseInt(next.value) + add; | ||
return this.handleTime({}, next); | ||
} | ||
} | ||
// Set Time | ||
var time = element.parentElement.parentElement.querySelectorAll("input"); | ||
this.selectTime(time[0].value, time[1].value, time[2].value); | ||
}, | ||
/* | ||
| VIEW :: HANDLE LABEL | ||
@@ -686,0 +741,0 @@ | @version 0.4.0 [0.4.0] |
@@ -1,2 +0,2 @@ | ||
/* pytesNET/tail.DateTime @ 0.4.4 © SamBrishes | pytesNET */ | ||
!function(t){"function"==typeof define&&define.amd?define(function(){return t(window)}):(void 0===window.tail&&(window.tail={}),window.tail.DateTime=t(window))}(function(t){"use strict";var o=t,c=t.document;function h(t,e){return new RegExp("\\b"+e+"\\b").test(t.className||"")}function a(t,e){return new RegExp("\\b"+e+"\\b").test(t.className||e)||(t.className+=" "+e),t}function n(t,e,i){return(i=new RegExp("\\b("+e+")\\b"))&&i.test(t.className||"")&&(t.className=t.className.replace(i,"")),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 r(t,e){if(Object.assign)return Object.assign({},t,e||{});var i=Object.constructor();for(var a in t)i[a]=a in e?e[a]:t[a];return i}function l(t){return t.charAt(0).toUpperCase()+t.slice(1)}function d(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 u=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 u(t[n],e));return 1===i.length?i[0]:0!==i.length&&i}if(!(t instanceof Element))return!1;if(!(this instanceof u))return new u(t,e);if(u.inst[t.getAttribute("data-tail-datetime")])return u.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=r(e,s))}return this.e=t,this.id=++u.count,this.con=r(u.defaults,e),(u.inst["tail-"+this.id]=this).init()};return u.version="0.4.4",u.status="beta",u.count=0,u.inst={},u.defaults={animate:!0,classNames:!1,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,timeStepHours:1,timeStepMinutes:5,timeStepSeconds:5,today:!0,tooltips:[],viewDefault:"days",viewDecades:!0,viewYears:!0,viewMonths:!0,viewDays:!0,weekStart:0},u.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"]},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"]},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:["Выберите месяц","Выберите год","Выберите Десятилетие","Выберите время"]},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)}},u.prototype={init:function(){var t,e=this;if(this.__=u.strings[this.con.locale]||u.strings.en,this.con.dateStart=d(this.con.dateStart,!0,!0)||0,this.con.dateEnd=d(this.con.dateEnd,!0,!0)||9999999999999,this.con.viewDefault=this.con.dateFormat?this.con.viewDefault:"time","string"==typeof this.con.weekStart&&(this.con.weekStart=u.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=d(l[n].start||!1,!0,!0))?l[n].start=l[n].end=1/0:(!1===(l[n].end=d(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]=u.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=d(r[n].date[0]||!1,!0,!0),l=d(r[n].date[0]||!1,!0,!0)||s):s=l=d(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=d(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)&&h(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"submit":return this.selectDate(this.fetchDate(parseInt(s[a]("data-date"))));case"cancel":this.con.stayOpen||this.close();break;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"==datePart[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>';return 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),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"+l(e)]||!this.con.dateFormat)return!1;var i=c.createElement("DIV");return i.className="calendar-datepicker calendar-view-"+e,i.innerHTML=this["view"+l(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='<div class="timepicker-field timepicker-hours"><input type="number" name="dt[h]" value="" min="00" max="23" step="'+this.con.timeStepHours+'" /><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="'+this.con.timeStepMinutes+'" /><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="'+this.con.timeStepSeconds+'" /><label>'+this.__.time[2]+"</label></div>",n=c.createElement("DIV");n.className="calendar-timepicker",n.innerHTML=e+i+a;var s=function(t){var e=this.parentElement.parentElement.querySelectorAll("input");r.selectTime(e[0].value,e[1].value,e[2].value)},r=this,o=n.querySelectorAll("input");return o[0].value=this.view.date.getHours(),o[0].addEventListener("input",s),o[1].value=this.view.date.getMinutes(),o[1].addEventListener("input",s),o[2].value=this.view.date.getSeconds(),o[2].addEventListener("input",s),t.querySelector(".calendar-timepicker")?t.replaceChild(n,t.querySelector(".calendar-timepicker")):t.appendChild(n),this.handleLabel(t)},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)}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=[],h=[0,[]],d=[].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)?h=[i<this.con.dateStart?this.con.dateStart:1/0,[0,1,2,3,4,5,6],!0]:0==h[0]?d=d.filter(function(t){return t.start==1/0||i>=t.start&&i<=t.end?!(h=[t.end,t.days]):t.start>i},this):3==h.length&&(h=[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=h[0]>=i&&0<=h[1].indexOf(s.getDay()))&&this.con.dateBlacklist||!n&&!this.con.dateBlacklist?(t+=" date-disabled",e+=' data-disabled="true"'):0!==h[0]&&h[0]<=i&&(h=[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"+l(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=d(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(!h(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"),!h(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(!h(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 h(this.dt,"calendar-open")?this.close():h(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))}},u}); | ||
/* pytesNET/tail.DateTime @ 0.4.5 © SamBrishes | pytesNET */ | ||
!function(t){"function"==typeof define&&define.amd?define(function(){return t(window)}):(void 0===window.tail&&(window.tail={}),window.tail.DateTime=t(window))}(function(t){"use strict";var o=t,c=t.document;function d(t,e){return new RegExp("\\b"+e+"\\b").test(t.className||"")}function a(t,e){return new RegExp("\\b"+e+"\\b").test(t.className||e)||(t.className+=" "+e),t}function n(t,e,i){return(i=new RegExp("\\b("+e+")\\b"))&&i.test(t.className||"")&&(t.className=t.className.replace(i,"")),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 r(t,e){if(Object.assign)return Object.assign({},t,e||{});var i=Object.constructor();for(var a in t)i[a]=a in e?e[a]:t[a];return i}function l(t){return t.charAt(0).toUpperCase()+t.slice(1)}function h(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 u=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 u(t[n],e));return 1===i.length?i[0]:0!==i.length&&i}if(!(t instanceof Element))return!1;if(!(this instanceof u))return new u(t,e);if(u.inst[t.getAttribute("data-tail-datetime")])return u.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=r(e,s))}return this.e=t,this.id=++u.count,this.con=r(u.defaults,e),(u.inst["tail-"+this.id]=this).init()};return u.version="0.4.5",u.status="beta",u.count=0,u.inst={},u.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},u.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"]},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"]},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:["Выберите месяц","Выберите год","Выберите Десятилетие","Выберите время"]},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)}},u.prototype={init:function(){var t,e=this;if(this.__=u.strings[this.con.locale]||u.strings.en,this.con.dateStart=h(this.con.dateStart,!0,!0)||0,this.con.dateEnd=h(this.con.dateEnd,!0,!0)||9999999999999,this.con.viewDefault=this.con.dateFormat?this.con.viewDefault:"time","string"==typeof this.con.weekStart&&(this.con.weekStart=u.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=h(l[n].start||!1,!0,!0))?l[n].start=l[n].end=1/0:(!1===(l[n].end=h(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]=u.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=h(r[n].date[0]||!1,!0,!0),l=h(r[n].date[0]||!1,!0,!0)||s):s=l=h(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=h(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"submit":return this.selectDate(this.fetchDate(parseInt(s[a]("data-date"))));case"cancel":this.con.stayOpen||this.close();break;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"==datePart[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"+l(e)]||!this.con.dateFormat)return!1;var i=c.createElement("DIV");return i.className="calendar-datepicker calendar-view-"+e,i.innerHTML=this["view"+l(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)}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"+l(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=h(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))}},u}); |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.4 - Beta | ||
| @version 0.4.5 - Beta | ||
| | ||
@@ -106,3 +106,3 @@ | @website https://github.com/pytesNET/tail.DateTime | ||
}; | ||
tailDateTime.version = "0.4.4"; | ||
tailDateTime.version = "0.4.5"; | ||
tailDateTime.status = "beta"; | ||
@@ -118,2 +118,3 @@ tailDateTime.count = 0; | ||
classNames: false, | ||
closeButton: true, | ||
dateFormat: "YYYY-mm-dd", | ||
@@ -133,2 +134,3 @@ dateStart: false, | ||
timeSeconds: 0, | ||
timeIncrement: true, | ||
timeStepHours: 1, | ||
@@ -500,3 +502,3 @@ timeStepMinutes: 5, | ||
| RENDER :: CALENDAR | ||
| @version 0.4.1 [0.4.0] | ||
| @version 0.4.5 [0.4.0] | ||
*/ | ||
@@ -549,2 +551,13 @@ renderCalendar: function(){ | ||
// Render Close Button | ||
if(this.con.closeButton && !_s){ | ||
var close = d.createElement("BUTTON"), self = this; | ||
close.className = "calendar-close"; | ||
close.addEventListener("click", function(event){ | ||
event.preventDefault(); | ||
self.close(); | ||
}); | ||
dt.appendChild(close); | ||
} | ||
// Append Calendar | ||
@@ -588,18 +601,19 @@ if(_s){ | ||
| RENDER :: TIME PICKER | ||
| @version 0.4.3 [0.4.0] | ||
| @version 0.4.5 [0.4.0] | ||
*/ | ||
renderTimePicker: function(dt){ | ||
if(!this.con.timeFormat){ return false; } | ||
var h ='<div class="timepicker-field timepicker-hours">' | ||
+ '<input type="number" name="dt[h]" value="" min="00" max="23" step="' + this.con.timeStepHours + '" />' | ||
+ '<label>' + this.__["time"][0] + '</label>' | ||
+ '</div>', | ||
m = '<div class="timepicker-field timepicker-minutes">' | ||
+ '<input type="number" name="dt[m]" value="" min="00" max="59" step="' + this.con.timeStepMinutes + '" />' | ||
+ '<label>' + this.__["time"][1] + '</label>' | ||
+ '</div>', | ||
s = '<div class="timepicker-field timepicker-seconds">' | ||
+ '<input type="number" name="dt[s]" value="" min="00" max="59" step="' + this.con.timeStepSeconds + '" />' | ||
+ '<label>' + this.__["time"][2] + '</label>' | ||
+ '</div>'; | ||
var h = this.con.timeStepHours, m = this.con.timeStepMinutes, s = this.con.timeStepSeconds; | ||
h ='<div class="timepicker-field timepicker-hours">' | ||
+ '<input type="number" name="dt[h]" value="" min="00" max="23" step="' + h + '" />' | ||
+ '<label>' + this.__["time"][0] + '</label>' | ||
+ '</div>', | ||
m = '<div class="timepicker-field timepicker-minutes">' | ||
+ '<input type="number" name="dt[m]" value="" min="00" max="59" step="' + m + '" />' | ||
+ '<label>' + this.__["time"][1] + '</label>' | ||
+ '</div>', | ||
s = '<div class="timepicker-field timepicker-seconds">' | ||
+ '<input type="number" name="dt[s]" value="" min="00" max="59" step="' + s + '" />' | ||
+ '<label>' + this.__["time"][2] + '</label>' | ||
+ '</div>'; | ||
@@ -612,12 +626,9 @@ // Render View | ||
// Set Data | ||
var selectTime = function(event){ | ||
var time = this.parentElement.parentElement.querySelectorAll("input"); | ||
self.selectTime(time[0].value, time[1].value, time[2].value); | ||
}, self = this, inp = div.querySelectorAll("input"); | ||
inp[0].value = this.view.date.getHours(); | ||
inp[0].addEventListener("input", selectTime); | ||
inp[1].value = this.view.date.getMinutes(); | ||
inp[1].addEventListener("input", selectTime); | ||
inp[2].value = this.view.date.getSeconds(); | ||
inp[2].addEventListener("input", selectTime); | ||
var self = this, inp = div.querySelectorAll("input"); | ||
for(var l = ["Hours", "Minutes", "Seconds"], i = 0; i < 3; i++){ | ||
inp[i].value = this.view.date["get" + l[i]](); | ||
inp[i].disabled = (this.con["time" + l[i]] === false); | ||
inp[i].addEventListener("input", function(ev){ self.handleTime.call(self, ev, this) }); | ||
inp[i].addEventListener("keydown", function(ev){ self.handleTime.call(self, ev, this) }); | ||
} | ||
@@ -634,2 +645,39 @@ // Append Element | ||
/* | ||
| HANDLE :: TIME FIELDs | ||
| @version 0.4.5 [0.4.5] | ||
*/ | ||
handleTime: function(event, element){ | ||
var min = parseInt(element.getAttribute("min")), | ||
max = parseInt(element.getAttribute("max")), | ||
step = parseInt(element.getAttribute("step")), | ||
value = parseInt(element.value), action = "none"; | ||
if((event.keyCode || event.which) == 38 || value > max){ | ||
var action = "up"; | ||
} if((event.keyCode || event.which) == 40 || value < min){ | ||
var action = "down"; | ||
} | ||
// Increase Time | ||
if(action == "up" && value + step > max){ | ||
var add = 1; | ||
element.value = value - (max+1); | ||
} else if(action == "down" && value - step < 0){ | ||
var add = -1; | ||
element.value = (max+1) + value; | ||
} | ||
if(add && this.con.timeIncrement && element.parentElement.previousElementSibling){ | ||
var next = element.parentElement.previousElementSibling.querySelector("input"); | ||
if(next.disabled === false){ | ||
next.value = parseInt(next.value) + add; | ||
return this.handleTime({}, next); | ||
} | ||
} | ||
// Set Time | ||
var time = element.parentElement.parentElement.querySelectorAll("input"); | ||
this.selectTime(time[0].value, time[1].value, time[2].value); | ||
}, | ||
/* | ||
| VIEW :: HANDLE LABEL | ||
@@ -636,0 +684,0 @@ | @version 0.4.0 [0.4.0] |
@@ -1,2 +0,2 @@ | ||
/* pytesNET/tail.DateTime @ 0.4.4 © SamBrishes | pytesNET */ | ||
!function(t){"function"==typeof define&&define.amd?define(function(){return t(window)}):(void 0===window.tail&&(window.tail={}),window.tail.DateTime=t(window))}(function(t){"use strict";var o=t,c=t.document;function d(t,e){return new RegExp("\\b"+e+"\\b").test(t.className||"")}function a(t,e){return new RegExp("\\b"+e+"\\b").test(t.className||e)||(t.className+=" "+e),t}function s(t,e,i){return(i=new RegExp("\\b("+e+")\\b"))&&i.test(t.className||"")&&(t.className=t.className.replace(i,"")),t}function n(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 r(t,e){if(Object.assign)return Object.assign({},t,e||{});var i=Object.constructor();for(var a in t)i[a]=a in e?e[a]:t[a];return i}function l(t){return t.charAt(0).toUpperCase()+t.slice(1)}function h(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 u=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,s=0;s<a;s++)i.push(new u(t[s],e));return 1===i.length?i[0]:0!==i.length&&i}if(!(t instanceof Element))return!1;if(!(this instanceof u))return new u(t,e);if(u.inst[t.getAttribute("data-tail-datetime")])return u.inst[t.getAttribute("data-tail-datetime")];if(t.getAttribute("data-datetime")){var n=JSON.parse(t.getAttribute("data-datetime").replace(/\'/g,'"'));n instanceof Object&&(e=r(e,n))}return this.e=t,this.id=++u.count,this.con=r(u.defaults,e),(u.inst["tail-"+this.id]=this).init()};return u.version="0.4.4",u.status="beta",u.count=0,u.inst={},u.defaults={animate:!0,classNames:!1,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,timeStepHours:1,timeStepMinutes:5,timeStepSeconds:5,today:!0,tooltips:[],viewDefault:"days",viewDecades:!0,viewYears:!0,viewMonths:!0,viewDays:!0,weekStart:0},u.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)}},u.prototype={init:function(){var t,e=this;if(this.__=u.strings[this.con.locale]||u.strings.en,this.con.dateStart=h(this.con.dateStart,!0,!0)||0,this.con.dateEnd=h(this.con.dateEnd,!0,!0)||9999999999999,this.con.viewDefault=this.con.dateFormat?this.con.viewDefault:"time","string"==typeof this.con.weekStart&&(this.con.weekStart=u.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,s=0;s<a;s++)l[s]instanceof Object&&(l[s].start||l[s].days)&&(!1===(l[s].start=h(l[s].start||!1,!0,!0))?l[s].start=l[s].end=1/0:(!1===(l[s].end=h(l[s].end||!1,!0,!0))&&(l[s].end=l[s].start),l[s].start=l[s].start>l[s].end?[l[s].end,l[s].end=l[s].start][0]:l[s].start),l[s].days=!("days"in l[s])||l[s].days,l[s].days="boolean"!=typeof l[s].days?function(t){for(var e=[],i=t.length,a=0;a<i;a++)"string"==typeof t[a]&&(t[a]=u.strings.en.shorts.indexOf(t[a])),0<=t[a]&&t[a]<=6&&e.push(t[a]);return e}(l[s].days instanceof Array?l[s].days:[l[s].days]):[0,1,2,3,4,5,6],i.push({start:l[s].start,end:l[s].end,days:l[s].days}));this.con.dateRanges=i}if(0<this.con.tooltips.length){i=[];var n,r=this.con.tooltips;for(a=r.length,s=0;s<a;s++)r[s]instanceof Object&&r[s].date&&(r[s].date instanceof Array?(n=h(r[s].date[0]||!1,!0,!0),l=h(r[s].date[0]||!1,!0,!0)||n):n=l=h(r[s].date||!1,!0,!0),n&&i.push({date:n!==l?[n,l]:n,text:r[s].text||"Tooltip",color:r[s].color||"inherit",element:r[s].element||(t=c.createElement("DIV"),t.className="calendar-tooltip",t.innerHTML='<div class="tooltip-inner">'+r[s].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(s=0;s<7;s++)this.weekdays+='<th class="calendar-week">'+o[s]+"</th>";this.weekdays+="\n</tr>\n</thead>",this.select=h(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"],s=0;s<3;s++)"number"==typeof this.con["time"+a[s]]&&this.view.date["set"+a[s]](this.con["time"+a[s]]);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",s="data-action",n=i[a](s)?i:i.parentElement[a](s)?i.parentElement:i,r="data-tooltip";if("mouseover"==t.type&&(!1!==(e=i[a](r)?i:!!n[a](r)&&n)?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(!n||1!=t.buttons&&1!=(t.which||t.button))return;if(n.hasAttribute("data-disabled"))return;switch(n[a](s)){case"prev":case"next":return this.browseView(n[a](s));case"submit":return this.selectDate(this.fetchDate(parseInt(n[a]("data-date"))));case"cancel":this.con.stayOpen||this.close();break;case"view":return this.switchDate(n[a]("data-year")||null,n[a]("data-month")||null,n[a]("data-day")||null),this.switchView(n[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&&(n(this.e,"input",e),n(this.e,"change",e)),n(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,s=0;s<a;++s)t[s-1]=e[s];return t[s]=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),s=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 n=s.top-(this.dt.offsetHeight+a),r=s.left+s.width/2-(this.dt.offsetWidth/2+i/2);break;case"left":n=s.top+s.height/2-(this.dt.offsetHeight/2+a),r=s.left-(this.dt.offsetWidth+i);break;case"right":n=s.top+s.height/2-(this.dt.offsetHeight/2+a),r=s.left+s.width;break;default:n=s.top+s.height,r=s.left+s.width/2-(this.dt.offsetWidth/2+i/2)}return t.top=(0<=n?n: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"==datePart[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 s=this.con.rtl;if((!0===s||"auto"===s&&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 n='<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)n='<span class="action action-submit" data-action="submit"></span><span class="label"></span><span class="action action-cancel" data-action="cancel"></span>';return void 0!==n&&(i.innerHTML='<div class="calendar-actions">'+n+"</div>"),this.con.dateFormat&&this.renderDatePicker(i,this.con.viewDefault),this.con.timeFormat&&this.renderTimePicker(i),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"+l(e)]||!this.con.dateFormat)return!1;var i=c.createElement("DIV");return i.className="calendar-datepicker calendar-view-"+e,i.innerHTML=this["view"+l(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='<div class="timepicker-field timepicker-hours"><input type="number" name="dt[h]" value="" min="00" max="23" step="'+this.con.timeStepHours+'" /><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="'+this.con.timeStepMinutes+'" /><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="'+this.con.timeStepSeconds+'" /><label>'+this.__.time[2]+"</label></div>",s=c.createElement("DIV");s.className="calendar-timepicker",s.innerHTML=e+i+a;var n=function(t){var e=this.parentElement.parentElement.querySelectorAll("input");r.selectTime(e[0].value,e[1].value,e[2].value)},r=this,o=s.querySelectorAll("input");return o[0].value=this.view.date.getHours(),o[0].addEventListener("input",n),o[1].value=this.view.date.getMinutes(),o[1].addEventListener("input",n),o[2].value=this.view.date.getSeconds(),o[2].addEventListener("input",n),t.querySelector(".calendar-timepicker")?t.replaceChild(s,t.querySelector(".calendar-timepicker")):t.appendChild(s),this.handleLabel(t)},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)}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,s,n=[],r=[],o=1;o<=16;o++)a="calendar-decade"+(i>=e.getYear()&&i<=e.getYear()+10?" date-today":""),s='data-action="view" data-view="down" data-year="'+e.getFullYear()+'"',n.push('<td class="'+a+'" '+s+'><span class="inner">'+e.getFullYear()+" - "+(e.getFullYear()+10)+"</span></td>"),4<=o&&o%4==0&&(r.push("<tr>\n"+n.join("\n")+"\n</tr>"),n=[]),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,s,n=[],r=[],o=1;o<=16;o++)a="calendar-year"+(e.getYear()==i?" date-today":""),s='data-action="view" data-view="down" data-year="'+e.getFullYear()+'"',n.push('<td class="'+a+'" '+s+'><span class="inner">'+e.getFullYear()+"</span></td>"),4<=o&&o%4==0&&(r.push("<tr>\n"+n.join("\n")+"\n</tr>"),n=[]),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,s=[],n=[],r=0;r<12;r++)i="calendar-month"+(e==r?" date-today":""),a='data-action="view" data-view="down" data-month="'+r+'"',s.push('<td class="'+i+'" '+a+'><span class="inner">'+t[r]+"</span></td>"),3==s.length&&(n.push("<tr>\n"+s.join("\n")+"\n</tr>"),s=[]);return'<table class="calendar-months"><thead><tr><th colspan="3">'+this.__.header[0]+"</th></tr></thead><tbody>"+n.join("\n")+"</tbody></table>"},viewDays:function(){var i,t,e,a,s,n=new Date(this.view.date.getTime()),r=(new Date).toDateString(),o=n.getMonth(),l=[],c=[],d=[0,[]],h=[].concat(this.con.dateRanges),u=([].concat(this.con.tooltips),[0,0]);for(n.setHours(0,0,0,0),n.setDate(1),n.setDate(1-(n.getDay()-this.con.weekStart));c.length<6;)i=n.getTime(),e='data-action="submit" data-date="'+n.getTime()+'"',t="calendar-day date-"+(n.getMonth()>o?"next":n.getMonth()<o?"previous":"current"),this.con.today&&r==n.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]),(s=d[0]>=i&&0<=d[1].indexOf(n.getDay()))&&this.con.dateBlacklist||!s&&!this.con.dateBlacklist?(t+=" date-disabled",e+=' data-disabled="true"'):0!==d[0]&&d[0]<=i&&(d=[0,[]]),this.select&&this.select.toDateString()==n.toDateString()&&(t+=" date-select"),a='<span class="inner">'+n.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=[]),n.setDate(n.getDate()+1);return c="<tbody>"+c.join("\n")+"</tbody>",'<table class="calendar-days">'+this.weekdays+c+"</table>"},showTooltip:function(t,e,i){var a,s=this.con.tooltips[t].element,n=s.style,r=this.dt.querySelector(".calendar-datepicker");n.cssText="opacity:0;visibility:hidden;",s.id="tooltip-"+t+"-"+i,r.appendChild(s),a=s.offsetWidth,s.offsetHeight,n.top=e.offsetTop+e.offsetHeight+"px",n.left=e.offsetLeft+e.offsetWidth/2-a/2+"px",n.visibility="visible",this.con.animate?(s.setAttribute("data-top",parseInt(n.top)),n.top=parseInt(n.top)+5+"px",function t(){parseFloat(n.top)>s.getAttribute("data-top")&&(n.top=parseFloat(n.top)-.5+"px"),(n.opacity=parseFloat(n.opacity)+.125)<1&&setTimeout(t,20)}()):n.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"+l(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 s=this.view.date,n=new Date;i=s.getMonth()==n.getMonth()&&s.getYear()==n.getYear()?n.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=h(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,s,n){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),s||(null==s?this.view.date.getMinutes():0),n||(null==n?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(s(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(s(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(s(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(s(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))}},u}); | ||
/* pytesNET/tail.DateTime @ 0.4.5 © SamBrishes | pytesNET */ | ||
!function(t){"function"==typeof define&&define.amd?define(function(){return t(window)}):(void 0===window.tail&&(window.tail={}),window.tail.DateTime=t(window))}(function(t){"use strict";var o=t,c=t.document;function d(t,e){return new RegExp("\\b"+e+"\\b").test(t.className||"")}function a(t,e){return new RegExp("\\b"+e+"\\b").test(t.className||e)||(t.className+=" "+e),t}function n(t,e,i){return(i=new RegExp("\\b("+e+")\\b"))&&i.test(t.className||"")&&(t.className=t.className.replace(i,"")),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 r(t,e){if(Object.assign)return Object.assign({},t,e||{});var i=Object.constructor();for(var a in t)i[a]=a in e?e[a]:t[a];return i}function l(t){return t.charAt(0).toUpperCase()+t.slice(1)}function h(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 u=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 u(t[n],e));return 1===i.length?i[0]:0!==i.length&&i}if(!(t instanceof Element))return!1;if(!(this instanceof u))return new u(t,e);if(u.inst[t.getAttribute("data-tail-datetime")])return u.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=r(e,s))}return this.e=t,this.id=++u.count,this.con=r(u.defaults,e),(u.inst["tail-"+this.id]=this).init()};return u.version="0.4.5",u.status="beta",u.count=0,u.inst={},u.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},u.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)}},u.prototype={init:function(){var t,e=this;if(this.__=u.strings[this.con.locale]||u.strings.en,this.con.dateStart=h(this.con.dateStart,!0,!0)||0,this.con.dateEnd=h(this.con.dateEnd,!0,!0)||9999999999999,this.con.viewDefault=this.con.dateFormat?this.con.viewDefault:"time","string"==typeof this.con.weekStart&&(this.con.weekStart=u.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=h(l[n].start||!1,!0,!0))?l[n].start=l[n].end=1/0:(!1===(l[n].end=h(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]=u.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=h(r[n].date[0]||!1,!0,!0),l=h(r[n].date[0]||!1,!0,!0)||s):s=l=h(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=h(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"submit":return this.selectDate(this.fetchDate(parseInt(s[a]("data-date"))));case"cancel":this.con.stayOpen||this.close();break;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"==datePart[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"+l(e)]||!this.con.dateFormat)return!1;var i=c.createElement("DIV");return i.className="calendar-datepicker calendar-view-"+e,i.innerHTML=this["view"+l(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)}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"+l(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=h(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))}},u}); |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.4 - Beta | ||
| @version 0.4.5 - Beta | ||
| | ||
@@ -58,2 +58,9 @@ | @website https://github.com/pytesNET/tail.DateTime | ||
}); | ||
datetime.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"] | ||
}); | ||
datetime.strings.register("pt_BR", { | ||
@@ -60,0 +67,0 @@ months: ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"], |
@@ -1,2 +0,2 @@ | ||
/* pytesNET/tail.DateTime @ 0.4.4 © SamBrishes | pytesNET */ | ||
!function(n){"function"==typeof define&&define.amd?define(function(){return function(e){n(e)}}):void 0!==window.tail&&window.tail.DateTime&&n(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("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("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}); | ||
/* pytesNET/tail.DateTime @ 0.4.5 © SamBrishes | pytesNET */ | ||
!function(n){"function"==typeof define&&define.amd?define(function(){return function(e){n(e)}}):void 0!==window.tail&&window.tail.DateTime&&n(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("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("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}); |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.4 - Beta | ||
| @version 0.4.5 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.4 - Beta | ||
| @version 0.4.5 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.4 - Beta | ||
| @version 0.4.5 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.4 - Beta | ||
| @version 0.4.5 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.4 - Beta | ||
| @version 0.4.5 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.4 - Beta | ||
| @version 0.4.5 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
@@ -5,3 +5,3 @@ /* | ||
| @author SamBrishes <sam@pytes.net> | ||
| @version 0.4.4 - Beta | ||
| @version 0.4.5 - Beta | ||
| | ||
@@ -8,0 +8,0 @@ | @website https://github.com/pytesNET/tail.DateTime |
{ | ||
"name": "tail.datetime", | ||
"version": "0.4.4", | ||
"version": "0.4.5", | ||
"description": "A light-weight, translat- and configurable Open Source DateTime Picker, written in pure vanilla JavaScript!", | ||
@@ -20,3 +20,4 @@ "main": "js/tail.datetime.js", | ||
"homepage": "https://github.com/pytesNET/tail.DateTime", | ||
"reveal": true | ||
"reveal": true, | ||
"jsdelivr": "js/tail.datetime.full.js" | ||
} |
@@ -71,4 +71,5 @@ tail.DateTime | ||
- [Mohammed Alsiddeeq Ahmed](https://github.com/mosid) / [Arabic Translation](https://github.com/pytesNET/tail.DateTime/issues/1) | ||
- [Júnior Garcia](https://github.com/juniorgarcia) / [Brazilian Portuguese Translation](https://github.com/pytesNET/tail.DateTime/issues/13) | ||
- [mickeybyte](https://github.com/mickeybyte) / [Dutch Translation](https://github.com/pytesNET/tail.DateTime/issues/15) | ||
- [Fabio Di Stasio](https://github.com/Fabio286) / [Italian Translation](https://github.com/pytesNET/tail.DateTime/issues/10) | ||
- [Júnior Garcia](https://github.com/juniorgarcia) / [Brazilian Portuguese Translation](https://github.com/pytesNET/tail.DateTime/issues/13) | ||
@@ -123,28 +124,30 @@ Documentation | ||
tail.DateTime(".tail-datetime-field", { | ||
animate: true, // New in 0.4.0 | ||
animate: true, | ||
classNames: false, | ||
closeButton: true, // New in 0.4.5 | ||
dateFormat: "YYYY-mm-dd", | ||
dateStart: false, // New in 0.4.0 | ||
dateRanges: [], // New Syntax in 0.4.0 | ||
dateBlacklist: true, // New in 0.4.0 | ||
dateEnd: false, // New in 0.4.0 | ||
locale: "en", // New in 0.4.0 | ||
dateStart: false, | ||
dateRanges: [], | ||
dateBlacklist: true, | ||
dateEnd: false, | ||
locale: "en", | ||
position: "bottom", | ||
rtl: "auto", // New in 0.4.1 | ||
rtl: "auto", | ||
startOpen: false, | ||
stayOpen: false, | ||
timeFormat: "HH:ii:ss", | ||
timeHours: null, // New in 0.4.0 | ||
timeMinutes: null, // New in 0.4.0 | ||
timeSeconds: 0, // New in 0.4.0 | ||
timeStepHours: 1, // New in 0.4.3 | ||
timeHours: null, // New Syntax in 0.4.5 | ||
timeMinutes: null, // New Syntax in 0.4.5 | ||
timeSeconds: 0, // New Syntax in 0.4.5 | ||
timeIncrement: true, // New in 0.4.5 | ||
timeStepHours: 1, | ||
timeStepMinutes: 5, // New in 0.4.3 | ||
timeStepSeconds: 5, // New in 0.4.3 | ||
today: true, // New in 0.4.0 | ||
tooltips: [], // New in 0.4.0 | ||
viewDefault: "days", // New in 0.4.0 | ||
viewDecades: true, // New in 0.4.0 | ||
viewYears: true, // New in 0.4.0 | ||
viewMonths: true, // New in 0.4.0 | ||
viewDays: true, // New in 0.4.0 | ||
today: true, | ||
tooltips: [], | ||
viewDefault: "days", | ||
viewDecades: true, | ||
viewYears: true, | ||
viewMonths: true, | ||
viewDays: true, | ||
weekStart: 0 | ||
@@ -151,0 +154,0 @@ }); |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
273992
29
4090
158
0