From 1e8db3dee4349ea807be36810a40fc54fb249f12 Mon Sep 17 00:00:00 2001 From: buzz-lightsnack-2007 <73412182+buzz-lightsnack-2007@users.noreply.github.com> Date: Mon, 13 May 2024 23:49:30 +0800 Subject: [PATCH] create OOBE popup --- pages/popup/hello.htm | 26 +++++++++++++++++++++ scripts/pages/hello.js | 52 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 pages/popup/hello.htm create mode 100644 scripts/pages/hello.js diff --git a/pages/popup/hello.htm b/pages/popup/hello.htm new file mode 100644 index 0000000..087a274 --- /dev/null +++ b/pages/popup/hello.htm @@ -0,0 +1,26 @@ + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/scripts/pages/hello.js b/scripts/pages/hello.js new file mode 100644 index 0000000..1d33efc --- /dev/null +++ b/scripts/pages/hello.js @@ -0,0 +1,52 @@ +/* + hello.js + Build the interface for the welcome and configuration page. +*/ + +// Import modules. +import {global} from "/scripts/secretariat.js"; +import Page from "/scripts/pages/page.js"; +import texts from "/scripts/mapping/read.js"; +import filters from "/scripts/filters.js"; +import logging from "/scripts/logging.js"; + +class Page_MiniConfig extends Page { + constructor () { + super(); + this.#get(); + this.content(); + }; + + /* + Get all elements needed for content(). + */ + #get() { + this.elements = (this.elements) ? this.elements : {}; + this.elements[`1`] = (this.elements[`1`]) ? this.elements[`1`] : {}; + + this.elements[`1`]["headline"] = document.querySelectorAll(`[for="GUI_welcome_headline"]`); + } + + /* + Build the additional content for the page. + */ + content() { + if (this.elements[`1`][`headline`].length) { + let RANDOM = Math.floor(Math.random() * 2) + 1; + (this.elements[`1`]["headline"]).forEach((ELEMENT) => { + console.log(RANDOM, texts.localized(`OOBE_welcome_headline_`.concat(String(RANDOM)))); + ELEMENT.textContent = texts.localized(`OOBE_welcome_headline_`.concat(String(RANDOM))); + }); + }; + }; + + /* + Assist with navigation. + */ + navigate() { + this.navigation = (this.navigation) ? this.navigation : {}; + this.navigation.selection = (this.navigation.selection) ? this.navigation.selection : 0; + } +} + +new Page_MiniConfig(); \ No newline at end of file