update settings interface events

This commit is contained in:
buzz-lightsnack-2007 2024-03-27 15:27:56 +08:00
parent 81b61ade1b
commit 8a590a9bad

View file

@ -6,7 +6,6 @@
import texts from './read.JS'; import texts from './read.JS';
import {windowman} from './windowman.JS'; import {windowman} from './windowman.JS';
let secretariat = await import(chrome.runtime.getURL("scripts/secretariat.js")); let secretariat = await import(chrome.runtime.getURL("scripts/secretariat.js"));
// let secretariat = await import(chrome.runtime.getURL("scripts/secretariat.js"));
// Import configuration file. // Import configuration file.
// const config = chrome.runtime.getURL('gui/layouts/settings.json'); // const config = chrome.runtime.getURL('gui/layouts/settings.json');
@ -149,25 +148,37 @@ function say() {
Arrange the interface. Arrange the interface.
*/ */
function arrange() { function arrange() {
let last_opened = secretariat.read(`last`); async function click() {
let last_opened = (await Promise.all([secretariat.read([`view`, window.location.href], 1)]))[0];
if (!last_opened) {last_opened = 'settings'}; if (!last_opened) {last_opened = 'settings'};
// click! document.querySelector(`[role="tab"][for="${last_opened}"]`).click();
document.querySelector(`menu button[role="tab"][aria-controls="${last_opened}"]`).click();
} }
function events() {
// click!
// document.querySelector(`menu button[role="tab"][aria-controls="${last_opened}"]`).click();
click();
}
/*
Define the mapping of each button.
*/
function events() {
windowman.events();
}; };
function main() { function main() {
let tab = start(); let tab = start();
say(); say();
events();
document.addEventListener('DOMContentLoaded', function() {
arrange(); arrange();
});
/*arrange();
events();*/
} }
main(); main();