fix syntax when referring to events
This commit is contained in:
parent
300b5961e0
commit
7e07a9e2fd
2 changed files with 4 additions and 4 deletions
|
@ -6,7 +6,7 @@ export default class MenuEntry {
|
||||||
/* Create all entries. */
|
/* Create all entries. */
|
||||||
constructor() {
|
constructor() {
|
||||||
// Add the context menu.
|
// Add the context menu.
|
||||||
this.menu = new Menu({title: (new texts(`entry_contextMenu`)).localized, contexts: [`all`], event: {"onClicked": MenuEntry.onclick}, hidden: true});
|
this.menu = new Menu({title: (new texts(`entry_contextMenu`)).localized, contexts: [`all`], events: {"onClicked": MenuEntry.onclick}, hidden: true});
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -22,6 +22,6 @@ export default class MenuEntry {
|
||||||
}
|
}
|
||||||
|
|
||||||
static onclick() {
|
static onclick() {
|
||||||
new ManagedSidebar();
|
ManagedSidebar.enable();
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -15,7 +15,7 @@ export default class Menu {
|
||||||
this.ID = String((ID) ? ID : (Math.random() / Math.random() * 100));
|
this.ID = String((ID) ? ID : (Math.random() / Math.random() * 100));
|
||||||
this.title = (title) ? title : `Menu`;
|
this.title = (title) ? title : `Menu`;
|
||||||
this.contexts = (Array.isArray(contexts)) ? contexts : [`all`];
|
this.contexts = (Array.isArray(contexts)) ? contexts : [`all`];
|
||||||
this.events = (event) ? event : {"onClicked" : function() {}};
|
this.events = (events) ? events : {"onClicked" : function() {}};
|
||||||
this.type = (((typeof type).includes(`str`) && type) ? type.trim() : false) ? type : `normal`;
|
this.type = (((typeof type).includes(`str`) && type) ? type.trim() : false) ? type : `normal`;
|
||||||
|
|
||||||
if (icon) {
|
if (icon) {
|
||||||
|
@ -43,7 +43,7 @@ export default class Menu {
|
||||||
this.hidden = false;
|
this.hidden = false;
|
||||||
this.ID = chrome.contextMenus.create(this.#options);
|
this.ID = chrome.contextMenus.create(this.#options);
|
||||||
|
|
||||||
if (((this.events && (typeof this.events).includes(`obj`) && !Array.isArray(this.events))) ? Object.keys(events) > 0 : false) {
|
if (((this.events && (typeof this.events).includes(`obj`) && !Array.isArray(this.events))) ? Object.keys(this.events) > 0 : false) {
|
||||||
(Object.keys(this.events)).forEach((EVENT) => {
|
(Object.keys(this.events)).forEach((EVENT) => {
|
||||||
chrome.contextMenus[EVENT].addListener((info, tab) => {
|
chrome.contextMenus[EVENT].addListener((info, tab) => {
|
||||||
((info.menuItemId) ? info.menuItemId == this.ID : false)
|
((info.menuItemId) ? info.menuItemId == this.ID : false)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue