mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +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() {
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
}());
|
||||
Reference in New Issue
Block a user