Skip to content
Snippets Groups Projects

Drupal 11 compatibility

Files
17
+ 14
11
@@ -6,7 +6,7 @@
/*global jQuery, Drupal, drupalSettings*/
/*jslint white:true, this, browser:true*/
(function ($, Drupal, drupalSettings) {
(function ($, Drupal, drupalSettings, once) {
"use strict";
@@ -108,16 +108,18 @@
}
function inputWatcher(context, htmlID, key) {
$(context).find(htmlID).once("jquery-colorpicker-input-watcher").each(function () {
initializeCSS($(this), key);
initializeElement($(this));
var elements = once("jquery-colorpicker-input-watcher", htmlID, context);
elements.forEach(function (index) {
initializeCSS($(index), key);
initializeElement($(index));
});
}
function removeWatcher(context) {
$(context).find(".jquery_field_remove_link").once("jquery-colorpicker-remove-watcher").each(function () {
$(this).click(function () {
$(this).parents(".jquery_colorpicker:first").find("input:first").val("").parents("tr:first").hide();
var elements = once("jquery-colorpicker-remove-watcher", ".jquery_field_remove_link", context);
elements.forEach(function (index) {
$(index).click(function () {
$(index).parents(".jquery_colorpicker:first").find("input:first").val("").parents("tr:first").hide();
return false;
});
@@ -125,9 +127,10 @@
}
function clearWatcher(context) {
$(context).find(".jquery_field_clear_link").once("jquery-colorpicker-clear-watcher").each(function () {
$(this).click(function () {
$(this).parents(".jquery_colorpicker:first").find(".color_picker:first").css("background-color", "#FFFFFF").find("input:first").val("");
var elements = once("jquery-colorpicker-clear-watcher", ".jquery_field_clear_link", context);
elements.forEach(function (index) {
$(index).click(function () {
$(index).parents(".jquery_colorpicker:first").find(".color_picker:first").css("background-color", "#FFFFFF").find("input:first").val("");
return false;
});
@@ -152,4 +155,4 @@
}
};
}(jQuery, Drupal, drupalSettings));
}(jQuery, Drupal, drupalSettings, once));
Loading