From 9b801f33f066181a355c7ff6ddbc09a0b365c5db Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Tue, 23 Apr 2024 22:47:00 +0800 Subject: [PATCH] add show() to show the context menu without re-defining it --- scripts/GUI/context_menus.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/GUI/context_menus.js b/scripts/GUI/context_menus.js index f0b011c..219f33d 100644 --- a/scripts/GUI/context_menus.js +++ b/scripts/GUI/context_menus.js @@ -29,7 +29,7 @@ export default class Menu { }; (this.icon) ? this.#options.icon = this.icon : null; - chrome.contextMenus.create(this.#options); + if (!this.#options.hidden) {this.show(); delete this.#options.hidden;}; delete this.#options.id; }; @@ -37,6 +37,10 @@ export default class Menu { chrome.contextMenus.remove(this.ID); }; + show() { + chrome.contextMenus.create(this.#options); + } + /* Update the context menu. @param {Object} options The new options for the context menu.