The entry points management technically falls under GUI as well

This commit is contained in:
buzz-lightsnack-2007 2024-04-27 09:16:31 +08:00
parent 45e4a54b53
commit 6265695a5c
5 changed files with 1 additions and 1 deletions

View file

@ -1,15 +0,0 @@
import BrowserIcon from '/scripts/GUI/extensionIcon.js';
import Image from '/scripts/mapping/image.js';
class IconIndicator {
static async enable() {
// WIP. Make sure to determine if the product is bad / good
BrowserIcon.set(await Image.get('default'));
}
static async disable() {
BrowserIcon.set(await Image.get('disabled'));
}
}
export {IconIndicator as default};

View file

@ -1,50 +0,0 @@
// Manage all entries.
import {read} from '../../secretariat.js';
import Tabs from "/scripts/GUI/tabs.js";
import MenuEntry from "./menu.js";
import ManagedSidebar from "./sidebar.js";
import IconIndicator from "./icons.js";
import check from "/scripts/external/check.js";
export default class EntryManager {
constructor () {
this.instances = {};
this.instances.menu = new MenuEntry();
Tabs.addActionListener(`onActivated`, (data) => {this.onRefresh()});
}
async onRefresh() {
const DATA = await Tabs.query(null, 0)
if (DATA.url) {
(!!await check.platform(DATA.url))
? (this.enable())
: (this.disable())
};
}
/*
Enable the entries.
*/
enable () {
this.instances.menu.enable();
IconIndicator.enable();
// Open the side panel, if supported.
read([`settings`,`behavior`,`autoOpen`]).then((result) => {
result = (result == null) ? false : result;
if (result) {
new ManagedSidebar();
}
});
}
/*
Disable the entries and the existing opened side panel.
*/
disable () {
this.instances.menu.disable();
IconIndicator.disable();
}
}

View file

@ -1,27 +0,0 @@
import Menu from '/scripts/GUI/menus.js';
import texts from "/scripts/mapping/read.js";
import ManagedSidebar from "./sidebar.js";
export default class MenuEntry {
/* Create all entries. */
constructor() {
// Add the context menu.
this.menu = new Menu({title: (new texts(`entry_contextMenu`)).localized, contexts: [`all`], event: {"onClicked": MenuEntry.onclick}, hidden: true});
};
/*
Enable the sidebar.
*/
enable () {
this.menu.show();
}
/* Disable. */
disable () {
this.menu.remove();
}
static onclick() {
new ManagedSidebar();
};
}

View file

@ -1,8 +0,0 @@
import Sidebar from '/scripts/GUI/sidepanel.js'
export default class ManagedSidebar {
constructor () {
// WIP
new Sidebar(`/pages/popup.htm`);
}
}