From 77425a34c03d0dcf0fd22b3ffa20400fbfeeb75e Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Sun, 24 Mar 2024 18:40:24 +0800 Subject: [PATCH] add initial popup generation --- gui/scripts/popup.js | 54 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/gui/scripts/popup.js b/gui/scripts/popup.js index 53387b8..616a9cf 100644 --- a/gui/scripts/popup.js +++ b/gui/scripts/popup.js @@ -2,14 +2,52 @@ Build the interface for popup */ -// Import modules. -import texts from "./read.JS"; +// Import modules. +import texts from './read.JS'; +import windowman from './windowman.JS'; + + + // Import modules. + let secretariat = await import(chrome.runtime.getURL("scripts/secretariat.js")); + + let pref_pane = 0; + + + function start() { + windowman.prepare(); + + return(new windowman(`body`, null, null, {'Close': true})); + } + + /* Add the UI design. */ + function design(element) { + // Set the event of the window. + function controls() { + document.getElementById(element[`titlebar`][`controls`][`Close`][`ID`]).onclick = function(){element.terminate(false)}; + } + + + + + // TODO work on the content; perhaps, it must read from JSON of valid prefs + + controls(); + + } + + /* Populate the strings on the page. */ + function say(element) { + element.update(element[`titlebar`][`title`], texts.localized(`GUI_title_preferences`)); + + }; + + function main() { + let tab = start(); + design(tab); + say(tab); + } + + main(); -// Call the main function. -function main() { -} -if (compat.restrict()) { - main(); -}