Skip to content
Snippets Groups Projects
Commit fe005ed7 authored by Ivan Tibezh's avatar Ivan Tibezh Committed by Ivan Tibezh
Browse files

Issue #2934704 by tibezh: Fixed Drupal coding standards according to the ESLint.

parent 8f755e47
Branches
Tags
No related merge requests found
......@@ -5,7 +5,6 @@
(function ($) {
'use strict';
// Fix conflicts.
$.fn.jonthorntonTimepicker = $.fn.timepicker;
......@@ -13,19 +12,20 @@
Drupal.behaviors.jqueryJonthorntonTimepicker = {
attach: function (context, settings) {
if (undefined !== settings.timepicker.jonthornton_timepicker) {
if (typeof settings.timepicker.jonthornton_timepicker !== 'undefined') {
for (var fieldName in settings.timepicker.jonthornton_timepicker) {
// Find the element by field name.
var $element = $('input[name^="' + fieldName + '["][type="time"]', context);
if ({}.hasOwnProperty.call(settings.timepicker.jonthornton_timepicker, fieldName)) {
// Find the element by field name.
var $element = $('input[name^="' + fieldName + '["][type="time"]', context);
// Build options object.
var customOptions = settings.timepicker.jonthornton_timepicker[fieldName];
// The Jonthornton Timepicker works with 'H:i:s' time format.
var requiredOptions = {timeFormat: 'H:i:s'};
var options = Object.assign(customOptions, requiredOptions);
$element.jonthorntonTimepicker(options).attr('type', 'text');
// Build options object.
var customOptions = settings.timepicker.jonthornton_timepicker[fieldName];
// The Jonthornton Timepicker works with 'H:i:s' time format.
var requiredOptions = {timeFormat: 'H:i:s'};
var options = Object.assign(customOptions, requiredOptions);
$element.jonthorntonTimepicker(options).attr('type', 'text');
}
}
}
}
......
......@@ -5,7 +5,6 @@
(function ($) {
'use strict';
// Fix conflicts.
$.fn.addonTimepicker = $.fn.timepicker;
......@@ -13,24 +12,25 @@
Drupal.behaviors.jqueryAddonTimepicker = {
attach: function (context, settings) {
if (undefined !== settings.timepicker.jquery_addon_timepicker) {
if (typeof settings.timepicker.jquery_addon_timepicker !== 'undefined') {
for (var fieldName in settings.timepicker.jquery_addon_timepicker) {
// Find the element by field name.
var $element = $('input[name^="' + fieldName + '["][type="time"]', context);
if ({}.hasOwnProperty.call(settings.timepicker.jquery_addon_timepicker, fieldName)) {
// Find the element by field name.
var $element = $('input[name^="' + fieldName + '["][type="time"]', context);
// Build options object.
var customOptions = settings.timepicker.jquery_addon_timepicker[fieldName];
// Set default hour and minute for the AddonTimepicker.
var timeValues = $element.val().split(':');
var requiredOptions = {
"hour": timeValues[0],
"minute": timeValues[1]
};
var options = Object.assign(customOptions, requiredOptions);
// Apply the AddonTimepicker.
$element.addonTimepicker(options);
// Build options object.
var customOptions = settings.timepicker.jquery_addon_timepicker[fieldName];
// Set default hour and minute for the AddonTimepicker.
var timeValues = $element.val().split(':');
var requiredOptions = {
hour: timeValues[0],
minute: timeValues[1]
};
var options = Object.assign(customOptions, requiredOptions);
// Apply the AddonTimepicker.
$element.addonTimepicker(options);
}
}
}
}
......
......@@ -4,7 +4,6 @@
*/
(function ($) {
'use strict';
// Fix conflicts.
$.fn.uiTimepicker = $.fn.timepicker;
......@@ -12,19 +11,20 @@
Drupal.behaviors.jqueryUiTimepicker = {
attach: function (context, settings) {
if (undefined !== settings.timepicker.jquery_ui_timepicker) {
if (typeof settings.timepicker.jquery_ui_timepicker !== 'undefined') {
for (var fieldName in settings.timepicker.jquery_ui_timepicker) {
// Find the element by field name.
var $element = $('input[name^="' + fieldName + '["][type="time"]', context);
if ({}.hasOwnProperty.call(settings.timepicker.jquery_ui_timepicker, fieldName)) {
// Find the element by field name.
var $element = $('input[name^="' + fieldName + '["][type="time"]', context);
// Build options object.
var customOptions = settings.timepicker.jquery_ui_timepicker[fieldName];
// Set default hour and minute for the jQueryUITimepicker.
var requiredOptions = {};
var options = Object.assign(customOptions, requiredOptions);
$element.uiTimepicker(options);
// Build options object.
var customOptions = settings.timepicker.jquery_ui_timepicker[fieldName];
// Set default hour and minute for the jQueryUITimepicker.
var requiredOptions = {};
var options = Object.assign(customOptions, requiredOptions);
$element.uiTimepicker(options);
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment