mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-10 16:05:49 +01:00
removed modules/admin and moved mousetrap + keybindings out of client #2245
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
var admin = {};
|
||||
|
||||
(function() {
|
||||
|
||||
admin.enableColorPicker = function(inputEl, callback) {
|
||||
(inputEl instanceof jQuery ? inputEl : $(inputEl)).each(function() {
|
||||
var $this = $(this);
|
||||
@@ -48,6 +47,8 @@ var admin = {};
|
||||
activate(parentEl);
|
||||
}
|
||||
});
|
||||
|
||||
setupKeybindings();
|
||||
});
|
||||
|
||||
socket.emit('admin.config.get', function(err, config) {
|
||||
@@ -64,4 +65,22 @@ var admin = {};
|
||||
// move this to admin.config
|
||||
app.config = config;
|
||||
});
|
||||
|
||||
function setupKeybindings() {
|
||||
Mousetrap.bind('ctrl+shift+a r', function() {
|
||||
console.log('[admin] Reloading NodeBB...');
|
||||
socket.emit('admin.reload');
|
||||
});
|
||||
|
||||
Mousetrap.bind('ctrl+shift+a R', function() {
|
||||
console.log('[admin] Restarting NodeBB...');
|
||||
socket.emit('admin.restart');
|
||||
});
|
||||
|
||||
Mousetrap.bind('/', function(e) {
|
||||
$('#acp-search input').focus();
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}());
|
||||
@@ -582,11 +582,6 @@ var socket,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Admin keyboard shortcuts
|
||||
require(['admin'], function(Admin) {
|
||||
Admin.init();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
define('admin', ['mousetrap'], function(Mousetrap) {
|
||||
var Admin= {};
|
||||
|
||||
Admin.init = function() {
|
||||
if (app.isAdmin) {
|
||||
Mousetrap.bind('ctrl+shift+a r', function() {
|
||||
console.log('[admin] Reloading NodeBB...');
|
||||
socket.emit('admin.reload');
|
||||
});
|
||||
|
||||
Mousetrap.bind('ctrl+shift+a R', function() {
|
||||
console.log('[admin] Restarting NodeBB...');
|
||||
socket.emit('admin.restart');
|
||||
});
|
||||
|
||||
Mousetrap.bind('/', function(e) {
|
||||
$('#acp-search input').focus();
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return Admin;
|
||||
});
|
||||
@@ -38,7 +38,6 @@ module.exports = function(Meta) {
|
||||
'public/vendor/xregexp/xregexp.js',
|
||||
'public/vendor/xregexp/unicode/unicode-base.js',
|
||||
'public/vendor/buzz/buzz.min.js',
|
||||
'public/vendor/mousetrap/mousetrap.js',
|
||||
'./node_modules/templates.js/lib/templates.js',
|
||||
'public/src/utils.js',
|
||||
'public/src/app.js',
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
<script type="text/javascript" src="{relative_path}/vendor/semver/semver.browser.js"></script>
|
||||
<script type="text/javascript" src="{relative_path}/vendor/jquery/serializeObject/jquery.ba-serializeobject.min.js"></script>
|
||||
<script type="text/javascript" src="{relative_path}/vendor/jquery/deserialize/jquery.deserialize.min.js"></script>
|
||||
<script type="text/javascript" src="{relative_path}/vendor/mousetrap/mousetrap.js"></script>
|
||||
|
||||
<script>
|
||||
require.config({
|
||||
|
||||
Reference in New Issue
Block a user