Skip to content

Node.js based forum software built for the modern web

updated enableColorPicker to accept either a jQ obj or a string; updated it to be able to initialize several inputs at once

psychobunny4cf6ebda7bff
diff --git a/public/src/admin.js b/public/src/admin.js
index 3d6b8c40f0..65a7504208 100644
--- a/public/src/admin.js
+++ b/public/src/admin.js
@@ -5,15 +5,19 @@ var admin = {};
(function() {
admin.enableColorPicker = function(inputEl, callback) {
- inputEl.ColorPicker({
- color: inputEl.val() || '#000',
- onChange: function(hsb, hex) {
- inputEl.val('#' + hex);
- if (typeof callback === 'function') {
- callback(hsb, hex);
+ (inputEl instanceof jQuery ? inputEl : $(inputEl)).each(function() {
+ var $this = $(this);
+
+ $this.ColorPicker({
+ color: $this.val() || '#000',
+ onChange: function(hsb, hex) {
+ $this.val('#' + hex);
+ if (typeof callback === 'function') {
+ callback(hsb, hex);
+ }
}
- }
- });
+ });
+ });
};
}());
\ No newline at end of file