extend the default page

This commit is contained in:
buzz-lightsnack-2007 2024-04-16 18:30:47 +08:00
parent b1cceec7fc
commit d71e9effd0
3 changed files with 123 additions and 114 deletions

18
scripts/pages/page.js Normal file
View file

@ -0,0 +1,18 @@
/* page.js
Construct an internal page.
*/
import windowman from "/scripts/GUI/windowman.js";
export default class Page {
constructor () {
this.window = window;
this.window[`manager`] = new windowman();
(this.window[`manager`]) ? this.window.manager.sync() : false;
document.addEventListener("DOMContentLoaded", function () {
M.AutoInit();
});
}
};

View file

@ -3,20 +3,19 @@
*/ */
// Import modules. // Import modules.
import {read, forget} from "/scripts/secretariat.js";
import windowman from "/scripts/GUI/windowman.js"; import windowman from "/scripts/GUI/windowman.js";
let secretariat = await import(chrome.runtime.getURL("scripts/secretariat.js")); import Page from "/scripts/pages/page.js";
function start() { class Page_Popup extends Page {
windowman.prepare(); constructor() {
} super();
/* Populate the strings on the page. */ (this.events) ? this.events() : false;
function say(element) { }
// document.title
events() {
}
} }
function main() { new Page_Popup();
let tab = start();
say(tab);
}
main();

View file

@ -5,23 +5,21 @@
// Import modules. // Import modules.
//import { windowman } from "../windowman.js"; //import { windowman } from "../windowman.js";
import {forget} from "/scripts/secretariat.js"; import {read, forget} from "/scripts/secretariat.js";
import windowman from "/scripts/GUI/windowman.js"; import Page from "/scripts/pages/page.js";
async function build() { class Page_Settings extends Page {
let window = new windowman(); constructor() {
window.sync(); super();
(this.events) ? this.events() : false;
}
// Add the window events. /*
events(window); Define the mapping of each button.
};
/* @param {object} window the window
Define the mapping of each button. */
events() {
@param {object} window the window
*/
function events(window) {
if (document.querySelector(`[data-action="filters,update"]`)) { if (document.querySelector(`[data-action="filters,update"]`)) {
document document
.querySelector(`[data-action="filters,update"]`) .querySelector(`[data-action="filters,update"]`)
@ -97,17 +95,11 @@ function events(window) {
document document
.querySelector(`[data-action="storage,clear"]`) .querySelector(`[data-action="storage,clear"]`)
.addEventListener(`click`, async () => { .addEventListener(`click`, async () => {
forget(`sites`); await forget(`sites`);
console.log(await read(null, 1), await read(null, -1));
}); });
} }
}
} }
function load() { new Page_Settings();
build();
document.addEventListener("DOMContentLoaded", function () {
M.AutoInit();
});
}
load();