pandora_bakma/static/js/localInit.bakma.js

53 lines
1.3 KiB
JavaScript

pandora.localInit = function() {
if (!["admin", "staff"].includes(pandora.user.level)) {
return
}
var plugins = [];
plugins.push(ExtrasMenu());
plugins.length && load();
function load() {
patchReload();
plugins.forEach(function(plugin) { plugin.load() });
}
function patchReload() {
var reload = pandora.$ui.appPanel.reload;
pandora.$ui.appPanel.reload = function() {
reload();
load();
}
}
function ExtrasMenu() {
var that = {};
var css = {
//margin: '2px',
},
$item = Ox.MenuButton({
items: [
{id: 'rename', title: 'Rename Annotation...'},
],
style: 'rounded',
title: 'set',
tooltip: Ox._('Extras'),
type: 'image'
}).css(css).bindEvent({
click: function(data) {
if (data.id == 'rename') {
pandora.ui.renameAnnotationDialog().open()
}
},
}),
plugins = [];
that.load = function() {
pandora.$ui.mainMenu.find('.OxExtras').prepend($item);
pandora.$ui.extraItem = $item;
};
return that;
}
}