show different groups of navbar elements during different pages
This commit is contained in:
parent
3131b0760a
commit
174bdd5ee8
3 changed files with 33 additions and 11 deletions
|
@ -7,12 +7,14 @@
|
||||||
<body role="window">
|
<body role="window">
|
||||||
<header>
|
<header>
|
||||||
<nav id="header" class="nav-wrapper transparent">
|
<nav id="header" class="nav-wrapper transparent">
|
||||||
<ul class="right" id="results">
|
<ul class="right" id="result">
|
||||||
<li><a accesskey="r" data-action="analysis,reload" title-for="refresh" data-icon="refresh"></a></li>
|
<li><a accesskey="r" data-action="analysis,reload" title-for="refresh" data-icon="refresh"></a></li>
|
||||||
<li><a accesskey="," data-action="open,settings" title-for="preferences" data-icon="cog"></a></li>
|
<li><a accesskey="," data-action="open,settings" title-for="preferences" data-icon="cog"></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="right" id="OOBE">
|
<ul class="right" id="OOBE">
|
||||||
<li><a accesskey="t" href="/pages/popup/hello.htm" target="_blank" title-for="popout" data-icon="open-in-new"></a></li>
|
<li><a accesskey="t" href="/pages/popup/hello.htm" target="_blank" title-for="popout" data-icon="open-in-new"></a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="right" id="loading">
|
||||||
<li><a accesskey="," data-action="open,settings" title-for="preferences" data-icon="cog"></a></li>
|
<li><a accesskey="," data-action="open,settings" title-for="preferences" data-icon="cog"></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
@ -65,6 +65,13 @@ class Page_Popup extends Page {
|
||||||
"OOBE": "hello.htm",
|
"OOBE": "hello.htm",
|
||||||
"error": "error.htm"
|
"error": "error.htm"
|
||||||
};
|
};
|
||||||
|
// Set the width and the height.
|
||||||
|
const PAGES_DIMENSIONS = {
|
||||||
|
"loading": {"width": "200pt", "height": "100pt"},
|
||||||
|
"error": {"width": "250pt", "height": "300pt"},
|
||||||
|
"results": {"width": "250pt", "height": "225pt"},
|
||||||
|
"OOBE": {"width": "350pt", "height": "300pt"},
|
||||||
|
};
|
||||||
|
|
||||||
// Prepare all the necessary data.
|
// Prepare all the necessary data.
|
||||||
this.update().then(() => {
|
this.update().then(() => {
|
||||||
|
@ -86,8 +93,15 @@ class Page_Popup extends Page {
|
||||||
this.elements[`container`].classList[([`results`, `OOBE`].includes(SELECTION)) ? `remove` : `add`](`container`);
|
this.elements[`container`].classList[([`results`, `OOBE`].includes(SELECTION)) ? `remove` : `add`](`container`);
|
||||||
|
|
||||||
// Set the title bar content.
|
// Set the title bar content.
|
||||||
this[`window`][`navigation bar`][([`OOBE`].includes(SELECTION)) ? `hide` : `show`](`header`, `results`);
|
this[`window`][`navigation bar`][([`OOBE`, `loading`].includes(SELECTION)) ? `hide` : `show`](`header`, `result`);
|
||||||
this[`window`][`navigation bar`][([`OOBE`].includes(SELECTION)) ? `show` : `hide`](`header`, `OOBE`);
|
[`loading`, `OOBE`].forEach((NAME) => {
|
||||||
|
this[`window`][`navigation bar`][(NAME == SELECTION) ? `show` : `hide`](`header`, NAME);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set the dimensions of the body.
|
||||||
|
Object.keys(PAGES_DIMENSIONS[SELECTION]).forEach((DIMENSION) => {
|
||||||
|
document.body.style[DIMENSION] = PAGES_DIMENSIONS[SELECTION][DIMENSION];
|
||||||
|
});
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import gemini from "/scripts/AI/gemini.js";
|
||||||
export default class processor {
|
export default class processor {
|
||||||
#filter;
|
#filter;
|
||||||
#analyzer;
|
#analyzer;
|
||||||
|
status = {};
|
||||||
|
|
||||||
async scrape (fields, options) {
|
async scrape (fields, options) {
|
||||||
this.product.details = new scraper (((fields) ? fields : this.targets), options);
|
this.product.details = new scraper (((fields) ? fields : this.targets), options);
|
||||||
|
@ -96,12 +97,19 @@ export default class processor {
|
||||||
RUN = true;
|
RUN = true;
|
||||||
} else {
|
} else {
|
||||||
new logging(texts.localized(`AIkey_message_waiting_title`), texts.localized(`AIkey_message_waiting_body`));
|
new logging(texts.localized(`AIkey_message_waiting_title`), texts.localized(`AIkey_message_waiting_body`));
|
||||||
new background(async () => {
|
if (!this.status.wait) {
|
||||||
if ((!RUN) ? (await global.read([`settings`,`analysis`,`api`,`key`])) : false) {
|
this.status.background = new background(async () => {
|
||||||
await main();
|
this.status.wait = true; // lock the process
|
||||||
RUN = true;
|
if ((!RUN) ? (await global.read([`settings`,`analysis`,`api`,`key`])) : false) {
|
||||||
}
|
await main();
|
||||||
});
|
RUN = true;
|
||||||
|
|
||||||
|
// Cancel the background process.
|
||||||
|
this.status.background.cancel();
|
||||||
|
this.status.wait = false; // unlock the process
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,8 +163,6 @@ export default class processor {
|
||||||
|
|
||||||
this.product = new product();
|
this.product = new product();
|
||||||
this.targets = this.#filter[`data`];
|
this.targets = this.#filter[`data`];
|
||||||
|
|
||||||
this.status = {};
|
|
||||||
|
|
||||||
((((typeof options).includes(`obj`)) ? Object.hasOwn(options, `automatic`) : false) ? options[`automatic`] : true) ? this.run() : false;
|
((((typeof options).includes(`obj`)) ? Object.hasOwn(options, `automatic`) : false) ? options[`automatic`] : true) ? this.run() : false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue