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

v1.18.x
psychobunny 11 years ago
parent 29137299c2
commit 4cf6ebda7b

@ -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);
onChange: function(hsb, hex) {
inputEl.val('#' + hex); $this.ColorPicker({
if (typeof callback === 'function') { color: $this.val() || '#000',
callback(hsb, hex); onChange: function(hsb, hex) {
$this.val('#' + hex);
if (typeof callback === 'function') {
callback(hsb, hex);
}
} }
} });
}); });
}; };
}()); }());
Loading…
Cancel
Save