Skip to content
Snippets Groups Projects
Commit 199b71a2 authored by Catanoi Lilian's avatar Catanoi Lilian
Browse files

JS improvement

parent 0e06e744
Branches
Tags 8.x-1.1-beta2
No related merge requests found
......@@ -4,13 +4,17 @@
*/
(function ($) {
'use strict';
// Fix conflicts.
$.fn.jonthorntonTimepicker = $.fn.timepicker;
delete $.fn.timepicker;
var initialized;
function applyJonthornton(context, settings) {
if (!initialized) {
initialized = true;
Drupal.behaviors.jqueryJonthorntonTimepicker = {
attach: function (context, settings) {
if (typeof settings.timepicker.jonthornton_timepicker !== 'undefined') {
for (var fieldName in settings.timepicker.jonthornton_timepicker) {
var call = {}.hasOwnProperty.call(
......@@ -35,6 +39,13 @@
}
}
}
}
Drupal.behaviors.jqueryJonthorntonTimepicker = {
attach: function (context, settings) {
// Apply Jonthornton.
applyJonthornton(context, settings);
}
};
}(jQuery));
......@@ -5,13 +5,17 @@
(function ($) {
'use strict';
// Fix conflicts.
$.fn.addonTimepicker = $.fn.timepicker;
$.fn.addonTimePicker = $.fn.timepicker;
delete $.fn.timepicker;
var initialized;
function applyAddonTimepicker(context, settings) {
if (!initialized) {
initialized = true;
Drupal.behaviors.jqueryAddonTimepicker = {
attach: function (context, settings) {
if (typeof settings.timepicker.jquery_addon_timepicker !== 'undefined') {
for (var fieldName in settings.timepicker.jquery_addon_timepicker) {
var call = {}.hasOwnProperty.call(
......@@ -36,10 +40,18 @@
var options = Object.assign(custom, requiredOptions);
// Apply the AddonTimepicker.
$element.addonTimepicker(options);
$element.addonTimePicker(options);
}
}
}
}
}
Drupal.behaviors.jqueryAddonTimepicker = {
attach: function (context, settings) {
// Apply Jonthornton.
applyAddonTimepicker(context, settings);
}
};
}(jQuery));
......@@ -4,14 +4,18 @@
*/
(function ($) {
'use strict';
// Fix conflicts.
$.fn.uiTimepicker = $.fn.timepicker;
delete $.fn.timepicker;
var initialized;
Drupal.behaviors.jqueryUiTimepicker = {
attach: function (context, settings) {
if (typeof settings.timepicker.jquery_ui_timepicker !== 'undefined') {
function applyUITimepicker(context, settings) {
if (!initialized) {
initialized = true;
if (typeof settings.timepicker.jquery_ui_timepicker !== 'undefined') {
for (var fieldName in settings.timepicker.jquery_ui_timepicker) {
var call = {}.hasOwnProperty.call(
settings.timepicker.jquery_ui_timepicker, fieldName
......@@ -35,5 +39,12 @@
}
}
}
}
Drupal.behaviors.jqueryUiTimepicker = {
attach: function (context, settings) {
// Apply Jonthornton.
applyUITimepicker(context, settings);
}
};
}(jQuery));
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment