send message to open sidebar in the background
This commit is contained in:
parent
3eede224d4
commit
bec1de898e
1 changed files with 22 additions and 28 deletions
50
scripts/external/watch.js
vendored
50
scripts/external/watch.js
vendored
|
@ -6,45 +6,39 @@ import check from "/scripts/external/check.js";
|
||||||
import processor from "/scripts/external/processor.js";
|
import processor from "/scripts/external/processor.js";
|
||||||
import logging from "/scripts/logging.js";
|
import logging from "/scripts/logging.js";
|
||||||
import texts from "/scripts/mapping/read.js";
|
import texts from "/scripts/mapping/read.js";
|
||||||
|
import {read} from "/scripts/secretariat.js";
|
||||||
|
|
||||||
export default class watchman {
|
export default class watchman {
|
||||||
/* Act on the page.
|
/* Open relevant graphical user interfaces.
|
||||||
|
|
||||||
@param {dictionary} filters the filter to work with
|
|
||||||
@return {boolean} the state
|
|
||||||
*/
|
*/
|
||||||
static act(matches) {
|
static callGUI() {
|
||||||
// Let user know that the website is supported, if ever they have opened the console.
|
// Open the side panel if set by default.
|
||||||
new logging((new texts(`message_external_supported`)).localized);
|
read([`settings`,`behavior`,`autoOpen`]).then((result) => {
|
||||||
// Show loading screen while the load is incomplete.
|
if (result) {chrome.runtime.sendMessage('sidebar_open')};
|
||||||
|
|
||||||
|
|
||||||
// Begin only when the page is fully loaded.
|
|
||||||
window.addEventListener(`DOMContentLoaded`, (event) => {
|
|
||||||
// Begin processing.
|
|
||||||
let PROC = new processor(matches);
|
|
||||||
|
|
||||||
// Remove the loading screen.
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the program to standby utnil next load.
|
/* Act on the page.
|
||||||
*/
|
|
||||||
static standby() {
|
@param {dictionary} filter the filter to work with
|
||||||
// Set the icon to indicate that it's not active.
|
*/
|
||||||
|
static process(filter) {
|
||||||
|
// Let user know that the website is supported, if ever they have opened the console.
|
||||||
|
new logging((new texts(`message_external_supported`)).localized);
|
||||||
|
|
||||||
|
// Begin only when the page is fully loaded.
|
||||||
|
window.addEventListener(`DOMContentLoaded`, (event) => {
|
||||||
|
// Begin processing.
|
||||||
|
let PROC = new processor(filter);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static job() {
|
static job() {
|
||||||
/* The main action. */
|
/* The main action. */
|
||||||
|
|
||||||
(check.platform()).then((RULES) => {
|
(check.platform()).then((RULES) => {
|
||||||
console.log(RULES);
|
if (RULES && Object.keys(RULES).length > 0) {
|
||||||
if (RULES && Object.keys(RULES).length !== 0) {
|
watchman.process(RULES);
|
||||||
watchman.act(RULES);
|
watchman.callGUI();
|
||||||
} else {
|
|
||||||
watchman.standby();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue