mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-11 08:25:46 +01:00
updated enableColorPicker to accept either a jQ obj or a string; updated it to be able to initialize several inputs at once
This commit is contained in:
@@ -5,15 +5,19 @@ var admin = {};
|
|||||||
(function() {
|
(function() {
|
||||||
|
|
||||||
admin.enableColorPicker = function(inputEl, callback) {
|
admin.enableColorPicker = function(inputEl, callback) {
|
||||||
inputEl.ColorPicker({
|
(inputEl instanceof jQuery ? inputEl : $(inputEl)).each(function() {
|
||||||
color: inputEl.val() || '#000',
|
var $this = $(this);
|
||||||
|
|
||||||
|
$this.ColorPicker({
|
||||||
|
color: $this.val() || '#000',
|
||||||
onChange: function(hsb, hex) {
|
onChange: function(hsb, hex) {
|
||||||
inputEl.val('#' + hex);
|
$this.val('#' + hex);
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
callback(hsb, hex);
|
callback(hsb, hex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
}());
|
}());
|
||||||
Reference in New Issue
Block a user