From 6577df36a072fafd6d68fad86c02b9fa5bd20d8b Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Sat, 27 Apr 2024 23:33:01 +0800 Subject: [PATCH] remove incompatible sidepanel module --- scripts/GUI/sidepanel.js | 69 ---------------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 scripts/GUI/sidepanel.js diff --git a/scripts/GUI/sidepanel.js b/scripts/GUI/sidepanel.js deleted file mode 100644 index a829bc4..0000000 --- a/scripts/GUI/sidepanel.js +++ /dev/null @@ -1,69 +0,0 @@ -// Manage the sidepanel. -// The sidepanel is what I'll call the Sidebar. - -import Tabs from './tabs.js'; - -export default class Sidebar { - options; // The options for the sidebar - path; // The URL of the sidebar - focused; // The focused state of the sidebar. - hidden; // The hidden state of the sidebar. - - /* - Create a new sidebar. - - @param {string} PATH the path of the file to be displayed by the sidebar - */ - constructor (PATH) { - // Set the side panel options. - this.options = ((typeof PATH).includes(`str`)) ? { "path": PATH } : PATH; - - // Determine whether the sidebar is open. - this.hidden = (Object.keys(this.options).length > 0 ? (this.options.hidden != null) : false) ? this.options.hidden : false; - delete this.options.hidden; - - // Grab the current tab ID. - Tabs.query({ active: true, currentWindow: true }, 0).then((TAB) => { - this.path = chrome.sidePanel.getOptions({"tabId": TAB.id}).path; - (!this.hidden) ? this.show(TAB.id) : this.hide(); - }); - } - - // Close the side panel. - hide () { - // Make sure that the panel is still active. - if (this.state) { - // First, disable it to close it. - chrome.sidePanel.setOptions({enabled: false}); - }; - }; - - /* - Open the side panel. - - @param {string} tab_ID the tab ID to open the side panel in - */ - show (tab_ID) { - // Set the options. Make sure that it is enabled. - chrome.sidePanel.setOptions(Object.assign(this.options, {enabled: true})); - - if (tab_ID) {chrome.sidePanel.open({"tabId": tab_ID});} - else { - Tabs.query({ active: true, currentWindow: true }, 0).then((TAB) => { - chrome.sidePanel.open({"tabId": TAB.id}); - }); - }; - } - - /* Set the options. - - @param {object} options the options - */ - setOptions(options) { - // Merge the options. - options = Object.assign(this.options, options); - - // Set the options. - chrome.sidePanel.setOptions(options); - } -} \ No newline at end of file