revert to using popups
This commit is contained in:
parent
89848bad7a
commit
3b332b6045
1 changed files with 42 additions and 40 deletions
|
@ -3,54 +3,56 @@
|
||||||
import Tabs from "/scripts/GUI/tabs.js";
|
import Tabs from "/scripts/GUI/tabs.js";
|
||||||
import Window from "/scripts/GUI/window.js";
|
import Window from "/scripts/GUI/window.js";
|
||||||
import MenuEntry from "./menu.js";
|
import MenuEntry from "./menu.js";
|
||||||
import ManagedPopup from "./popup.js";
|
import ManagedWindow from "./ManagedWindow.js";
|
||||||
import IconIndicator from "./icons.js";
|
import IconIndicator from "./icons.js";
|
||||||
import check from "/scripts/external/check.js";
|
import check from "/scripts/external/check.js";
|
||||||
import {read} from "/scripts/secretariat.js";
|
import {read} from "/scripts/secretariat.js";
|
||||||
|
|
||||||
export default class EntryManager {
|
export default class EntryManager {
|
||||||
constructor () {
|
constructor () {
|
||||||
// Initialize the entries.
|
// Initialize the entries.
|
||||||
this.instances = {};
|
this.instances = {};
|
||||||
this.instances.popup = new ManagedPopup();
|
this.instances.popup = new ManagedWindow();
|
||||||
this.instances.menu = new MenuEntry();
|
this.instances.menu = new MenuEntry();
|
||||||
|
|
||||||
// Add the action listeners.
|
// Add the action listeners.
|
||||||
this.#listen();
|
this.#listen();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the action listeners when running this. */
|
/* Add the action listeners. */
|
||||||
#listen() {
|
#listen() {
|
||||||
Tabs.addActionListener(`onActivated`, (data) => {this.onRefresh()});
|
Tabs.addActionListener(`onActivated`, (data) => {this.onRefresh()});
|
||||||
Tabs.addActionListener(`onUpdated`, (data) => {this.onRefresh()});
|
Tabs.addActionListener(`onUpdated`, (data) => {this.onRefresh()});
|
||||||
Window.addActionListener(`onFocusChanged`, (data) => {this.onRefresh()});
|
Window.addActionListener(`onFocusChanged`, (data) => {this.onRefresh()});
|
||||||
}
|
|
||||||
|
|
||||||
onRefresh() {
|
// Add the context menu event.
|
||||||
(Tabs.query(null, 0)).then((DATA) => {
|
IconIndicator.set(this.instances.popup.show());
|
||||||
if (DATA ? (DATA.url) : false) {
|
this.instances.menu.menu.onclick(() => {this.instances.popup.show()});
|
||||||
(check.platform(DATA.url)).then((result) => {
|
}
|
||||||
(result) ? (this.enable()) : (this.disable())
|
|
||||||
});
|
|
||||||
};
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
onRefresh() {
|
||||||
Enable the entries.
|
(Tabs.query(null, 0)).then((DATA) => {
|
||||||
*/
|
if (DATA ? (DATA.url) : false) {
|
||||||
enable () {
|
(check.platform(DATA.url)).then((result) => {
|
||||||
this.instances.menu.enable();
|
(result) ? (this.enable()) : (this.disable())
|
||||||
IconIndicator.enable();
|
});
|
||||||
this.instances.popup.enable();
|
};
|
||||||
}
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Disable the entries and the existing opened side panel.
|
Enable the entries.
|
||||||
*/
|
*/
|
||||||
disable () {
|
enable () {
|
||||||
this.instances.menu.disable();
|
this.instances.menu.enable();
|
||||||
this.instances.popup.disable();
|
IconIndicator.enable();
|
||||||
IconIndicator.disable();
|
}
|
||||||
}
|
|
||||||
|
/*
|
||||||
|
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