mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-14 01:45:47 +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),
|
var $inputEl = $(inputEl),
|
||||||
previewEl = $inputEl.parents('[data-cid]').find('.preview-box');
|
previewEl = $inputEl.parents('[data-cid]').find('.preview-box');
|
||||||
|
|
||||||
$inputEl.ColorPicker({
|
admin.enableColorPicker($inputEl, function(hsb, hex) {
|
||||||
color: $inputEl.val() || '#000',
|
|
||||||
onChange: function(hsb, hex) {
|
|
||||||
$inputEl.val('#' + hex);
|
|
||||||
if ($inputEl.attr('data-name') === 'bgColor') {
|
if ($inputEl.attr('data-name') === 'bgColor') {
|
||||||
previewEl.css('background', '#' + hex);
|
previewEl.css('background', '#' + hex);
|
||||||
} else if ($inputEl.attr('data-name') === 'color') {
|
} else if ($inputEl.attr('data-name') === 'color') {
|
||||||
@@ -153,7 +150,6 @@ define(['uploader'], function(uploader) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
modified($inputEl[0]);
|
modified($inputEl[0]);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user