mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-13 17:35:46 +01:00
added public/src/admin.js; moved enableColorPicker into admin.enableColorPicker
This commit is contained in:
19
public/src/admin.js
Normal file
19
public/src/admin.js
Normal file
@@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
}());
|
||||
@@ -142,10 +142,7 @@ define(['uploader'], function(uploader) {
|
||||
var $inputEl = $(inputEl),
|
||||
previewEl = $inputEl.parents('[data-cid]').find('.preview-box');
|
||||
|
||||
$inputEl.ColorPicker({
|
||||
color: $inputEl.val() || '#000',
|
||||
onChange: function(hsb, hex) {
|
||||
$inputEl.val('#' + hex);
|
||||
admin.enableColorPicker($inputEl, function(hsb, hex) {
|
||||
if ($inputEl.attr('data-name') === 'bgColor') {
|
||||
previewEl.css('background', '#' + hex);
|
||||
} else if ($inputEl.attr('data-name') === 'color') {
|
||||
@@ -153,7 +150,6 @@ define(['uploader'], function(uploader) {
|
||||
}
|
||||
|
||||
modified($inputEl[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user