Loading README.txt +2 −1 Changes for README.txt: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -12,7 +12,8 @@ If you're using jQuery make sure to pass only the first element: var picker = new Pikaday({ field: $('#datepicker')[0] }); If the Pikaday instance is not bound to a field you can append the element anywhere: If the Pikaday instance is not bound to a field you can append the element anywhere: var field = document.getElementById('datepicker'); var picker = new Pikaday({ Loading css/pikaday.css +8 −5 Changes for css/pikaday.css: 8 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -25,8 +25,12 @@ http://nicolasgallagher.com/micro-clearfix-hack/ content: " "; display: table; } .pika-single:after { clear: both } .pika-single { *zoom: 1 } .pika-single:after { clear: both; } .pika-single { *zoom: 1; } .pika-single.is-hidden { display: none; Loading Loading @@ -189,12 +193,12 @@ http://nicolasgallagher.com/micro-clearfix-hack/ .is-disabled .pika-button, .is-inrange .pika-button { background: #D5E9F7; background: #d5e9f7; } .is-startrange .pika-button { color: #fff; background: #6CB31D; background: #6cb31d; box-shadow: none; border-radius: 3px; } Loading Loading @@ -236,4 +240,3 @@ http://nicolasgallagher.com/micro-clearfix-hack/ border-bottom: none; cursor: help; } js/pikaday.js +66 −122 Changes for js/pikaday.js: 66 added lines, 122 removed lines. Original line number Diff line number Diff line Loading @@ -4,8 +4,7 @@ * Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/Pikaday/Pikaday */ (function (root, factory) { (function (root, factory) { 'use strict'; var moment; Loading @@ -16,8 +15,7 @@ module.exports = factory(moment); } else if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(function (req) { define(function (req) { // Load moment.js as an optional dependency var id = 'moment'; try { moment = req(id); } catch (e) {} Loading @@ -26,8 +24,7 @@ } else { root.Pikaday = factory(root.moment); } }(this, function (moment) { }(this, function (moment) { 'use strict'; /** Loading @@ -41,8 +38,7 @@ sto = window.setTimeout, addEvent = function(el, e, callback, capture) { addEvent = function (el, e, callback, capture) { if (hasEventListeners) { el.addEventListener(e, callback, !!capture); } else { Loading @@ -50,8 +46,7 @@ } }, removeEvent = function(el, e, callback, capture) { removeEvent = function (el, e, callback, capture) { if (hasEventListeners) { el.removeEventListener(e, callback, !!capture); } else { Loading @@ -59,68 +54,57 @@ } }, trim = function(str) { trim = function (str) { return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g,''); }, hasClass = function(el, cn) { hasClass = function (el, cn) { return (' ' + el.className + ' ').indexOf(' ' + cn + ' ') !== -1; }, addClass = function(el, cn) { addClass = function (el, cn) { if (!hasClass(el, cn)) { el.className = (el.className === '') ? cn : el.className + ' ' + cn; } }, removeClass = function(el, cn) { removeClass = function (el, cn) { el.className = trim((' ' + el.className + ' ').replace(' ' + cn + ' ', ' ')); }, isArray = function(obj) { isArray = function (obj) { return (/Array/).test(Object.prototype.toString.call(obj)); }, isDate = function(obj) { isDate = function (obj) { return (/Date/).test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime()); }, isWeekend = function(date) { isWeekend = function (date) { var day = date.getDay(); return day === 0 || day === 6; }, isLeapYear = function(year) { isLeapYear = function (year) { // solution by Matti Virkkunen: http://stackoverflow.com/a/4881951 return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; }, getDaysInMonth = function(year, month) { getDaysInMonth = function (year, month) { return [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; }, setToStartOfDay = function(date) { if (isDate(date)) date.setHours(0,0,0,0); setToStartOfDay = function (date) { if (isDate(date)) { date.setHours(0,0,0,0); } }, compareDates = function(a,b) { compareDates = function (a,b) { // weak date comparison (use setToStartOfDay(date) to ensure correct result) return a.getTime() === b.getTime(); }, extend = function(to, from, overwrite) { extend = function (to, from, overwrite) { var prop, hasProp; for (prop in from) { hasProp = to[prop] !== undefined; Loading @@ -144,8 +128,7 @@ return to; }, fireEvent = function(el, eventName, data) { fireEvent = function (el, eventName, data) { var ev; if (document.createEvent) { Loading Loading @@ -290,12 +273,10 @@ keyboardInput: true }, /** * templating functions to abstract HTML rendering */ renderDayName = function(opts, day, abbr) { renderDayName = function (opts, day, abbr) { day += opts.firstDay; while (day >= 7) { day -= 7; Loading @@ -303,8 +284,7 @@ return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day]; }, renderDay = function(opts) { renderDay = function (opts) { var arr = []; var ariaSelected = 'false'; if (opts.isEmpty) { Loading Loading @@ -345,8 +325,7 @@ '<button class="pika-button pika-day" type="button" ' + 'data-pika-year="' + opts.year + '" data-pika-month="' + opts.month + '" data-pika-day="' + opts.day + '">' + opts.day + '</button>' + '</td>'; '</button></td>'; }, renderWeek = function (d, m, y) { Loading @@ -356,18 +335,15 @@ return '<td class="pika-week">' + weekNum + '</td>'; }, renderRow = function(days, isRTL, pickWholeWeek, isRowSelected) { renderRow = function (days, isRTL, pickWholeWeek, isRowSelected) { return '<tr class="pika-row' + (pickWholeWeek ? ' pick-whole-week' : '') + (isRowSelected ? ' is-selected' : '') + '">' + (isRTL ? days.reverse() : days).join('') + '</tr>'; }, renderBody = function(rows) { renderBody = function (rows) { return '<tbody>' + rows.join('') + '</tbody>'; }, renderHead = function(opts) { renderHead = function (opts) { var i, arr = []; if (opts.showWeekNumber) { arr.push('<th></th>'); Loading @@ -378,8 +354,7 @@ return '<thead><tr>' + (opts.isRTL ? arr.reverse() : arr).join('') + '</tr></thead>'; }, renderTitle = function(instance, c, year, month, refYear, randId) { renderTitle = function (instance, c, year, month, refYear, randId) { var i, j, arr, opts = instance._o, isMinYear = year === opts.minYear, Loading Loading @@ -438,22 +413,18 @@ return html += '</div>'; }, renderTable = function(opts, data, randId) { renderTable = function (opts, data, randId) { return '<table cellpadding="0" cellspacing="0" class="pika-table" role="grid" aria-labelledby="' + randId + '">' + renderHead(opts) + renderBody(data) + '</table>'; }, /** * Pikaday constructor */ Pikaday = function(options) { Pikaday = function (options) { var self = this, opts = self.config(options); self._onMouseDown = function(e) { self._onMouseDown = function (e) { if (!self._v) { return; } Loading Loading @@ -495,8 +466,7 @@ } }; self._onChange = function(e) { self._onChange = function (e) { e = e || window.event; var target = e.target || e.srcElement; if (!target) { Loading @@ -510,8 +480,7 @@ } }; self._onKeyChange = function(e) { self._onKeyChange = function (e) { e = e || window.event; if (self.isVisible()) { Loading @@ -523,16 +492,20 @@ opts.field.blur(); } break; case 37: e.preventDefault(); self.adjustDate('subtract', 1); break; case 38: self.adjustDate('subtract', 7); break; case 39: self.adjustDate('add', 1); break; case 40: self.adjustDate('add', 7); break; Loading @@ -540,8 +513,7 @@ } }; self._onInputChange = function(e) { self._onInputChange = function (e) { var date; if (e.firedBy === self) { Loading @@ -564,18 +536,15 @@ } }; self._onInputFocus = function() { self._onInputFocus = function () { self.show(); }; self._onInputClick = function() { self._onInputClick = function () { self.show(); }; self._onInputBlur = function() { self._onInputBlur = function () { // IE allows pika div to gain focus; catch blur the input field var pEl = document.activeElement; do { Loading @@ -593,8 +562,7 @@ self._c = false; }; self._onClick = function(e) { self._onClick = function (e) { e = e || window.event; var target = e.target || e.srcElement, pEl = target; Loading Loading @@ -672,18 +640,15 @@ } }; /** * public Pikaday API */ Pikaday.prototype = { /** * configure functionality */ config: function(options) { config: function (options) { if (!this._o) { this._o = extend({}, defaults, true); } Loading Loading @@ -740,8 +705,7 @@ /** * return a formatted string of the current selection (using Moment.js if available) */ toString: function(format) { toString: function (format) { format = format || this._o.format; if (!isDate(this._d)) { return ''; Loading @@ -758,16 +722,14 @@ /** * return a Moment.js object of the current selection (if available) */ getMoment: function() { getMoment: function () { return hasMoment ? moment(this._d) : null; }, /** * set the current selection from a Moment.js object (if available) */ setMoment: function(date, preventOnSelect) { setMoment: function (date, preventOnSelect) { if (hasMoment && moment.isMoment(date)) { this.setDate(date.toDate(), preventOnSelect); } Loading @@ -776,16 +738,14 @@ /** * return a Date object of the current selection */ getDate: function() { getDate: function () { return isDate(this._d) ? new Date(this._d.getTime()) : null; }, /** * set the current selection */ setDate: function(date, preventOnSelect) { setDate: function (date, preventOnSelect) { if (!date) { this._d = null; Loading Loading @@ -828,8 +788,7 @@ /** * change view to a specific date */ gotoDate: function(date) { gotoDate: function (date) { var newCalendar = true; if (!isDate(date)) { Loading Loading @@ -886,30 +845,26 @@ this.draw(); }, gotoToday: function() { gotoToday: function () { this.gotoDate(new Date()); }, /** * change view to a specific month (zero-index, e.g. 0: January) */ gotoMonth: function(month) { gotoMonth: function (month) { if (!isNaN(month)) { this.calendars[0].month = parseInt(month, 10); this.adjustCalendars(); } }, nextMonth: function() { nextMonth: function () { this.calendars[0].month++; this.adjustCalendars(); }, prevMonth: function() { prevMonth: function () { this.calendars[0].month--; this.adjustCalendars(); }, Loading @@ -917,8 +872,7 @@ /** * change view to a specific full year (e.g. "2012") */ gotoYear: function(year) { gotoYear: function (year) { if (!isNaN(year)) { this.calendars[0].year = parseInt(year, 10); this.adjustCalendars(); Loading @@ -928,8 +882,7 @@ /** * change the minDate */ setMinDate: function(value) { setMinDate: function (value) { if(value instanceof Date) { setToStartOfDay(value); this._o.minDate = value; Loading @@ -948,8 +901,7 @@ /** * change the maxDate */ setMaxDate: function(value) { setMaxDate: function (value) { if(value instanceof Date) { setToStartOfDay(value); this._o.maxDate = value; Loading @@ -965,21 +917,18 @@ this.draw(); }, setStartRange: function(value) { setStartRange: function (value) { this._o.startRange = value; }, setEndRange: function(value) { setEndRange: function (value) { this._o.endRange = value; }, /** * refresh the HTML */ draw: function(force) { draw: function (force) { if (!this._v && !force) { return; } Loading Loading @@ -1030,11 +979,11 @@ } }, adjustPosition: function() { adjustPosition: function () { var field, pEl, width, height, viewportWidth, viewportHeight, scrollTop, left, top, clientRect, leftAligned, bottomAligned; if (this._o.container) return; if (this._o.container) { return; } this.el.style.position = 'absolute'; Loading Loading @@ -1093,8 +1042,7 @@ /** * render HTML for a particular month */ render: function(year, month, randId) { render: function (year, month, randId) { var opts = this._o, now = new Date(), days = getDaysInMonth(year, month), Loading Loading @@ -1185,13 +1133,11 @@ return renderTable(opts, data, randId); }, isVisible: function() { isVisible: function () { return this._v; }, show: function() { show: function () { if (!this.isVisible()) { this._v = true; this.draw(); Loading @@ -1206,8 +1152,7 @@ } }, hide: function() { hide: function () { var v = this._v; if (v !== false) { if (this._o.bound) { Loading @@ -1227,8 +1172,7 @@ /** * GAME OVER */ destroy: function() { destroy: function () { var opts = this._o; this.hide(); Loading pikaday.module +1 −10 Changes for pikaday.module: 1 added line, 10 removed lines. Original line number Diff line number Diff line Loading @@ -6,10 +6,8 @@ */ use Drupal\Core\Routing\RouteMatchInterface; use Drupal\pikaday\Form\PikadaySettingsForm; use Drupal\Core\Form\FormStateInterface; /** * Implements hook_help(). */ Loading Loading @@ -43,7 +41,7 @@ function pikaday_help($route_name, RouteMatchInterface $route_match) { * Implements hook_form_alter(). */ function pikaday_form_alter(&$form, FormStateInterface $form_state, $form_id) { //echo $form_id; // Echo $form_id;. module_load_include('inc', 'pikaday', 'pikaday.settings'); if ($check = checkPikadayEnabled()) { $formIds = getPikadayFormIds(); Loading @@ -52,10 +50,3 @@ function pikaday_form_alter(&$form, FormStateInterface $form_state, $form_id) { } } } /** * Implements hook_uninstall(). */ function pikaday_uninstall() { // TODO: To uninstall the variables and configurations. } No newline at end of file pikaday.settings.inc +12 −8 Changes for pikaday.settings.inc: 12 added lines, 8 removed lines. Original line number Diff line number Diff line <?php /** * @file * Provide utility settings functions for the file. */ use Drupal\pikaday\Form\PikadaySettingsForm; /** * Get Pikaday Form Ids * Get Pikaday Form Ids. */ function getPikadayFormIds() { function get_pikaday_form_ids() { $config = \Drupal::config(PikadaySettingsForm::SETTINGS); $pikadayFormIds = $config->get('pikaday_formids'); if ($pikadayFormIds) { Loading @@ -14,18 +19,17 @@ function getPikadayFormIds() { return $result; } } return false; return FALSE; } /** * Check Pikaday Enabled from Admin Configuration * Goto Site >> Config >> Development >> Pikaday Settings > Enable/Disable. * Check Pikaday Enabled from Admin Configuration. */ function checkPikadayEnabled() { function check_pikaday_enabled() { $config = \Drupal::config(PikadaySettingsForm::SETTINGS); $pikadayEnabled = $config->get('pikaday_enable'); if ($pikadayEnabled) { return true; return TRUE; } return false; return FALSE; } Loading
README.txt +2 −1 Changes for README.txt: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -12,7 +12,8 @@ If you're using jQuery make sure to pass only the first element: var picker = new Pikaday({ field: $('#datepicker')[0] }); If the Pikaday instance is not bound to a field you can append the element anywhere: If the Pikaday instance is not bound to a field you can append the element anywhere: var field = document.getElementById('datepicker'); var picker = new Pikaday({ Loading
css/pikaday.css +8 −5 Changes for css/pikaday.css: 8 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -25,8 +25,12 @@ http://nicolasgallagher.com/micro-clearfix-hack/ content: " "; display: table; } .pika-single:after { clear: both } .pika-single { *zoom: 1 } .pika-single:after { clear: both; } .pika-single { *zoom: 1; } .pika-single.is-hidden { display: none; Loading Loading @@ -189,12 +193,12 @@ http://nicolasgallagher.com/micro-clearfix-hack/ .is-disabled .pika-button, .is-inrange .pika-button { background: #D5E9F7; background: #d5e9f7; } .is-startrange .pika-button { color: #fff; background: #6CB31D; background: #6cb31d; box-shadow: none; border-radius: 3px; } Loading Loading @@ -236,4 +240,3 @@ http://nicolasgallagher.com/micro-clearfix-hack/ border-bottom: none; cursor: help; }
js/pikaday.js +66 −122 Changes for js/pikaday.js: 66 added lines, 122 removed lines. Original line number Diff line number Diff line Loading @@ -4,8 +4,7 @@ * Copyright © 2014 David Bushell | BSD & MIT license | https://github.com/Pikaday/Pikaday */ (function (root, factory) { (function (root, factory) { 'use strict'; var moment; Loading @@ -16,8 +15,7 @@ module.exports = factory(moment); } else if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(function (req) { define(function (req) { // Load moment.js as an optional dependency var id = 'moment'; try { moment = req(id); } catch (e) {} Loading @@ -26,8 +24,7 @@ } else { root.Pikaday = factory(root.moment); } }(this, function (moment) { }(this, function (moment) { 'use strict'; /** Loading @@ -41,8 +38,7 @@ sto = window.setTimeout, addEvent = function(el, e, callback, capture) { addEvent = function (el, e, callback, capture) { if (hasEventListeners) { el.addEventListener(e, callback, !!capture); } else { Loading @@ -50,8 +46,7 @@ } }, removeEvent = function(el, e, callback, capture) { removeEvent = function (el, e, callback, capture) { if (hasEventListeners) { el.removeEventListener(e, callback, !!capture); } else { Loading @@ -59,68 +54,57 @@ } }, trim = function(str) { trim = function (str) { return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g,''); }, hasClass = function(el, cn) { hasClass = function (el, cn) { return (' ' + el.className + ' ').indexOf(' ' + cn + ' ') !== -1; }, addClass = function(el, cn) { addClass = function (el, cn) { if (!hasClass(el, cn)) { el.className = (el.className === '') ? cn : el.className + ' ' + cn; } }, removeClass = function(el, cn) { removeClass = function (el, cn) { el.className = trim((' ' + el.className + ' ').replace(' ' + cn + ' ', ' ')); }, isArray = function(obj) { isArray = function (obj) { return (/Array/).test(Object.prototype.toString.call(obj)); }, isDate = function(obj) { isDate = function (obj) { return (/Date/).test(Object.prototype.toString.call(obj)) && !isNaN(obj.getTime()); }, isWeekend = function(date) { isWeekend = function (date) { var day = date.getDay(); return day === 0 || day === 6; }, isLeapYear = function(year) { isLeapYear = function (year) { // solution by Matti Virkkunen: http://stackoverflow.com/a/4881951 return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; }, getDaysInMonth = function(year, month) { getDaysInMonth = function (year, month) { return [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; }, setToStartOfDay = function(date) { if (isDate(date)) date.setHours(0,0,0,0); setToStartOfDay = function (date) { if (isDate(date)) { date.setHours(0,0,0,0); } }, compareDates = function(a,b) { compareDates = function (a,b) { // weak date comparison (use setToStartOfDay(date) to ensure correct result) return a.getTime() === b.getTime(); }, extend = function(to, from, overwrite) { extend = function (to, from, overwrite) { var prop, hasProp; for (prop in from) { hasProp = to[prop] !== undefined; Loading @@ -144,8 +128,7 @@ return to; }, fireEvent = function(el, eventName, data) { fireEvent = function (el, eventName, data) { var ev; if (document.createEvent) { Loading Loading @@ -290,12 +273,10 @@ keyboardInput: true }, /** * templating functions to abstract HTML rendering */ renderDayName = function(opts, day, abbr) { renderDayName = function (opts, day, abbr) { day += opts.firstDay; while (day >= 7) { day -= 7; Loading @@ -303,8 +284,7 @@ return abbr ? opts.i18n.weekdaysShort[day] : opts.i18n.weekdays[day]; }, renderDay = function(opts) { renderDay = function (opts) { var arr = []; var ariaSelected = 'false'; if (opts.isEmpty) { Loading Loading @@ -345,8 +325,7 @@ '<button class="pika-button pika-day" type="button" ' + 'data-pika-year="' + opts.year + '" data-pika-month="' + opts.month + '" data-pika-day="' + opts.day + '">' + opts.day + '</button>' + '</td>'; '</button></td>'; }, renderWeek = function (d, m, y) { Loading @@ -356,18 +335,15 @@ return '<td class="pika-week">' + weekNum + '</td>'; }, renderRow = function(days, isRTL, pickWholeWeek, isRowSelected) { renderRow = function (days, isRTL, pickWholeWeek, isRowSelected) { return '<tr class="pika-row' + (pickWholeWeek ? ' pick-whole-week' : '') + (isRowSelected ? ' is-selected' : '') + '">' + (isRTL ? days.reverse() : days).join('') + '</tr>'; }, renderBody = function(rows) { renderBody = function (rows) { return '<tbody>' + rows.join('') + '</tbody>'; }, renderHead = function(opts) { renderHead = function (opts) { var i, arr = []; if (opts.showWeekNumber) { arr.push('<th></th>'); Loading @@ -378,8 +354,7 @@ return '<thead><tr>' + (opts.isRTL ? arr.reverse() : arr).join('') + '</tr></thead>'; }, renderTitle = function(instance, c, year, month, refYear, randId) { renderTitle = function (instance, c, year, month, refYear, randId) { var i, j, arr, opts = instance._o, isMinYear = year === opts.minYear, Loading Loading @@ -438,22 +413,18 @@ return html += '</div>'; }, renderTable = function(opts, data, randId) { renderTable = function (opts, data, randId) { return '<table cellpadding="0" cellspacing="0" class="pika-table" role="grid" aria-labelledby="' + randId + '">' + renderHead(opts) + renderBody(data) + '</table>'; }, /** * Pikaday constructor */ Pikaday = function(options) { Pikaday = function (options) { var self = this, opts = self.config(options); self._onMouseDown = function(e) { self._onMouseDown = function (e) { if (!self._v) { return; } Loading Loading @@ -495,8 +466,7 @@ } }; self._onChange = function(e) { self._onChange = function (e) { e = e || window.event; var target = e.target || e.srcElement; if (!target) { Loading @@ -510,8 +480,7 @@ } }; self._onKeyChange = function(e) { self._onKeyChange = function (e) { e = e || window.event; if (self.isVisible()) { Loading @@ -523,16 +492,20 @@ opts.field.blur(); } break; case 37: e.preventDefault(); self.adjustDate('subtract', 1); break; case 38: self.adjustDate('subtract', 7); break; case 39: self.adjustDate('add', 1); break; case 40: self.adjustDate('add', 7); break; Loading @@ -540,8 +513,7 @@ } }; self._onInputChange = function(e) { self._onInputChange = function (e) { var date; if (e.firedBy === self) { Loading @@ -564,18 +536,15 @@ } }; self._onInputFocus = function() { self._onInputFocus = function () { self.show(); }; self._onInputClick = function() { self._onInputClick = function () { self.show(); }; self._onInputBlur = function() { self._onInputBlur = function () { // IE allows pika div to gain focus; catch blur the input field var pEl = document.activeElement; do { Loading @@ -593,8 +562,7 @@ self._c = false; }; self._onClick = function(e) { self._onClick = function (e) { e = e || window.event; var target = e.target || e.srcElement, pEl = target; Loading Loading @@ -672,18 +640,15 @@ } }; /** * public Pikaday API */ Pikaday.prototype = { /** * configure functionality */ config: function(options) { config: function (options) { if (!this._o) { this._o = extend({}, defaults, true); } Loading Loading @@ -740,8 +705,7 @@ /** * return a formatted string of the current selection (using Moment.js if available) */ toString: function(format) { toString: function (format) { format = format || this._o.format; if (!isDate(this._d)) { return ''; Loading @@ -758,16 +722,14 @@ /** * return a Moment.js object of the current selection (if available) */ getMoment: function() { getMoment: function () { return hasMoment ? moment(this._d) : null; }, /** * set the current selection from a Moment.js object (if available) */ setMoment: function(date, preventOnSelect) { setMoment: function (date, preventOnSelect) { if (hasMoment && moment.isMoment(date)) { this.setDate(date.toDate(), preventOnSelect); } Loading @@ -776,16 +738,14 @@ /** * return a Date object of the current selection */ getDate: function() { getDate: function () { return isDate(this._d) ? new Date(this._d.getTime()) : null; }, /** * set the current selection */ setDate: function(date, preventOnSelect) { setDate: function (date, preventOnSelect) { if (!date) { this._d = null; Loading Loading @@ -828,8 +788,7 @@ /** * change view to a specific date */ gotoDate: function(date) { gotoDate: function (date) { var newCalendar = true; if (!isDate(date)) { Loading Loading @@ -886,30 +845,26 @@ this.draw(); }, gotoToday: function() { gotoToday: function () { this.gotoDate(new Date()); }, /** * change view to a specific month (zero-index, e.g. 0: January) */ gotoMonth: function(month) { gotoMonth: function (month) { if (!isNaN(month)) { this.calendars[0].month = parseInt(month, 10); this.adjustCalendars(); } }, nextMonth: function() { nextMonth: function () { this.calendars[0].month++; this.adjustCalendars(); }, prevMonth: function() { prevMonth: function () { this.calendars[0].month--; this.adjustCalendars(); }, Loading @@ -917,8 +872,7 @@ /** * change view to a specific full year (e.g. "2012") */ gotoYear: function(year) { gotoYear: function (year) { if (!isNaN(year)) { this.calendars[0].year = parseInt(year, 10); this.adjustCalendars(); Loading @@ -928,8 +882,7 @@ /** * change the minDate */ setMinDate: function(value) { setMinDate: function (value) { if(value instanceof Date) { setToStartOfDay(value); this._o.minDate = value; Loading @@ -948,8 +901,7 @@ /** * change the maxDate */ setMaxDate: function(value) { setMaxDate: function (value) { if(value instanceof Date) { setToStartOfDay(value); this._o.maxDate = value; Loading @@ -965,21 +917,18 @@ this.draw(); }, setStartRange: function(value) { setStartRange: function (value) { this._o.startRange = value; }, setEndRange: function(value) { setEndRange: function (value) { this._o.endRange = value; }, /** * refresh the HTML */ draw: function(force) { draw: function (force) { if (!this._v && !force) { return; } Loading Loading @@ -1030,11 +979,11 @@ } }, adjustPosition: function() { adjustPosition: function () { var field, pEl, width, height, viewportWidth, viewportHeight, scrollTop, left, top, clientRect, leftAligned, bottomAligned; if (this._o.container) return; if (this._o.container) { return; } this.el.style.position = 'absolute'; Loading Loading @@ -1093,8 +1042,7 @@ /** * render HTML for a particular month */ render: function(year, month, randId) { render: function (year, month, randId) { var opts = this._o, now = new Date(), days = getDaysInMonth(year, month), Loading Loading @@ -1185,13 +1133,11 @@ return renderTable(opts, data, randId); }, isVisible: function() { isVisible: function () { return this._v; }, show: function() { show: function () { if (!this.isVisible()) { this._v = true; this.draw(); Loading @@ -1206,8 +1152,7 @@ } }, hide: function() { hide: function () { var v = this._v; if (v !== false) { if (this._o.bound) { Loading @@ -1227,8 +1172,7 @@ /** * GAME OVER */ destroy: function() { destroy: function () { var opts = this._o; this.hide(); Loading
pikaday.module +1 −10 Changes for pikaday.module: 1 added line, 10 removed lines. Original line number Diff line number Diff line Loading @@ -6,10 +6,8 @@ */ use Drupal\Core\Routing\RouteMatchInterface; use Drupal\pikaday\Form\PikadaySettingsForm; use Drupal\Core\Form\FormStateInterface; /** * Implements hook_help(). */ Loading Loading @@ -43,7 +41,7 @@ function pikaday_help($route_name, RouteMatchInterface $route_match) { * Implements hook_form_alter(). */ function pikaday_form_alter(&$form, FormStateInterface $form_state, $form_id) { //echo $form_id; // Echo $form_id;. module_load_include('inc', 'pikaday', 'pikaday.settings'); if ($check = checkPikadayEnabled()) { $formIds = getPikadayFormIds(); Loading @@ -52,10 +50,3 @@ function pikaday_form_alter(&$form, FormStateInterface $form_state, $form_id) { } } } /** * Implements hook_uninstall(). */ function pikaday_uninstall() { // TODO: To uninstall the variables and configurations. } No newline at end of file
pikaday.settings.inc +12 −8 Changes for pikaday.settings.inc: 12 added lines, 8 removed lines. Original line number Diff line number Diff line <?php /** * @file * Provide utility settings functions for the file. */ use Drupal\pikaday\Form\PikadaySettingsForm; /** * Get Pikaday Form Ids * Get Pikaday Form Ids. */ function getPikadayFormIds() { function get_pikaday_form_ids() { $config = \Drupal::config(PikadaySettingsForm::SETTINGS); $pikadayFormIds = $config->get('pikaday_formids'); if ($pikadayFormIds) { Loading @@ -14,18 +19,17 @@ function getPikadayFormIds() { return $result; } } return false; return FALSE; } /** * Check Pikaday Enabled from Admin Configuration * Goto Site >> Config >> Development >> Pikaday Settings > Enable/Disable. * Check Pikaday Enabled from Admin Configuration. */ function checkPikadayEnabled() { function check_pikaday_enabled() { $config = \Drupal::config(PikadaySettingsForm::SETTINGS); $pikadayEnabled = $config->get('pikaday_enable'); if ($pikadayEnabled) { return true; return TRUE; } return false; return FALSE; }