an example of code where manual sync can be used
Removed commented out code
This commit is contained in:
parent
333310fcc8
commit
3df2ccbd65
1 changed files with 56 additions and 82 deletions
|
@ -6,102 +6,76 @@
|
||||||
//import { windowman } from "../windowman.js";
|
//import { windowman } from "../windowman.js";
|
||||||
|
|
||||||
async function build() {
|
async function build() {
|
||||||
let secretariat = await import(
|
let secretariat = await import(
|
||||||
chrome.runtime.getURL("scripts/secretariat.js")
|
chrome.runtime.getURL("scripts/secretariat.js")
|
||||||
);
|
);
|
||||||
let windowman = (
|
let windowman = (
|
||||||
await import(chrome.runtime.getURL("gui/scripts/windowman.js"))
|
await import(chrome.runtime.getURL("gui/scripts/windowman.js"))
|
||||||
).default;
|
).default;
|
||||||
|
|
||||||
let window = new windowman();
|
let window = new windowman();
|
||||||
}
|
window.sync();
|
||||||
|
};
|
||||||
/*
|
|
||||||
Arrange the interface.
|
|
||||||
*/
|
|
||||||
/*function arrange() {
|
|
||||||
async function openLast() {
|
|
||||||
let last_opened = (
|
|
||||||
await Promise.all([secretariat.read([`view`, window.location.href], 1)])
|
|
||||||
)[0];
|
|
||||||
if (!last_opened || typeof last_opened !== `number`) {
|
|
||||||
last_opened = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document.querySelector(`[role="tab"][tab="${last_opened}"]`)) {
|
|
||||||
document.querySelector(`[role="tab"][tab="${last_opened}"]`).click();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
openLast();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function main() {
|
|
||||||
windowman.fill();
|
|
||||||
events();
|
|
||||||
arrange();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Define the mapping of each button.
|
Define the mapping of each button.
|
||||||
*/
|
*/
|
||||||
function events() {
|
function events() {
|
||||||
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"]`)
|
||||||
.addEventListener(`click`, async () => {
|
.addEventListener(`click`, async () => {
|
||||||
let filters = new (
|
let filters = new (
|
||||||
await import(chrome.runtime.getURL(`scripts/filters.js`))
|
await import(chrome.runtime.getURL(`scripts/filters.js`))
|
||||||
).default();
|
).default();
|
||||||
await filters.update();
|
await filters.update();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.querySelector(`[data-action="filters,add,one"]`)) {
|
if (document.querySelector(`[data-action="filters,add,one"]`)) {
|
||||||
document
|
document
|
||||||
.querySelector(`[data-action="filters,add,one"]`)
|
.querySelector(`[data-action="filters,add,one"]`)
|
||||||
.addEventListener(`click`, async () => {
|
.addEventListener(`click`, async () => {
|
||||||
(async () => {
|
(async () => {
|
||||||
// Import the filters module.
|
// Import the filters module.
|
||||||
let texts = (
|
let texts = (
|
||||||
await import(chrome.runtime.getURL(`gui/scripts/read.js`))
|
await import(chrome.runtime.getURL(`gui/scripts/read.js`))
|
||||||
).default;
|
).default;
|
||||||
let filters = new (
|
let filters = new (
|
||||||
await import(chrome.runtime.getURL(`scripts/filters.js`))
|
await import(chrome.runtime.getURL(`scripts/filters.js`))
|
||||||
).default();
|
).default();
|
||||||
|
|
||||||
// Open text input window for adding a filter.
|
// Open text input window for adding a filter.
|
||||||
let filter_source = prompt(
|
let filter_source = prompt(
|
||||||
texts.localized(`settings_filters_add_prompt`),
|
texts.localized(`settings_filters_add_prompt`),
|
||||||
);
|
);
|
||||||
if (filter_source ? filter_source.trim() : false) {
|
if (filter_source ? filter_source.trim() : false) {
|
||||||
filters.update(filter_source.trim());
|
filters.update(filter_source.trim());
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.querySelector(`[data-action="storage,clear"]`)) {
|
if (document.querySelector(`[data-action="storage,clear"]`)) {
|
||||||
document
|
document
|
||||||
.querySelector(`[data-action="storage,clear"]`)
|
.querySelector(`[data-action="storage,clear"]`)
|
||||||
.addEventListener(`click`, async () => {
|
.addEventListener(`click`, async () => {
|
||||||
let storage = (
|
let storage = (
|
||||||
await import(chrome.runtime.getURL(`scripts/secretariat.js`))
|
await import(chrome.runtime.getURL(`scripts/secretariat.js`))
|
||||||
)["secretariat"];
|
)["secretariat"];
|
||||||
storage.forget(`sites`);
|
storage.forget(`sites`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//main();
|
//main();
|
||||||
function load() {
|
function load() {
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
M.AutoInit();
|
M.AutoInit();
|
||||||
events();
|
events();
|
||||||
});
|
});
|
||||||
|
|
||||||
build();
|
build();
|
||||||
}
|
}
|
||||||
|
|
||||||
load();
|
load();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue