mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 14:35:47 +01:00
removed global admin object, CF rocket loader fix
added colorpicker module
This commit is contained in:
@@ -1,28 +1,7 @@
|
||||
"use strict";
|
||||
/*global define, socket, app, ajaxify, utils, Mousetrap, Hammer, RELATIVE_PATH*/
|
||||
|
||||
var admin = {};
|
||||
|
||||
(function() {
|
||||
admin.enableColorPicker = function(inputEl, callback) {
|
||||
(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);
|
||||
}
|
||||
},
|
||||
onShow: function(colpkr) {
|
||||
$(colpkr).css('z-index', 1051);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$(document).ready(function() {
|
||||
setupMenu();
|
||||
setupKeybindings();
|
||||
@@ -151,7 +130,7 @@ var admin = {};
|
||||
|
||||
function modifyBreadcrumb() {
|
||||
var caret = ' <i class="fa fa-angle-right"></i> ';
|
||||
|
||||
|
||||
$('#breadcrumbs').html(caret + Array.prototype.slice.call(arguments).join(caret));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
"use strict";
|
||||
/*global define, socket, app, bootbox, templates, ajaxify, RELATIVE_PATH*/
|
||||
|
||||
define('admin/manage/categories', ['uploader', 'admin/modules/iconSelect'], function(uploader, iconSelect) {
|
||||
define('admin/manage/categories', [
|
||||
'uploader',
|
||||
'admin/modules/iconSelect',
|
||||
'admin/modules/colorpicker'
|
||||
], function(uploader, iconSelect, colorpicker) {
|
||||
var Categories = {};
|
||||
|
||||
Categories.init = function() {
|
||||
@@ -98,7 +102,7 @@ define('admin/manage/categories', ['uploader', 'admin/modules/iconSelect'], func
|
||||
var $inputEl = $(inputEl),
|
||||
previewEl = $inputEl.parents('[data-cid]').find('.preview-box');
|
||||
|
||||
admin.enableColorPicker($inputEl, function(hsb, hex) {
|
||||
colorpicker.enable($inputEl, function(hsb, hex) {
|
||||
if ($inputEl.attr('data-name') === 'bgColor') {
|
||||
previewEl.css('background', '#' + hex);
|
||||
} else if ($inputEl.attr('data-name') === 'color') {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
"use strict";
|
||||
/*global define, templates, socket, ajaxify, app, admin, bootbox*/
|
||||
|
||||
define('admin/manage/groups', ['admin/modules/iconSelect'], function(iconSelect) {
|
||||
define('admin/manage/groups', [
|
||||
'admin/modules/iconSelect',
|
||||
'admin/modules/colorpicker'
|
||||
], function(iconSelect, colorpicker) {
|
||||
var Groups = {};
|
||||
|
||||
Groups.init = function() {
|
||||
@@ -219,7 +222,7 @@ define('admin/manage/groups', ['admin/modules/iconSelect'], function(iconSelect)
|
||||
iconSelect.init(groupIcon);
|
||||
});
|
||||
|
||||
admin.enableColorPicker(changeGroupLabelColor, function(hsb, hex) {
|
||||
colorpicker.enable(changeGroupLabelColor, function(hsb, hex) {
|
||||
groupLabelPreview.css('background-color', '#' + hex);
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
"use strict";
|
||||
/*global define, socket, app, admin, utils, bootbox, RELATIVE_PATH*/
|
||||
|
||||
define('admin/manage/tags', ['forum/infinitescroll', 'admin/modules/selectable'], function(infinitescroll, selectable) {
|
||||
define('admin/manage/tags', [
|
||||
'forum/infinitescroll',
|
||||
'admin/modules/selectable',
|
||||
'admin/modules/colorpicker'
|
||||
], function(infinitescroll, selectable, colorpicker) {
|
||||
var Tags = {},
|
||||
timeoutId = 0;
|
||||
|
||||
@@ -111,7 +115,7 @@ define('admin/manage/tags', ['forum/infinitescroll', 'admin/modules/selectable']
|
||||
var $inputEl = $(inputEl),
|
||||
previewEl = $inputEl.parents('.tag-row').find('.tag-item');
|
||||
|
||||
admin.enableColorPicker($inputEl, function(hsb, hex) {
|
||||
colorpicker.enable($inputEl, function(hsb, hex) {
|
||||
if ($inputEl.attr('data-name') === 'bgColor') {
|
||||
previewEl.css('background-color', '#' + hex);
|
||||
} else if ($inputEl.attr('data-name') === 'color') {
|
||||
|
||||
28
public/src/admin/modules/colorpicker.js
Normal file
28
public/src/admin/modules/colorpicker.js
Normal file
@@ -0,0 +1,28 @@
|
||||
"use strict";
|
||||
|
||||
/*globals define*/
|
||||
|
||||
define('admin/modules/colorpicker', function() {
|
||||
var colorpicker = {};
|
||||
|
||||
colorpicker.enable = function(inputEl, callback) {
|
||||
(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);
|
||||
}
|
||||
},
|
||||
onShow: function(colpkr) {
|
||||
$(colpkr).css('z-index', 1051);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return colorpicker;
|
||||
});
|
||||
Reference in New Issue
Block a user