The entry points management technically falls under GUI as well
This commit is contained in:
parent
45e4a54b53
commit
6265695a5c
5 changed files with 1 additions and 1 deletions
50
scripts/external/entries/manager.js
vendored
50
scripts/external/entries/manager.js
vendored
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue