reusing settings for filters page
This commit is contained in:
parent
e34013b5f8
commit
73aed76519
1 changed files with 24 additions and 18 deletions
|
@ -14,11 +14,13 @@ function arrange() {
|
||||||
let last_opened = (
|
let last_opened = (
|
||||||
await Promise.all([secretariat.read([`view`, window.location.href], 1)])
|
await Promise.all([secretariat.read([`view`, window.location.href], 1)])
|
||||||
)[0];
|
)[0];
|
||||||
if (!last_opened) {
|
if (!last_opened || typeof last_opened !== `number`) {
|
||||||
last_opened = "settings";
|
last_opened = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector(`[role="tab"][for="${last_opened}"]`).click();
|
if (document.querySelector(`[role="tab"][tab="${last_opened}"]`)) {
|
||||||
|
document.querySelector(`[role="tab"][tab="${last_opened}"]`).click();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openLast();
|
openLast();
|
||||||
|
@ -30,12 +32,15 @@ function arrange() {
|
||||||
function events() {
|
function events() {
|
||||||
windowman.events();
|
windowman.events();
|
||||||
|
|
||||||
|
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 = await import(chrome.runtime.getURL(`scripts/filters.js`));
|
let filters = await import(chrome.runtime.getURL(`scripts/filters.js`));
|
||||||
filters.update();
|
filters.update();
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
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 () => {
|
||||||
|
@ -44,10 +49,11 @@ function events() {
|
||||||
);
|
);
|
||||||
storage.forget(`sites`);
|
storage.forget(`sites`);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
let tab = windowman.prepare();
|
windowman.prepare();
|
||||||
windowman.fill();
|
windowman.fill();
|
||||||
events();
|
events();
|
||||||
arrange();
|
arrange();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue