tail.datetime
Advanced tools
Comparing version 0.3.3 to 0.3.4
CHANGELOG | ||
========= | ||
Version 0.3.4 - Alpha | ||
--------------------- | ||
- Info: Official support for IE >= 9 starts now :( | ||
- Add: New `clone()` helper function as Fallback for IE >= 9. | ||
- Add: New `.IE` helper variable for Fallback use for IE >= 9. | ||
- Bugfix: Almost complete IE >= 9 support. | ||
Version 0.3.3 - Alpha | ||
@@ -5,0 +12,0 @@ --------------------- |
@@ -5,3 +5,3 @@ /* | ||
| MrGuiseppe <https://github.com/MrGuiseppe/pureJSCalendar/> | ||
| @version 0.3.3 [0.1.0] - Alpha | ||
| @version 0.3.4 [0.1.0] - Alpha | ||
| | ||
@@ -12,5 +12,5 @@ | @license X11 / MIT License | ||
*/ | ||
;(function(w){ | ||
;(function(window){ | ||
"use strict"; | ||
var d = w.document; | ||
var w = window, d = window.document; | ||
@@ -21,14 +21,13 @@ /* | ||
var tail = { | ||
hasClass: function(element, classname){ | ||
var regex = new RegExp("(|\s+)" + classname + "(\s+|)"); | ||
return regex.test(element.className); | ||
hasClass: function(element, name){ | ||
return (new RegExp("(|\s+)" + name + "(\s+|)")).test(element.className); | ||
}, | ||
addClass: function(element, classname){ | ||
if(!this.hasClass(element, classname)){ | ||
element.className = (element.className.trim() + " " + classname.trim()).trim(); | ||
addClass: function(element, name){ | ||
if(!(new RegExp("(|\s+)" + name + "(\s+|)")).test(element.className)){ | ||
element.className = (element.className.trim() + " " + name.trim()).trim(); | ||
} | ||
return element; | ||
}, | ||
removeClass: function(element, classname){ | ||
var regex = new RegExp("(|\s+)(" + classname + ")(\s+|)"); | ||
removeClass: function(element, name){ | ||
var regex = new RegExp("(|\s+)(" + name + ")(\s+|)"); | ||
if(regex.test(element.className)){ | ||
@@ -40,3 +39,3 @@ element.className = (element.className.replace(regex, "$1$3")).trim(); | ||
trigger: function(element, event, options){ | ||
if(CustomEvent && typeof(CustomEvent) !== "undefined"){ | ||
if(CustomEvent && CustomEvent.name){ | ||
var e = new CustomEvent(event, options); | ||
@@ -48,4 +47,17 @@ return element.dispatchEvent(e); | ||
return element.dispatchEvent(e); | ||
}, | ||
clone: function(object, replace){ | ||
replace = (typeof(replace) == "object")? replace: {}; | ||
var clone = object.constructor(); | ||
for(var key in object){ | ||
if(replace.hasOwnProperty(key)){ | ||
clone[key] = replace[key]; | ||
} else if(object.hasOwnProperty(key)){ | ||
clone[key] = object[key]; | ||
} | ||
} | ||
return clone; | ||
} | ||
}; | ||
tail.IE = (w.navigator.userAgent.indexOf("MSIE") > -1 || w.navigator.userAgent.indexOf("Edge") > -1); | ||
@@ -55,3 +67,3 @@ /* | ||
| @since 0.1.0 | ||
| @update 0.3.3 | ||
| @update 0.3.4 | ||
*/ | ||
@@ -116,9 +128,14 @@ var tailDateTime = function(element, config){ | ||
this.e = element; | ||
this.con = Object.assign({}, tailDateTime.defaults, (typeof(config) == "object")? config: {}); | ||
config = (typeof(config) == "object")? config: {}; | ||
if(Object.assign){ | ||
this.con = Object.assign({}, tailDateTime.defaults, config); | ||
} else { | ||
this.con = tail.clone(tailDateTime.defaults, config); | ||
} | ||
return this.init(); | ||
}; | ||
tailDateTime.version = "0.3.3"; | ||
tailDateTime.version = "0.3.4"; | ||
tailDateTime.status = "alpha"; | ||
tailDateTime.count = 0; | ||
tailDateTime.isIE11 = !!window.MSInputMethodContext && !!document.documentMode; | ||
tailDateTime.isIE11 = !!w.MSInputMethodContext && !!d.documentMode; | ||
tailDateTime.cache = {}; | ||
@@ -597,3 +614,3 @@ tailDateTime.instances = {}; | ||
| @since 0.1.0 | ||
| @update 0.3.1 | ||
| @update 0.3.4 | ||
*/ | ||
@@ -610,15 +627,17 @@ open: function(){ | ||
this.calcPosition(); | ||
this.animate = setInterval(function(self){ | ||
self.dt.style.opacity = parseFloat(self.dt.style.opacity) + 0.1; | ||
if(parseFloat(self.dt.style.opacity) >= 1){ | ||
tail.removeClass(self.dt, "calendar-idle"); | ||
tail.addClass(self.dt, "calendar-open"); | ||
tail.trigger(self.dt, "tail.DateTime::open", { | ||
bubbles: false, | ||
cancelable: true, | ||
detail: self | ||
}); | ||
clearInterval(self.animate); | ||
} | ||
}, 10, this); | ||
(function(self){ | ||
self.animate = setInterval(function(){ | ||
self.dt.style.opacity = parseFloat(self.dt.style.opacity) + 0.1; | ||
if(parseFloat(self.dt.style.opacity) >= 1){ | ||
tail.removeClass(self.dt, "calendar-idle"); | ||
tail.addClass(self.dt, "calendar-open"); | ||
tail.trigger(self.dt, "tail.DateTime::open", { | ||
bubbles: false, | ||
cancelable: true, | ||
detail: self | ||
}); | ||
clearInterval(self.animate); | ||
} | ||
}, 10); | ||
})(this); | ||
return this; | ||
@@ -630,3 +649,3 @@ }, | ||
| @since 0.1.0 | ||
| @update 0.3.0 | ||
| @update 0.3.4 | ||
*/ | ||
@@ -639,17 +658,18 @@ close: function(){ | ||
tail.addClass(this.dt, "calendar-idle"); | ||
this.animate = setInterval(function(self){ | ||
self.dt.style.opacity = parseFloat(self.dt.style.opacity) - 0.1; | ||
if(parseFloat(self.dt.style.opacity) <= 0){ | ||
tail.removeClass(self.dt, "calendar-idle"); | ||
tail.addClass(self.dt, "calendar-close"); | ||
tail.trigger(self.dt, "tail.DateTime::close", { | ||
bubbles: false, | ||
cancelable: true, | ||
detail: self | ||
}); | ||
self.dt.style.display = "none"; | ||
clearInterval(self.animate); | ||
} | ||
}, 10, this); | ||
(function(self){ | ||
self.animate = setInterval(function(){ | ||
self.dt.style.opacity = parseFloat(self.dt.style.opacity) - 0.1; | ||
if(parseFloat(self.dt.style.opacity) <= 0){ | ||
tail.removeClass(self.dt, "calendar-idle"); | ||
tail.addClass(self.dt, "calendar-close"); | ||
tail.trigger(self.dt, "tail.DateTime::close", { | ||
bubbles: false, | ||
cancelable: true, | ||
detail: self | ||
}); | ||
self.dt.style.display = "none"; | ||
clearInterval(self.animate); | ||
} | ||
}, 10); | ||
})(this); | ||
return this; | ||
@@ -770,3 +790,3 @@ }, | ||
| @since 0.1.0 | ||
| @update 0.3.3 | ||
| @update 0.3.4 | ||
*/ | ||
@@ -819,7 +839,14 @@ createCalendar: function(month, year){ | ||
for(var i = 0; i < calendar.length; i++){ | ||
calendar[i] = '<tr><td class="calendar-day">' + calendar[i].join('</td><td class="calendar-day">') + '</td></tr>'; | ||
calendar[i] = '<tr>\n<td class="calendar-day">' + calendar[i].join('</td>\n<td class="calendar-day">') + '</td>\n</tr>'; | ||
} | ||
var render = document.createElement("table"); | ||
render.className = "calendar-current"; | ||
render.innerHTML = calendar.join(""); | ||
if(tail.IE){ | ||
var inner = "<table><tbdy>" + calendar.join("") + "</tbody></table>"; | ||
var render = d.createElement("div"); | ||
render.innerHTML = inner; | ||
render = render.getElementsByTagName("table")[0]; | ||
} else { | ||
var render = d.createElement("table"); | ||
render.className = "calendar-current"; | ||
render.innerHTML = calendar.join(""); | ||
} | ||
@@ -845,5 +872,4 @@ // Empty Fields | ||
this.view.date.setFullYear(year); | ||
this.view = tailDateTime.cache[this.con.weekStart + "_" + year][month] = Object.assign({}, this.view, { | ||
content: render | ||
}); | ||
this.view = tail.clone(this.view, {content: render}); | ||
tailDateTime.cache[this.con.weekStart + "_" + year][month] = this.view; | ||
return tailDateTime.cache[this.con.weekStart + "_" + year][month]; | ||
@@ -903,2 +929,3 @@ }, | ||
w.tail.DateTime = tailDateTime; | ||
return w.tail.DateTime | ||
})(this); |
@@ -1,2 +0,2 @@ | ||
/* tail.DateTime 0.3.3 @ https://github.com/pytesNET/tail.DateTime */ | ||
!function(i){"use strict";var n=i.document,c={hasClass:function(t,e){return new RegExp("(|s+)"+e+"(s+|)").test(t.className)},addClass:function(t,e){return this.hasClass(t,e)||(t.className=(t.className.trim()+" "+e.trim()).trim()),t},removeClass:function(t,e){var a=new RegExp("(|s+)("+e+")(s+|)");return a.test(t.className)&&(t.className=t.className.replace(a,"$1$3").trim()),t},trigger:function(t,e,a){if(CustomEvent&&"undefined"!=typeof CustomEvent){var s=new CustomEvent(e,a);return t.dispatchEvent(s)}return(s=n.createEvent("CustomEvent")).initCustomEvent(e,!!a.bubbles,!!a.cancelable,a.detail),t.dispatchEvent(s)}},h=function(t,e){if("string"==typeof t&&(t=n.querySelectorAll(t)),t instanceof NodeList||t instanceof HTMLCollection){if(0==t.length)return!1;for(var a=new Array,s=0;s<t.length;s++)a.push(new h(t[s],e));return 1==a.length?a[0]:a}if(void 0===this)return new h(t,e);if(!(t instanceof Element))return!1;if(t.hasAttribute("data-tail-calendar")&&h.instances[t.getAttribute("data-tail-calendar")])return h.instances[t.getAttribute("data-tail-calendar")];if(e.dateRanges&&0<e.dateRanges.length){var i;for(s=0;s<e.dateRanges.length;s++)"string"==typeof(i=e.dateRanges[s])[0]&&0<=u("shorts").indexOf(i[0])?(i[0]=u("shorts").indexOf(i[0]),i[1]=2<=i.length&&0<=u("shorts").indexOf(i[1])?u("shorts").indexOf(i[1]):6):("string"==typeof i[0]&&(i[0]=new Date(Date.parse(i[0])),2==i.length&&"string"==typeof i[1]?i[1]=new Date(Date.parse(i[1])):1==i.length&&(i[1]=new Date(i[0].getFullYear(),i[0].getMonth(),0))),i[0]instanceof Date&&!isNaN(i[0].getDate())||(i[0]=new Date),(i.length<2||!(i[1]instanceof Date)||isNaN(i[1].getDate()))&&(i[1]=new Date(i[0].getFullYear(),i[0].getMonth(),0)))}return this.e=t,this.con=Object.assign({},h.defaults,"object"==typeof e?e:{}),this.init()};h.version="0.3.3",h.status="alpha",h.count=0,h.isIE11=!!window.MSInputMethodContext&&!!document.documentMode,h.cache={},h.instances={},h.defaults={static:null,position:"bottom",classNames:"",dateFormat:"YYYY-mm-dd",timeFormat:"HH:ii:ss",dateRanges:[],weekStart:"SUN",startOpen:!1,stayOpen:!1,zeroSeconds:!1},h.strings={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 Time"]};var u=function(t,e){return t in i.tail.DateTime.strings&&(void 0!==e?i.tail.DateTime.strings[t][e]:i.tail.DateTime.strings[t])};h.prototype={e:null,dt:null,con:{},view:{},select:null,init:function(){if(this.dt)return this.dt;var t=n.querySelector(this.con.static);this.dt=n.createElement("DIV"),this.dt.id="data-tail-calendar-"+ ++h.count,this.dt.className="tail-datetime-calendar calendar-close"+(t?" calendar-static":""),this.con.stayOpen&&(this.dt.className+=" calendar-stay"),this.con.classNames&&(this.dt.className+=" "+(this.con.classNames instanceof Array?this.con.classNames.join(" "):this.con.classNames)),this.con.dateFormat?this.dt.innerHTML='<div class="calendar-navi"> <span data-tail-navi="prev" class="calendar-button button-prev"></span> <span data-tail-navi="switch" class="calendar-label"></span> <span data-tail-navi="next" class="calendar-button button-next"></span></div><div class="calendar-date"></div>'+(this.con.timeFormat?'<div class="calendar-time">'+this.renderTime()+"</div>":""):this.dt.innerHTML='<div class="calendar-navi"> <span data-tail-navi="check" class="calendar-button button-check"></span> <span data-tail-navi="switch" class="calendar-label">'+u("header",2)+'</span> <span data-tail-navi="close" class="calendar-button button-close"></span></div>'+(this.con.timeFormat?'<div class="calendar-time">'+this.renderTime()+"</div>":"");var e=new Date(Date.parse(this.e.getAttribute("data-tail-value")||this.e.value));this.view={type:"date",date:new Date,content:"",render:function(){return this.content.querySelector("tbody").innerHTML}},isNaN(e.getDate())||(this.select=e,this.con.zeroSeconds&&this.select.setSeconds(0),this.view.date=new Date(this.select.getTime())),this.con.timeFormat&&(this.dt.querySelector(".calendar-field-h > input").value=this.view.date.getHours(),this.dt.querySelector(".calendar-field-m > input").value=this.view.date.getMinutes(),this.dt.querySelector(".calendar-field-s > input").value=this.view.date.getSeconds()),this.switchMonth(this.view.date.getMonth(),this.view.date.getFullYear()),this.e.hasAttribute("data-tail-value")?this.selectDate():this.e.setAttribute("data-tail-value",this.convertDate(this.view.date,"YYYY-mm-dd HH:ii:ss")),this.dt.style.top=0,this.dt.style.left=0,this.dt.style.zIndex=99,this.dt.style.position=t?"static":"absolute",this.dt.style.visibility=t?"visible":"hidden",t?t.appendChild(this.dt):n.getElementsByTagName("body")[0].appendChild(this.dt);var s=this,a=this.dt.querySelectorAll("[data-tail-navi]");if(0<a.length)for(var i=0;i<a.length;i++)a[i].addEventListener("click",function(t){var e=this.getAttribute("data-tail-navi");s.con.dateFormat?"month"==s.view.type?"prev"==e||"next"==e?s.switchYear.call(s,e):s.switchView.call(s,"day"):"prev"==e||"next"==e?s.switchMonth.call(s,e):s.switchView.call(s,"month"):s.con.timeFormat&&("check"==e&&s.selectTime.call(s,parseInt(s.dt.querySelector(".calendar-field-h > input").value),parseInt(s.dt.querySelector(".calendar-field-m > input").value),parseInt(s.dt.querySelector(".calendar-field-s > input").value)),s.con.stayOpen||s.close.call(s))});return this.e.addEventListener("focusin",function(t){s.open.call(s)}),this.e.addEventListener("focusout",function(t){var e=new Date(Date.parse(this.value));isNaN(e.getDate())||(s.selectDate.call(s,e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds()),s.switchMonth.call(s,e.getMonth(),e.getFullYear()))}),this.e.addEventListener("keyup",function(t){if(13==t.keyCode){var e=new Date(Date.parse(this.value));isNaN(e.getDate())||(s.selectDate.call(s,e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds()),s.switchMonth.call(s,e.getMonth(),e.getFullYear())),t.stopPropagation()}}),n.addEventListener("keyup",function(t){if(c.hasClass(s.dt,"calendar-open")&&27==t.keyCode&&(s.con.stayOpen||s.close.call(s),s.e.blur()),c.hasClass(s.dt,"calendar-open")&&13==t.keyCode){if(s.con.dateFormat){var e=s.dt.children[1].querySelector("td.today")||s.dt.children[1].querySelector("td:not(.empty)"),a=!!s.con.timeFormat;c.hasClass(e,"disabled")||s.selectDate.call(s,s.view.year,s.view.month,parseInt(e.value),a?parseInt(s.dt.querySelector(".calendar-field-h > input").value):0,a?parseInt(s.dt.querySelector(".calendar-field-m > input").value):0,a?parseInt(s.dt.querySelector(".calendar-field-s > input").value):0)}else s.selectTime.call(s,parseInt(s.dt.querySelector(".calendar-field-h > input").value),parseInt(s.dt.querySelector(".calendar-field-m > input").value),parseInt(s.dt.querySelector(".calendar-field-s > input").value));s.con.stayOpen||s.close.call(s),s.e.blur()}}),n.addEventListener("click",function(t){c.hasClass(s.dt,"calendar-open")&&(s.dt.contains(t.target)||s.e.contains(t.target)||t.target!=s.dt&&t.target!=s.e&&(s.con.stayOpen||s.close.call(s)))}),this.e.setAttribute("data-tail-calendar","tail-"+h.count),this.con.startOpen&&this.open(),h.instances["tail-"+h.count]=this},calcPosition:function(){if(c.hasClass(this.dt,"calendar-static"))return this;var t=i.getComputedStyle(this.dt),e=parseInt(t.marginLeft)+parseInt(t.marginRight),a=parseInt(t.marginTop)+parseInt(t.marginBottom),s=function(t){for(var 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(this.dt.style.visibility="hidden",this.con.position){case"top":this.dt.style.top=s.top-(this.dt.offsetHeight+a)+"px",this.dt.style.left=s.left+s.width/2-(this.dt.offsetWidth/2+e/2)+"px";break;case"left":this.dt.style.top=s.top+s.height/2-(this.dt.offsetHeight/2+a)+"px",this.dt.style.left=s.left-(this.dt.offsetWidth+e)+"px";break;case"right":this.dt.style.top=s.top+s.height/2-(this.dt.offsetHeight/2+a)+"px",this.dt.style.left=s.left+s.width+"px";break;default:this.dt.style.top=s.top+s.height+"px",this.dt.style.left=s.left+s.width/2-(this.dt.offsetWidth/2+e/2)+"px"}return this.dt.style.visibility="visible",this},switchView:function(t){if(!this.con.dateFormat)return!1;if("month"==(this.view.type=t))this.dt.children[1].innerHTML="",this.dt.children[1].insertAdjacentHTML("afterbegin",this.renderMonth()),this.dt.querySelector(".calendar-label").innerText=this.view.date.getFullYear();else{this.dt.children[1].innerHTML=this.renderDay(),this.dt.querySelector(".calendar-label").innerText=u("months",this.view.date.getMonth())+" "+this.view.date.getFullYear();var e=this.con.dateRanges,a=this.view.date,s=this.dt.querySelectorAll("tbody td:not(.empty)"),i=new Date(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0);if(0<e.length){for(var n=[],l=0;l<e.length;l++)if(e[l][0]instanceof Date){if(a.getYear()>=e[l][0].getYear()&&a.getYear()<=e[l][1].getYear()&&a.getMonth()>=e[l][0].getMonth()&&a.getMonth()<=e[l][1].getMonth())for(var r=0;r<s.length;r++)i.setDate(parseInt(s[r].innerText)),i>=e[l][0]&&i<=e[l][1]&&n.push(s[r].innerText)}else for(r=0;r<s.length;r++)i.setDate(parseInt(s[r].innerText)),3==e[l].length&&1==e[l][3]&&i.getDay()>=e[l][0]&&i.getDay()<=e[l][1]&&-1==n.indexOf(s[r].innerText)&&n.push(s[r].innerText),(i.getDay()<e[l][0]||i.getDay()>e[l][1])&&0<=n.indexOf(s[r].innerText)&&n.splice(n.indexOf(s[r].innerText),1);for(r=0;r<s.length;r++)-1==n.indexOf(s[r].innerText)&&c.addClass(s[r],"disable")}this.select instanceof Date&&this.select.getYear()==this.view.date.getYear()&&this.select.getMonth()==this.view.date.getMonth()?c.addClass(this.dt.querySelectorAll("tbody td:not(.empty)")[this.select.getDate()-1],"current"):this.dt.querySelector("tbody td.current")&&c.removeClass(this.dt.querySelector("tbody td.current"),"current")}var d=this;if(this.con.dateFormat){var o=this.dt.querySelectorAll("tbody td:not(.empty)");for(l=0;l<o.length;l++)o[l].addEventListener("click",function(t){if(t.preventDefault(),t.stopPropagation(),c.hasClass(this,"disable"))return!1;var e=!!d.con.timeFormat;"month"==d.view.type?d.switchMonth.call(d,parseInt(this.getAttribute("data-tail-month")),d.view.date.getFullYear()):(d.selectDate.call(d,d.view.date.getFullYear(),d.view.date.getMonth(),parseInt(this.innerText),e?parseInt(d.dt.querySelector(".calendar-field-h > input").value):0,e?parseInt(d.dt.querySelector(".calendar-field-m > input").value):0,e?parseInt(d.dt.querySelector(".calendar-field-s > input").value):0),d.con.stayOpen||d.close.call(d))})}},renderDay:function(){var t=u("shorts").indexOf(this.con.weekStart),e=u("shorts").slice(t);e=e.concat(u("shorts").slice(0,t));for(var a='<table class="calendar-day"><thead><tr>',s=0;s<7;s++)a+='<th data-tail-day="'+u("shorts").indexOf(e[s])+'">'+e[s]+"</th>";return a+="</tr></thead><tbody>",a+=this.createCalendar(this.view.date.getMonth(),this.view.date.getFullYear()).render(),a+="</tbody></table>"},renderMonth:function(){for(var t=u("months"),e='<table class="calendar-month"><thead><tr><th colspan="4">'+u("header",0)+"</th></tr></thead><tbody>",a=0;a<12;a++)e+="<tr>",e+='<td class="calendar-month" data-tail-month="0"><span>'+t[a++]+"</span></td>",e+='<td class="calendar-month" data-tail-month="1"><span>'+t[a++]+"</span></td>",e+='<td class="calendar-month" data-tail-month="2"><span>'+t[a]+"</span></td>",e+="</tr>";return e+="</tbody></table>"},renderTime:function(){return'<div class="calendar-field calendar-field-h"> <input type="number" value="'+(new Date).getHours()+'" min="00" max="23" step="1" /> <label>'+u("time",0)+'</label></div><div class="calendar-field calendar-field-m"> <input type="number" value="'+(new Date).getMinutes()+'" min="00" max="59" step="1" /> <label>'+u("time",1)+'</label></div><div class="calendar-field calendar-field-s"> <input type="number" value="'+(new Date).getSeconds()+'" min="00" max="59" step="1" /> <label>'+u("time",2)+"</label></div>"},on:function(t,e){this.dt.addEventListener(t,e)},open:function(){return c.hasClass(this.dt,"calendar-close")&&(c.removeClass(this.dt,"calendar-close"),c.addClass(this.dt,"calendar-idle"),this.dt.style.opacity=0,this.dt.style.display="block",this.calcPosition(),this.animate=setInterval(function(t){t.dt.style.opacity=parseFloat(t.dt.style.opacity)+.1,1<=parseFloat(t.dt.style.opacity)&&(c.removeClass(t.dt,"calendar-idle"),c.addClass(t.dt,"calendar-open"),c.trigger(t.dt,"tail.DateTime::open",{bubbles:!1,cancelable:!0,detail:t}),clearInterval(t.animate))},10,this)),this},close:function(){return c.hasClass(this.dt,"calendar-open")&&(c.removeClass(this.dt,"calendar-open"),c.addClass(this.dt,"calendar-idle"),this.animate=setInterval(function(t){t.dt.style.opacity=parseFloat(t.dt.style.opacity)-.1,parseFloat(t.dt.style.opacity)<=0&&(c.removeClass(t.dt,"calendar-idle"),c.addClass(t.dt,"calendar-close"),c.trigger(t.dt,"tail.DateTime::close",{bubbles:!1,cancelable:!0,detail:t}),t.dt.style.display="none",clearInterval(t.animate))},10,this)),this},toggle:function(){return c.hasClass(this.dt,"calendar-open")?this.close():c.hasClass(this.dt,"calendar-close")?this.open():this},remove:function(){return this.e.removeAttribute("data-tail-calendar"),this.e.removeAttribute("data-tail-value"),this.dt.parentElement.removeChild(this.dt),null},reload:function(){return this.remove(),new h(this.e,this.con)},switchMonth:function(t,e){return"prev"==t?this.view.date.setMonth(this.view.date.getMonth()-1):"next"==t?this.view.date.setMonth(this.view.date.getMonth()+1):(this.view.date.setMonth(t),this.view.date.setFullYear(e)),this.switchView("day"),this},switchYear:function(t){return"prev"==t?this.view.date.setFullYear(this.view.date.getFullYear()-1):"next"==t?this.view.date.setFullYear(this.view.date.getFullYear()+1):this.view.date.setFullYear(t),this.switchView("month"),this},selectDate:function(t,e,a,s,i,n){var l=new Date,r=[this.con.dateFormat?this.con.dateFormat:"",this.con.timeFormat?this.con.timeFormat:""].join(" ").trim();return this.select=new Date(t||(null==t?this.view.date.getFullYear():l.getFullYear()),e||(null==e?this.view.date.getMonth():l.getMonth()),a||(null==a?this.view.date.getDate():l.getDate()),s||(null==s?this.view.date.getHours():0),i||(null==i?this.view.date.getMinutes():0),n||(null==n?this.view.date.getSeconds():0)),c.trigger(this.dt,"tail.DateTime::select",{bubbles:!1,cancelable:!0,detail:self}),this.e.value=this.convertDate(this.select,r),this.e.setAttribute("data-tail-value",this.convertDate(this.select,"YYYY-mm-dd HH:ii:ss")),this.switchView(this.view.type)},selectTime:function(t,e,a){return this.selectDate(!1,!1,!1,t,e,a)},createCalendar:function(t,e){var a=1,s=!0,i=new Date(e,t,a).getDay(),n=[31,e%4==0&&e%100!=0||e%400==0?29:28,31,30,31,30,31,31,30,31,30,31],l=[];if((i-=u("shorts").indexOf(this.con.weekStart))<0&&(i=7+i),h.cache[this.con.weekStart+"_"+e]&&!h.isIE11){if(h.cache[this.con.weekStart+"_"+e][t])return h.cache[this.con.weekStart+"_"+e][t]}else h.cache[this.con.weekStart+"_"+e]={};for(var r=0;s;){l[r]=[];for(var d=0;d<7;d++)0===r?d===i&&(l[r][d]="<span>"+a+++"</span>",i++):a<=n[t]?l[r][d]="<span>"+a+++"</span>":(l[r][d]="",s=!1),n[t]<a&&(s=!1);r++}for(r=0;r<l.length;r++)l[r]='<tr><td class="calendar-day">'+l[r].join('</td><td class="calendar-day">')+"</td></tr>";var o=document.createElement("table");o.className="calendar-current",o.innerHTML=l.join("");var c=o.querySelectorAll("td:empty");for(r=0;r<c.length;++r)c[r].className+=" empty";t==(new Date).getMonth()&&e==(new Date).getFullYear()&&Array.prototype.slice.call(o.querySelectorAll("td")).forEach(function(t,e,a){t.innerText===(new Date).getDate().toString()&&(t.className+=" today")});return this.view.date.setMonth(t),this.view.date.setFullYear(e),this.view=h.cache[this.con.weekStart+"_"+e][t]=Object.assign({},this.view,{content:o}),h.cache[this.con.weekStart+"_"+e][t]},convertDate:function(t,e){var a,s={H:String("00"+t.getHours()).toString().slice(-2),G:(a=t.getHours(),a%12?a%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:u("months",[t.getMonth()]).slice(0,3),F:u("months",[t.getMonth()]),d:String("00"+t.getDate()).toString().slice(-2),D:u("days",[t.getDay()]),l:u("shorts",[t.getDay()]).toLowerCase()},i=new RegExp("(H{1,2}|G{1,2}|i{1,2}|s{1,2}|Y{2,4}|y{2}|m{1,2}|d{1,2})","g");return e=(e=e.replace(i,function(t){var e=s[t.slice(-1)].toString(),a=t.length;return 4==a||2==a?e.slice(-Math.abs(a)):1==a&&"0"==e[0]?e.slice(-1):e})).replace(/(A|a|M|F|D|l)/g,function(t){return s[t]})}},void 0===i.tail&&(i.tail={}),i.tail.DateTime=h}(this); | ||
/* tail.DateTime 0.3.4 @ https://github.com/pytesNET/tail.DateTime */ | ||
!function(t){"use strict";var n=t,u=t.document,g={hasClass:function(t,e){return new RegExp("(|s+)"+e+"(s+|)").test(t.className)},addClass:function(t,e){return new RegExp("(|s+)"+e+"(s+|)").test(t.className)||(t.className=(t.className.trim()+" "+e.trim()).trim()),t},removeClass:function(t,e){var a=new RegExp("(|s+)("+e+")(s+|)");return a.test(t.className)&&(t.className=t.className.replace(a,"$1$3").trim()),t},trigger:function(t,e,a){if(CustomEvent&&CustomEvent.name){var s=new CustomEvent(e,a);return t.dispatchEvent(s)}return(s=u.createEvent("CustomEvent")).initCustomEvent(e,!!a.bubbles,!!a.cancelable,a.detail),t.dispatchEvent(s)},clone:function(t,e){e="object"==typeof e?e:{};var a=t.constructor();for(var s in t)e.hasOwnProperty(s)?a[s]=e[s]:t.hasOwnProperty(s)&&(a[s]=t[s]);return a}};g.IE=-1<n.navigator.userAgent.indexOf("MSIE")||-1<n.navigator.userAgent.indexOf("Edge");var v=function(t,e){if("string"==typeof t&&(t=u.querySelectorAll(t)),t instanceof NodeList||t instanceof HTMLCollection){if(0==t.length)return!1;for(var a=new Array,s=0;s<t.length;s++)a.push(new v(t[s],e));return 1==a.length?a[0]:a}if(void 0===this)return new v(t,e);if(!(t instanceof Element))return!1;if(t.hasAttribute("data-tail-calendar")&&v.instances[t.getAttribute("data-tail-calendar")])return v.instances[t.getAttribute("data-tail-calendar")];if(e.dateRanges&&0<e.dateRanges.length){var n;for(s=0;s<e.dateRanges.length;s++)"string"==typeof(n=e.dateRanges[s])[0]&&0<=p("shorts").indexOf(n[0])?(n[0]=p("shorts").indexOf(n[0]),n[1]=2<=n.length&&0<=p("shorts").indexOf(n[1])?p("shorts").indexOf(n[1]):6):("string"==typeof n[0]&&(n[0]=new Date(Date.parse(n[0])),2==n.length&&"string"==typeof n[1]?n[1]=new Date(Date.parse(n[1])):1==n.length&&(n[1]=new Date(n[0].getFullYear(),n[0].getMonth(),0))),n[0]instanceof Date&&!isNaN(n[0].getDate())||(n[0]=new Date),(n.length<2||!(n[1]instanceof Date)||isNaN(n[1].getDate()))&&(n[1]=new Date(n[0].getFullYear(),n[0].getMonth(),0)))}return this.e=t,e="object"==typeof e?e:{},Object.assign?this.con=Object.assign({},v.defaults,e):this.con=g.clone(v.defaults,e),this.init()};v.version="0.3.4",v.status="alpha",v.count=0,v.isIE11=!!n.MSInputMethodContext&&!!u.documentMode,v.cache={},v.instances={},v.defaults={static:null,position:"bottom",classNames:"",dateFormat:"YYYY-mm-dd",timeFormat:"HH:ii:ss",dateRanges:[],weekStart:"SUN",startOpen:!1,stayOpen:!1,zeroSeconds:!1},v.strings={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 Time"]};var p=function(t,e){return t in n.tail.DateTime.strings&&(void 0!==e?n.tail.DateTime.strings[t][e]:n.tail.DateTime.strings[t])};v.prototype={e:null,dt:null,con:{},view:{},select:null,init:function(){if(this.dt)return this.dt;var t=u.querySelector(this.con.static);this.dt=u.createElement("DIV"),this.dt.id="data-tail-calendar-"+ ++v.count,this.dt.className="tail-datetime-calendar calendar-close"+(t?" calendar-static":""),this.con.stayOpen&&(this.dt.className+=" calendar-stay"),this.con.classNames&&(this.dt.className+=" "+(this.con.classNames instanceof Array?this.con.classNames.join(" "):this.con.classNames)),this.con.dateFormat?this.dt.innerHTML='<div class="calendar-navi"> <span data-tail-navi="prev" class="calendar-button button-prev"></span> <span data-tail-navi="switch" class="calendar-label"></span> <span data-tail-navi="next" class="calendar-button button-next"></span></div><div class="calendar-date"></div>'+(this.con.timeFormat?'<div class="calendar-time">'+this.renderTime()+"</div>":""):this.dt.innerHTML='<div class="calendar-navi"> <span data-tail-navi="check" class="calendar-button button-check"></span> <span data-tail-navi="switch" class="calendar-label">'+p("header",2)+'</span> <span data-tail-navi="close" class="calendar-button button-close"></span></div>'+(this.con.timeFormat?'<div class="calendar-time">'+this.renderTime()+"</div>":"");var e=new Date(Date.parse(this.e.getAttribute("data-tail-value")||this.e.value));this.view={type:"date",date:new Date,content:"",render:function(){return this.content.querySelector("tbody").innerHTML}},isNaN(e.getDate())||(this.select=e,this.con.zeroSeconds&&this.select.setSeconds(0),this.view.date=new Date(this.select.getTime())),this.con.timeFormat&&(this.dt.querySelector(".calendar-field-h > input").value=this.view.date.getHours(),this.dt.querySelector(".calendar-field-m > input").value=this.view.date.getMinutes(),this.dt.querySelector(".calendar-field-s > input").value=this.view.date.getSeconds()),this.switchMonth(this.view.date.getMonth(),this.view.date.getFullYear()),this.e.hasAttribute("data-tail-value")?this.selectDate():this.e.setAttribute("data-tail-value",this.convertDate(this.view.date,"YYYY-mm-dd HH:ii:ss")),this.dt.style.top=0,this.dt.style.left=0,this.dt.style.zIndex=99,this.dt.style.position=t?"static":"absolute",this.dt.style.visibility=t?"visible":"hidden",t?t.appendChild(this.dt):u.getElementsByTagName("body")[0].appendChild(this.dt);var s=this,a=this.dt.querySelectorAll("[data-tail-navi]");if(0<a.length)for(var n=0;n<a.length;n++)a[n].addEventListener("click",function(t){var e=this.getAttribute("data-tail-navi");s.con.dateFormat?"month"==s.view.type?"prev"==e||"next"==e?s.switchYear.call(s,e):s.switchView.call(s,"day"):"prev"==e||"next"==e?s.switchMonth.call(s,e):s.switchView.call(s,"month"):s.con.timeFormat&&("check"==e&&s.selectTime.call(s,parseInt(s.dt.querySelector(".calendar-field-h > input").value),parseInt(s.dt.querySelector(".calendar-field-m > input").value),parseInt(s.dt.querySelector(".calendar-field-s > input").value)),s.con.stayOpen||s.close.call(s))});return this.e.addEventListener("focusin",function(t){s.open.call(s)}),this.e.addEventListener("focusout",function(t){var e=new Date(Date.parse(this.value));isNaN(e.getDate())||(s.selectDate.call(s,e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds()),s.switchMonth.call(s,e.getMonth(),e.getFullYear()))}),this.e.addEventListener("keyup",function(t){if(13==t.keyCode){var e=new Date(Date.parse(this.value));isNaN(e.getDate())||(s.selectDate.call(s,e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds()),s.switchMonth.call(s,e.getMonth(),e.getFullYear())),t.stopPropagation()}}),u.addEventListener("keyup",function(t){if(g.hasClass(s.dt,"calendar-open")&&27==t.keyCode&&(s.con.stayOpen||s.close.call(s),s.e.blur()),g.hasClass(s.dt,"calendar-open")&&13==t.keyCode){if(s.con.dateFormat){var e=s.dt.children[1].querySelector("td.today")||s.dt.children[1].querySelector("td:not(.empty)"),a=!!s.con.timeFormat;g.hasClass(e,"disabled")||s.selectDate.call(s,s.view.year,s.view.month,parseInt(e.value),a?parseInt(s.dt.querySelector(".calendar-field-h > input").value):0,a?parseInt(s.dt.querySelector(".calendar-field-m > input").value):0,a?parseInt(s.dt.querySelector(".calendar-field-s > input").value):0)}else s.selectTime.call(s,parseInt(s.dt.querySelector(".calendar-field-h > input").value),parseInt(s.dt.querySelector(".calendar-field-m > input").value),parseInt(s.dt.querySelector(".calendar-field-s > input").value));s.con.stayOpen||s.close.call(s),s.e.blur()}}),u.addEventListener("click",function(t){g.hasClass(s.dt,"calendar-open")&&(s.dt.contains(t.target)||s.e.contains(t.target)||t.target!=s.dt&&t.target!=s.e&&(s.con.stayOpen||s.close.call(s)))}),this.e.setAttribute("data-tail-calendar","tail-"+v.count),this.con.startOpen&&this.open(),v.instances["tail-"+v.count]=this},calcPosition:function(){if(g.hasClass(this.dt,"calendar-static"))return this;var t=n.getComputedStyle(this.dt),e=parseInt(t.marginLeft)+parseInt(t.marginRight),a=parseInt(t.marginTop)+parseInt(t.marginBottom),s=function(t){for(var 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(this.dt.style.visibility="hidden",this.con.position){case"top":this.dt.style.top=s.top-(this.dt.offsetHeight+a)+"px",this.dt.style.left=s.left+s.width/2-(this.dt.offsetWidth/2+e/2)+"px";break;case"left":this.dt.style.top=s.top+s.height/2-(this.dt.offsetHeight/2+a)+"px",this.dt.style.left=s.left-(this.dt.offsetWidth+e)+"px";break;case"right":this.dt.style.top=s.top+s.height/2-(this.dt.offsetHeight/2+a)+"px",this.dt.style.left=s.left+s.width+"px";break;default:this.dt.style.top=s.top+s.height+"px",this.dt.style.left=s.left+s.width/2-(this.dt.offsetWidth/2+e/2)+"px"}return this.dt.style.visibility="visible",this},switchView:function(t){if(!this.con.dateFormat)return!1;if("month"==(this.view.type=t))this.dt.children[1].innerHTML="",this.dt.children[1].insertAdjacentHTML("afterbegin",this.renderMonth()),this.dt.querySelector(".calendar-label").innerText=this.view.date.getFullYear();else{this.dt.children[1].innerHTML=this.renderDay(),this.dt.querySelector(".calendar-label").innerText=p("months",this.view.date.getMonth())+" "+this.view.date.getFullYear();var e=this.con.dateRanges,a=this.view.date,s=this.dt.querySelectorAll("tbody td:not(.empty)"),n=new Date(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0);if(0<e.length){for(var i=[],l=0;l<e.length;l++)if(e[l][0]instanceof Date){if(a.getYear()>=e[l][0].getYear()&&a.getYear()<=e[l][1].getYear()&&a.getMonth()>=e[l][0].getMonth()&&a.getMonth()<=e[l][1].getMonth())for(var r=0;r<s.length;r++)n.setDate(parseInt(s[r].innerText)),n>=e[l][0]&&n<=e[l][1]&&i.push(s[r].innerText)}else for(r=0;r<s.length;r++)n.setDate(parseInt(s[r].innerText)),3==e[l].length&&1==e[l][3]&&n.getDay()>=e[l][0]&&n.getDay()<=e[l][1]&&-1==i.indexOf(s[r].innerText)&&i.push(s[r].innerText),(n.getDay()<e[l][0]||n.getDay()>e[l][1])&&0<=i.indexOf(s[r].innerText)&&i.splice(i.indexOf(s[r].innerText),1);for(r=0;r<s.length;r++)-1==i.indexOf(s[r].innerText)&&g.addClass(s[r],"disable")}this.select instanceof Date&&this.select.getYear()==this.view.date.getYear()&&this.select.getMonth()==this.view.date.getMonth()?g.addClass(this.dt.querySelectorAll("tbody td:not(.empty)")[this.select.getDate()-1],"current"):this.dt.querySelector("tbody td.current")&&g.removeClass(this.dt.querySelector("tbody td.current"),"current")}var d=this;if(this.con.dateFormat){var o=this.dt.querySelectorAll("tbody td:not(.empty)");for(l=0;l<o.length;l++)o[l].addEventListener("click",function(t){if(t.preventDefault(),t.stopPropagation(),g.hasClass(this,"disable"))return!1;var e=!!d.con.timeFormat;"month"==d.view.type?d.switchMonth.call(d,parseInt(this.getAttribute("data-tail-month")),d.view.date.getFullYear()):(d.selectDate.call(d,d.view.date.getFullYear(),d.view.date.getMonth(),parseInt(this.innerText),e?parseInt(d.dt.querySelector(".calendar-field-h > input").value):0,e?parseInt(d.dt.querySelector(".calendar-field-m > input").value):0,e?parseInt(d.dt.querySelector(".calendar-field-s > input").value):0),d.con.stayOpen||d.close.call(d))})}},renderDay:function(){var t=p("shorts").indexOf(this.con.weekStart),e=p("shorts").slice(t);e=e.concat(p("shorts").slice(0,t));for(var a='<table class="calendar-day"><thead><tr>',s=0;s<7;s++)a+='<th data-tail-day="'+p("shorts").indexOf(e[s])+'">'+e[s]+"</th>";return a+="</tr></thead><tbody>",a+=this.createCalendar(this.view.date.getMonth(),this.view.date.getFullYear()).render(),a+="</tbody></table>"},renderMonth:function(){for(var t=p("months"),e='<table class="calendar-month"><thead><tr><th colspan="4">'+p("header",0)+"</th></tr></thead><tbody>",a=0;a<12;a++)e+="<tr>",e+='<td class="calendar-month" data-tail-month="0"><span>'+t[a++]+"</span></td>",e+='<td class="calendar-month" data-tail-month="1"><span>'+t[a++]+"</span></td>",e+='<td class="calendar-month" data-tail-month="2"><span>'+t[a]+"</span></td>",e+="</tr>";return e+="</tbody></table>"},renderTime:function(){return'<div class="calendar-field calendar-field-h"> <input type="number" value="'+(new Date).getHours()+'" min="00" max="23" step="1" /> <label>'+p("time",0)+'</label></div><div class="calendar-field calendar-field-m"> <input type="number" value="'+(new Date).getMinutes()+'" min="00" max="59" step="1" /> <label>'+p("time",1)+'</label></div><div class="calendar-field calendar-field-s"> <input type="number" value="'+(new Date).getSeconds()+'" min="00" max="59" step="1" /> <label>'+p("time",2)+"</label></div>"},on:function(t,e){this.dt.addEventListener(t,e)},open:function(){return g.hasClass(this.dt,"calendar-close")&&(g.removeClass(this.dt,"calendar-close"),g.addClass(this.dt,"calendar-idle"),this.dt.style.opacity=0,this.dt.style.display="block",this.calcPosition(),(t=this).animate=setInterval(function(){t.dt.style.opacity=parseFloat(t.dt.style.opacity)+.1,1<=parseFloat(t.dt.style.opacity)&&(g.removeClass(t.dt,"calendar-idle"),g.addClass(t.dt,"calendar-open"),g.trigger(t.dt,"tail.DateTime::open",{bubbles:!1,cancelable:!0,detail:t}),clearInterval(t.animate))},10)),this;var t},close:function(){return g.hasClass(this.dt,"calendar-open")&&(g.removeClass(this.dt,"calendar-open"),g.addClass(this.dt,"calendar-idle"),(t=this).animate=setInterval(function(){t.dt.style.opacity=parseFloat(t.dt.style.opacity)-.1,parseFloat(t.dt.style.opacity)<=0&&(g.removeClass(t.dt,"calendar-idle"),g.addClass(t.dt,"calendar-close"),g.trigger(t.dt,"tail.DateTime::close",{bubbles:!1,cancelable:!0,detail:t}),t.dt.style.display="none",clearInterval(t.animate))},10)),this;var t},toggle:function(){return g.hasClass(this.dt,"calendar-open")?this.close():g.hasClass(this.dt,"calendar-close")?this.open():this},remove:function(){return this.e.removeAttribute("data-tail-calendar"),this.e.removeAttribute("data-tail-value"),this.dt.parentElement.removeChild(this.dt),null},reload:function(){return this.remove(),new v(this.e,this.con)},switchMonth:function(t,e){return"prev"==t?this.view.date.setMonth(this.view.date.getMonth()-1):"next"==t?this.view.date.setMonth(this.view.date.getMonth()+1):(this.view.date.setMonth(t),this.view.date.setFullYear(e)),this.switchView("day"),this},switchYear:function(t){return"prev"==t?this.view.date.setFullYear(this.view.date.getFullYear()-1):"next"==t?this.view.date.setFullYear(this.view.date.getFullYear()+1):this.view.date.setFullYear(t),this.switchView("month"),this},selectDate:function(t,e,a,s,n,i){var l=new Date,r=[this.con.dateFormat?this.con.dateFormat:"",this.con.timeFormat?this.con.timeFormat:""].join(" ").trim();return this.select=new Date(t||(null==t?this.view.date.getFullYear():l.getFullYear()),e||(null==e?this.view.date.getMonth():l.getMonth()),a||(null==a?this.view.date.getDate():l.getDate()),s||(null==s?this.view.date.getHours():0),n||(null==n?this.view.date.getMinutes():0),i||(null==i?this.view.date.getSeconds():0)),g.trigger(this.dt,"tail.DateTime::select",{bubbles:!1,cancelable:!0,detail:self}),this.e.value=this.convertDate(this.select,r),this.e.setAttribute("data-tail-value",this.convertDate(this.select,"YYYY-mm-dd HH:ii:ss")),this.switchView(this.view.type)},selectTime:function(t,e,a){return this.selectDate(!1,!1,!1,t,e,a)},createCalendar:function(t,e){var a=1,s=!0,n=new Date(e,t,a).getDay(),i=[31,e%4==0&&e%100!=0||e%400==0?29:28,31,30,31,30,31,31,30,31,30,31],l=[];if((n-=p("shorts").indexOf(this.con.weekStart))<0&&(n=7+n),v.cache[this.con.weekStart+"_"+e]&&!v.isIE11){if(v.cache[this.con.weekStart+"_"+e][t])return v.cache[this.con.weekStart+"_"+e][t]}else v.cache[this.con.weekStart+"_"+e]={};for(var r=0;s;){l[r]=[];for(var d=0;d<7;d++)0===r?d===n&&(l[r][d]="<span>"+a+++"</span>",n++):a<=i[t]?l[r][d]="<span>"+a+++"</span>":(l[r][d]="",s=!1),i[t]<a&&(s=!1);r++}for(r=0;r<l.length;r++)l[r]='<tr>\n<td class="calendar-day">'+l[r].join('</td>\n<td class="calendar-day">')+"</td>\n</tr>";if(g.IE){var o="<table><tbdy>"+l.join("")+"</tbody></table>";(c=u.createElement("div")).innerHTML=o,c=c.getElementsByTagName("table")[0]}else{var c;(c=u.createElement("table")).className="calendar-current",c.innerHTML=l.join("")}var h=c.querySelectorAll("td:empty");for(r=0;r<h.length;++r)h[r].className+=" empty";t==(new Date).getMonth()&&e==(new Date).getFullYear()&&Array.prototype.slice.call(c.querySelectorAll("td")).forEach(function(t,e,a){t.innerText===(new Date).getDate().toString()&&(t.className+=" today")});return this.view.date.setMonth(t),this.view.date.setFullYear(e),this.view=g.clone(this.view,{content:c}),v.cache[this.con.weekStart+"_"+e][t]=this.view,v.cache[this.con.weekStart+"_"+e][t]},convertDate:function(t,e){var a,s={H:String("00"+t.getHours()).toString().slice(-2),G:(a=t.getHours(),a%12?a%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:p("months",[t.getMonth()]).slice(0,3),F:p("months",[t.getMonth()]),d:String("00"+t.getDate()).toString().slice(-2),D:p("days",[t.getDay()]),l:p("shorts",[t.getDay()]).toLowerCase()},n=new RegExp("(H{1,2}|G{1,2}|i{1,2}|s{1,2}|Y{2,4}|y{2}|m{1,2}|d{1,2})","g");return e=(e=e.replace(n,function(t){var e=s[t.slice(-1)].toString(),a=t.length;return 4==a||2==a?e.slice(-Math.abs(a)):1==a&&"0"==e[0]?e.slice(-1):e})).replace(/(A|a|M|F|D|l)/g,function(t){return s[t]})}},void 0===n.tail&&(n.tail={}),n.tail.DateTime=v,n.tail.DateTime}(this); |
{ | ||
"name": "tail.datetime", | ||
"version": "0.3.3", | ||
"version": "0.3.4", | ||
"description": "A light-weight, translat- and configurable Open Source DateTime Picker, written in pure vanilla JavaScript!", | ||
@@ -12,3 +12,3 @@ "main": "js/tail.datetime.js", | ||
"keywords": [ | ||
"datetime-picker", "datetime", "date", "time", "picker", "calendar", "form" | ||
"datetime-picker", "datetime", "date", "time", "picker", "calendar", "form", "tail" | ||
], | ||
@@ -15,0 +15,0 @@ "author": "SamBrishes, pytesNET", |
tail.DateTime | ||
============= | ||
> Version: 0.3.3 (Alpha)<br /> | ||
> License: X11 / MIT<br /> | ||
> Author: SamBrishes, pytesNET & MrGuiseppe | ||
[![npm](https://img.shields.io/npm/v/tail.datetime.svg?style=flat-square)](https://www.npmjs.com/package/tail.datetime) | ||
[![npm](https://img.shields.io/npm/dt/tail.datetime.svg?style=flat-square)](https://www.npmjs.com/package/tail.datetime) | ||
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md) | ||
[![Author](https://img.shields.io/badge/Author-SamBrishes@pytesNET-lightgrey.svg?style=flat-square)](https://www.github.com/pytesNET) | ||
@@ -21,3 +22,3 @@ **The tail.DateTime script is a fork of the [Pure JS Calendar](https://github.com/MrGuiseppe/pureJSCalendar), written by [MrGuiseppe](https://github.com/MrGuiseppe).** It is specially designed for the new, yet unpublished, backend theme for the FoxCMS. The tail.DateTime script offers the following changes compared to the Pure JS Calendar: | ||
[Simple Demonstration](https://pytesNET.github.io/tail.DateTime/) | ||
[Demonstration](https://github.pytes.net/tail.DateTime) | ||
@@ -24,0 +25,0 @@ Work in Progress |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
88607
12
1411
221