diff --git a/scripts/GUI/entrypoints/popup.js b/scripts/GUI/entrypoints/popup.js new file mode 100644 index 0000000..9bd9149 --- /dev/null +++ b/scripts/GUI/entrypoints/popup.js @@ -0,0 +1,27 @@ +import Popup from "/scripts/GUI/popup.js"; + +export default class ManagedPopup { + constructor () { + this.instance = new Popup({"popup": "/pages/popup.htm", "hidden": true}); + this.listener = chrome.runtime.onMessage.addListener( + (request, sender, sendResponse) => { + (request.action == "popup_open") ? this.enable() : this.disable(); + } + ); + } + + /* + Enable the popup. + */ + enable() { + this.instance.enable(); + } + + /* + Close and disable the popup. + */ + disable() { + // Close the sidebar. + this.instance.disable(); + } +} \ No newline at end of file diff --git a/scripts/GUI/entrypoints/sidebar.js b/scripts/GUI/entrypoints/sidebar.js deleted file mode 100644 index 4065a92..0000000 --- a/scripts/GUI/entrypoints/sidebar.js +++ /dev/null @@ -1,21 +0,0 @@ -import Sidebar from '/scripts/GUI/sidepanel.js' - -export default class ManagedSidebar { - static manage() { - chrome.runtime.onMessage.addListener( - function(request, sender, sendResponse) { - if (request.action == "sidebar_open") { - ManagedSidebar.enable(); - } - } - ); - } - - static enable() { - new Sidebar(`/pages/popup.htm`); - } - - disable() { - - } -} \ No newline at end of file