Ubuntu

­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­ /*! * Pikaday * * Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday */ !function(e,t){"use strict";var n;if("object"==typeof exports){try{n=require("moment")}catch(e){}module.exports=t(n)}else"function"==typeof define&&define.amd?define((function(e){try{n=e("moment")}catch(e){}return t(n)})):e.Pikaday=t(e.moment)}(this,(function(e){"use strict";var t="function"==typeof e,n=!!window.addEventListener,a=window.document,i=window.setTimeout,s=function(e,t,a,i){n?e.addEventListener(t,a,!!i):e.attachEvent("on"+t,a)},o=function(e,t,a,i){n?e.removeEventListener(t,a,!!i):e.detachEvent("on"+t,a)},r=function(e,t){return-1!==(" "+e.className+" ").indexOf(" "+t+" ")},h=function(e){return/Array/.test(Object.prototype.toString.call(e))},l=function(e){return/Date/.test(Object.prototype.toString.call(e))&&!isNaN(e.getTime())},d=function(e){var t=e.getDay();return 0===t||6===t},u=function(e){return e%4==0&&e%100!=0||e%400==0},c=function(e,t){return[31,u(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]},f=function(e){l(e)&&e.setHours(0,0,0,0)},g=function(e,t){return e.getTime()===t.getTime()},m=function(e,t,n){var a,i;for(a in t)(i=void 0!==e[a])&&"object"==typeof t[a]&&null!==t[a]&&void 0===t[a].nodeName?l(t[a])?n&&(e[a]=new Date(t[a].getTime())):h(t[a])?n&&(e[a]=t[a].slice(0)):e[a]=m({},t[a],n):!n&&i||(e[a]=t[a]);return e},p=function(e,t,n){var i;a.createEvent?((i=a.createEvent("HTMLEvents")).initEvent(t,!0,!1),i=m(i,n),e.dispatchEvent(i)):a.createEventObject&&(i=a.createEventObject(),i=m(i,n),e.fireEvent("on"+t,i))},y=function(e){return e.month<0&&(e.year-=Math.ceil(Math.abs(e.month)/12),e.month+=12),e.month>11&&(e.year+=Math.floor(Math.abs(e.month)/12),e.month-=12),e},D={field:null,bound:void 0,position:"bottom left",reposition:!0,format:"YYYY-MM-DD",toString:null,parse:null,defaultDate:null,setDefaultDate:!1,firstDay:0,formatStrict:!1,minDate:null,maxDate:null,yearRange:10,showWeekNumber:!1,pickWholeWeek:!1,minYear:0,maxYear:9999,minMonth:void 0,maxMonth:void 0,startRange:null,endRange:null,isRTL:!1,yearSuffix:"",showMonthAfterYear:!1,showDaysInNextAndPreviousMonths:!1,enableSelectionDaysInNextAndPreviousMonths:!1,numberOfMonths:1,mainCalendar:"left",container:void 0,blurFieldOnSelect:!0,i18n:{previousMonth:"Previous Month",nextMonth:"Next Month",months:["January","February","March","April","May","June","July","August","September","October","November","December"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},theme:null,events:[],onSelect:null,onOpen:null,onClose:null,onDraw:null},v=function(e,t,n){for(t+=e.firstDay;t>=7;)t-=7;return n?e.i18n.weekdaysShort[t]:e.i18n.weekdays[t]},_=function(e){var t=[],n="false";if(e.isEmpty){if(!e.showDaysInNextAndPreviousMonths)return'';t.push("is-outside-current-month"),e.enableSelectionDaysInNextAndPreviousMonths||t.push("is-selection-disabled")}return e.isDisabled&&t.push("is-disabled"),e.isToday&&t.push("is-today"),e.isSelected&&(t.push("is-selected"),n="true"),e.hasEvent&&t.push("has-event"),e.isInRange&&t.push("is-inrange"),e.isStartRange&&t.push("is-startrange"),e.isEndRange&&t.push("is-endrange"),'"},b=function(e,t,n,a){return''+(t?e.reverse():e).join("")+""},w=function(e,t,n,a,i,s){var o,r,l,d,u,c=e._o,f=n===c.minYear,g=n===c.maxYear,m='
',p=!0,y=!0;for(l=[],o=0;o<12;o++)l.push('");for(d='
'+c.i18n.months[a]+'
",h(c.yearRange)?(o=c.yearRange[0],r=c.yearRange[1]+1):(o=n-c.yearRange,r=1+n+c.yearRange),l=[];o=c.minYear&&l.push('");return u='
'+n+c.yearSuffix+'
",c.showMonthAfterYear?m+=u+d:m+=d+u,f&&(0===a||c.minMonth>=a)&&(p=!1),g&&(11===a||c.maxMonth<=a)&&(y=!1),0===t&&(m+='"),t===e._o.numberOfMonths-1&&(m+='"),m+"
"},M=function(e,t,n){return''+function(e){var t,n=[];for(e.showWeekNumber&&n.push(""),t=0;t<7;t++)n.push('");return""+(e.isRTL?n.reverse():n).join("")+""}(e)+(""+t.join("")+"")+"
'+v(e,t,!0)+"
"},k=function(o){var h=this,d=h.config(o);h._onMouseDown=function(e){if(h._v){var t=(e=e||window.event).target||e.srcElement;if(t)if(r(t,"is-disabled")||(!r(t,"pika-button")||r(t,"is-empty")||r(t.parentNode,"is-disabled")?r(t,"pika-prev")?h.prevMonth():r(t,"pika-next")&&h.nextMonth():(h.setDate(new Date(t.getAttribute("data-pika-year"),t.getAttribute("data-pika-month"),t.getAttribute("data-pika-day"))),d.bound&&i((function(){h.hide(),d.blurFieldOnSelect&&d.field&&d.field.blur()}),100))),r(t,"pika-select"))h._c=!0;else{if(!e.preventDefault)return e.returnValue=!1,!1;e.preventDefault()}}},h._onChange=function(e){var t=(e=e||window.event).target||e.srcElement;t&&(r(t,"pika-select-month")?h.gotoMonth(t.value):r(t,"pika-select-year")&&h.gotoYear(t.value))},h._onKeyChange=function(e){if(e=e||window.event,h.isVisible())switch(e.keyCode){case 13:case 27:d.field&&d.field.blur();break;case 37:e.preventDefault(),h.adjustDate("subtract",1);break;case 38:h.adjustDate("subtract",7);break;case 39:h.adjustDate("add",1);break;case 40:h.adjustDate("add",7)}},h._onInputChange=function(n){var a;n.firedBy!==h&&(a=d.parse?d.parse(d.field.value,d.format):t?(a=e(d.field.value,d.format,d.formatStrict))&&a.isValid()?a.toDate():null:new Date(Date.parse(d.field.value)),l(a)&&h.setDate(a),h._v||h.show())},h._onInputFocus=function(){h.show()},h._onInputClick=function(){h.show()},h._onInputBlur=function(){var e=a.activeElement;do{if(r(e,"pika-single"))return}while(e=e.parentNode);h._c||(h._b=i((function(){h.hide()}),50)),h._c=!1},h._onClick=function(e){var t=(e=e||window.event).target||e.srcElement,a=t;if(t){!n&&r(t,"pika-select")&&(t.onchange||(t.setAttribute("onchange","return;"),s(t,"change",h._onChange)));do{if(r(a,"pika-single")||a===d.trigger)return}while(a=a.parentNode);h._v&&t!==d.trigger&&a!==d.trigger&&h.hide()}},h.el=a.createElement("div"),h.el.className="pika-single"+(d.isRTL?" is-rtl":"")+(d.theme?" "+d.theme:""),s(h.el,"mousedown",h._onMouseDown,!0),s(h.el,"touchend",h._onMouseDown,!0),s(h.el,"change",h._onChange),s(a,"keydown",h._onKeyChange),d.field&&(d.container?d.container.appendChild(h.el):d.bound?a.body.appendChild(h.el):d.field.parentNode.insertBefore(h.el,d.field.nextSibling),s(d.field,"change",h._onInputChange),d.defaultDate||(t&&d.field.value?d.defaultDate=e(d.field.value,d.format).toDate():d.defaultDate=new Date(Date.parse(d.field.value)),d.setDefaultDate=!0));var u=d.defaultDate;l(u)?d.setDefaultDate?h.setDate(u,!0):h.gotoDate(u):h.gotoDate(new Date),d.bound?(this.hide(),h.el.className+=" is-bound",s(d.trigger,"click",h._onInputClick),s(d.trigger,"focus",h._onInputFocus),s(d.trigger,"blur",h._onInputBlur)):this.show()};return k.prototype={config:function(e){this._o||(this._o=m({},D,!0));var t=m(this._o,e,!0);t.isRTL=!!t.isRTL,t.field=t.field&&t.field.nodeName?t.field:null,t.theme="string"==typeof t.theme&&t.theme?t.theme:null,t.bound=!!(void 0!==t.bound?t.field&&t.bound:t.field),t.trigger=t.trigger&&t.trigger.nodeName?t.trigger:t.field,t.disableWeekends=!!t.disableWeekends,t.disableDayFn="function"==typeof t.disableDayFn?t.disableDayFn:null;var n=parseInt(t.numberOfMonths,10)||1;if(t.numberOfMonths=n>4?4:n,l(t.minDate)||(t.minDate=!1),l(t.maxDate)||(t.maxDate=!1),t.minDate&&t.maxDate&&t.maxDate100&&(t.yearRange=100);return t},toString:function(n){return n=n||this._o.format,l(this._d)?this._o.toString?this._o.toString(this._d,n):t?e(this._d).format(n):this._d.toDateString():""},getMoment:function(){return t?e(this._d):null},setMoment:function(n,a){t&&e.isMoment(n)&&this.setDate(n.toDate(),a)},getDate:function(){return l(this._d)?new Date(this._d.getTime()):null},setDate:function(e,t){if(!e)return this._d=null,this._o.field&&(this._o.field.value="",p(this._o.field,"change",{firedBy:this})),this.draw();if("string"==typeof e&&(e=new Date(Date.parse(e))),l(e)){var n=this._o.minDate,a=this._o.maxDate;l(n)&&ea&&(e=a),this._d=new Date(e.getTime()),f(this._d),this.gotoDate(this._d),this._o.field&&(this._o.field.value=this.toString(),p(this._o.field,"change",{firedBy:this})),t||"function"!=typeof this._o.onSelect||this._o.onSelect.call(this,this.getDate())}},gotoDate:function(e){var t=!0;if(l(e)){if(this.calendars){var n=new Date(this.calendars[0].year,this.calendars[0].month,1),a=new Date(this.calendars[this.calendars.length-1].year,this.calendars[this.calendars.length-1].month,1),i=e.getTime();a.setMonth(a.getMonth()+1),a.setDate(a.getDate()-1),t=i=s&&(this._y=s,!isNaN(r)&&this._m>r&&(this._m=r)),t="pika-title-"+Math.random().toString(36).replace(/[^a-z]+/g,"").substr(0,2);for(var l=0;l'+w(this,l,this.calendars[l].year,this.calendars[l].month,this.calendars[0].year,t)+this.render(this.calendars[l].year,this.calendars[l].month,t)+"";this.el.innerHTML=h,n.bound&&"hidden"!==n.field.type&&i((function(){n.trigger.focus()}),1),"function"==typeof this._o.onDraw&&this._o.onDraw(this),n.bound&&n.field.setAttribute("aria-label","Use the arrow keys to pick a date")}},adjustPosition:function(){var e,t,n,i,s,o,r,h,l,d;if(!this._o.container){if(this.el.style.position="absolute",t=e=this._o.trigger,n=this.el.offsetWidth,i=this.el.offsetHeight,s=window.innerWidth||a.documentElement.clientWidth,o=window.innerHeight||a.documentElement.clientHeight,r=window.pageYOffset||a.body.scrollTop||a.documentElement.scrollTop,"function"==typeof e.getBoundingClientRect)h=(d=e.getBoundingClientRect()).left+window.pageXOffset,l=d.bottom+window.pageYOffset;else for(h=t.offsetLeft,l=t.offsetTop+t.offsetHeight;t=t.offsetParent;)h+=t.offsetLeft,l+=t.offsetTop;(this._o.reposition&&h+n>s||this._o.position.indexOf("right")>-1&&h-n+e.offsetWidth>0)&&(h=h-n+e.offsetWidth),(this._o.reposition&&l+i>o+r||this._o.position.indexOf("top")>-1&&l-i-e.offsetHeight>0)&&(l=l-i-e.offsetHeight),this.el.style.left=h+"px",this.el.style.top=l+"px"}},render:function(e,t,n){var a=this._o,i=new Date,s=c(e,t),o=new Date(e,t,1).getDay(),r=[],h=[];f(i),a.firstDay>0&&(o-=a.firstDay)<0&&(o+=7);for(var u=0===t?11:t-1,m=11===t?0:t+1,p=0===t?e-1:e,y=11===t?e+1:e,D=c(p,u),v=s+o,w=v;w>7;)w-=7;v+=7-w;for(var k,x,R,N,S=!1,C=0,I=0;C=s+o,W=C-o+1,A=t,F=e,L=a.startRange&&g(a.startRange,T),P=a.endRange&&g(a.endRange,T),B=a.startRange&&a.endRange&&a.startRangea.maxDate||a.disableWeekends&&d(T)||a.disableDayFn&&a.disableDayFn(T),isEmpty:j,isStartRange:L,isEndRange:P,isInRange:B,showDaysInNextAndPreviousMonths:a.showDaysInNextAndPreviousMonths,enableSelectionDaysInNextAndPreviousMonths:a.enableSelectionDaysInNextAndPreviousMonths};a.pickWholeWeek&&E&&(S=!0),h.push(_(H)),7==++I&&(a.showWeekNumber&&h.unshift((k=C-o,x=t,R=e,N=void 0,N=new Date(R,0,1),''+Math.ceil(((new Date(R,x,k)-N)/864e5+N.getDay()+1)/7)+"")),r.push(b(h,a.isRTL,a.pickWholeWeek,S)),h=[],I=0,S=!1)}return M(a,r,n)},isVisible:function(){return this._v},show:function(){var e,t,n;this.isVisible()||(this._v=!0,this.draw(),e=this.el,t="is-hidden",e.className=(n=(" "+e.className+" ").replace(" "+t+" "," ")).trim?n.trim():n.replace(/^\s+|\s+$/g,""),this._o.bound&&(s(a,"click",this._onClick),this.adjustPosition()),"function"==typeof this._o.onOpen&&this._o.onOpen.call(this))},hide:function(){var e,t,n=this._v;!1!==n&&(this._o.bound&&o(a,"click",this._onClick),this.el.style.position="static",this.el.style.left="auto",this.el.style.top="auto",e=this.el,r(e,t="is-hidden")||(e.className=""===e.className?t:e.className+" "+t),this._v=!1,void 0!==n&&"function"==typeof this._o.onClose&&this._o.onClose.call(this))},destroy:function(){this.hide(),o(this.el,"mousedown",this._onMouseDown,!0),o(this.el,"touchend",this._onMouseDown,!0),o(this.el,"change",this._onChange),o(a,"keydown",this._onKeyChange),this._o.field&&(o(this._o.field,"change",this._onInputChange),this._o.bound&&(o(this._o.trigger,"click",this._onInputClick),o(this._o.trigger,"focus",this._onInputFocus),o(this._o.trigger,"blur",this._onInputBlur))),this.el.parentNode&&this.el.parentNode.removeChild(this.el)}},k}));