rename icons to iconindicator
This commit is contained in:
parent
780b99785e
commit
ce906d42e9
1 changed files with 0 additions and 0 deletions
46
scripts/GUI/entrypoints/iconindicator.js
Normal file
46
scripts/GUI/entrypoints/iconindicator.js
Normal file
|
@ -0,0 +1,46 @@
|
|||
import BrowserIcon from '/scripts/GUI/extensionIcon.js';
|
||||
import Image from '/scripts/mapping/image.js';
|
||||
import Tabs from '/scripts/GUI/tabs.js';
|
||||
import texts from "/scripts/mapping/read.js";
|
||||
import {session} from '/scripts/secretariat.js';
|
||||
|
||||
const CONFIG = chrome.runtime.getURL("styles/colors/icon.json");
|
||||
|
||||
class IconIndicator {
|
||||
/*
|
||||
Indicate that the website is supported through icon change.
|
||||
*/
|
||||
static enable() {
|
||||
BrowserIcon.enable();
|
||||
(Tabs.query(null, 0)).then(async (TAB) => {
|
||||
BrowserIcon.set({
|
||||
"BadgeText": await (new texts(`extensionIcon_website_loading`)).symbol,
|
||||
"BadgeBackgroundColor": await fetch(CONFIG).then((response) => response.json()).then((jsonData) => {return (jsonData[`loading`]);})
|
||||
}, {"tabId": TAB.id});
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
Indicate that the website isn't supported through icon change.
|
||||
*/
|
||||
static async disable() {
|
||||
BrowserIcon.disable();
|
||||
(Tabs.query(null, 0)).then(async (TAB) => {
|
||||
BrowserIcon.set({
|
||||
"BadgeText": await (new texts(`extensionIcon_website_unsupported`)).symbol,
|
||||
"BadgeBackgroundColor": await fetch(CONFIG).then((response) => response.json()).then((jsonData) => {return (jsonData[`N/A`]);})
|
||||
}, {"tabId": TAB.id});
|
||||
})
|
||||
}
|
||||
|
||||
/*
|
||||
Set the function.
|
||||
|
||||
@param {function} callback the function to run.
|
||||
*/
|
||||
static set(callback) {
|
||||
BrowserIcon.addEventListener("onClicked", callback);
|
||||
}
|
||||
}
|
||||
|
||||
export {IconIndicator as default};
|
Loading…
Add table
Add a link
Reference in a new issue