only get the local chrome URL of the current page
This commit is contained in:
parent
082f423332
commit
7d20170c25
1 changed files with 16 additions and 22 deletions
|
@ -47,6 +47,9 @@ class Page_Popup extends Page {
|
||||||
: ((this[`status`])
|
: ((this[`status`])
|
||||||
? this[`status`]
|
? this[`status`]
|
||||||
: {});
|
: {});
|
||||||
|
|
||||||
|
// Confirm completion by returning the status.
|
||||||
|
return (this[`status`]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async loading() {
|
async loading() {
|
||||||
|
@ -54,7 +57,7 @@ class Page_Popup extends Page {
|
||||||
this[`elements`][`loader`] = new Loader();
|
this[`elements`][`loader`] = new Loader();
|
||||||
}
|
}
|
||||||
|
|
||||||
async switch() {
|
switch() {
|
||||||
if (this.elements[`frame`]) {
|
if (this.elements[`frame`]) {
|
||||||
let PAGES = {
|
let PAGES = {
|
||||||
"results": "results.htm",
|
"results": "results.htm",
|
||||||
|
@ -63,20 +66,10 @@ class Page_Popup extends Page {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare all the necessary data.
|
// Prepare all the necessary data.
|
||||||
await this.update();
|
this.update().then(() => {
|
||||||
|
|
||||||
// Make sure that the website has been selected!
|
// Make sure that the website has been selected!
|
||||||
if (this[`ref`]) {
|
if (this[`ref`]) {
|
||||||
// Set the relative chrome URLs
|
let PAGE = chrome.runtime.getURL(`pages/popup/`.concat(PAGES[(this[`status`][`done`] <= -1 || this[`status`][`error`]) ? `error` : ((this[`status`][`done`] >= 1) ? `results` : `loading`)]));
|
||||||
(Object.keys(PAGES)).forEach(PAGE => {
|
|
||||||
PAGES[PAGE] = chrome.runtime.getURL(`pages/popup/${PAGES[PAGE]}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
let PAGE = PAGES[(((this[`status`] && (typeof this[`status`]).includes(`obj`)) ? (this[`status`][`done`] >= 1) : false)
|
|
||||||
? ((this[`status`][`error`] && this[`status`][`error`] != {})
|
|
||||||
? `error`
|
|
||||||
: `results`)
|
|
||||||
: `loading`)];
|
|
||||||
|
|
||||||
// Replace the iframe src with the new page.
|
// Replace the iframe src with the new page.
|
||||||
(this.elements[`frame`].src != PAGE) ? this.elements[`frame`].src = PAGE : false;
|
(this.elements[`frame`].src != PAGE) ? this.elements[`frame`].src = PAGE : false;
|
||||||
|
@ -84,6 +77,7 @@ class Page_Popup extends Page {
|
||||||
// The results page has its own container.
|
// The results page has its own container.
|
||||||
this.elements[`container`].classList[(PAGE.includes(`results`)) ? `remove` : `add`](`container`);
|
this.elements[`container`].classList[(PAGE.includes(`results`)) ? `remove` : `add`](`container`);
|
||||||
};
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also set the loader.
|
// Also set the loader.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue