pandora_amp/static/js/localInit.amp.js
2018-11-05 20:27:03 +00:00

53 lines
1.4 KiB
JavaScript

pandora.localInit = function() {
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: [
].concat(pandora.user.level == 'admin' ? [
] : [], pandora.user.level == 'gurest' ? [] : [
{id: 'import_documents', title: 'Import Documents...'},
]),
style: 'rounded',
title: 'set',
tooltip: Ox._('Extras'),
type: 'image'
}).css(css).bindEvent({
click: function(data) {
if (data.id == 'import_documents') {
pandora.ui.importDocumentsDialog().open();
}
},
}),
plugins = [];
that.load = function() {
pandora.$ui.mainMenu.find('.OxExtras').prepend($item);
pandora.$ui.extraItem = $item;
};
return that;
}
}