Implemented whitelist.

This commit is contained in:
Adrian Victor 2024-10-24 17:04:26 -03:00
commit bcfe8fdfab
6 changed files with 116 additions and 10 deletions

View file

@ -1,9 +1,26 @@
var styles = `
* {
console.log("[Mango] Let's get the business done.")
function checkWhitelist(url) {
return browser.storage.local.get("whitelist").then((result) => {
const whitelist = result.whitelist || [];
return whitelist.includes(url);
});
}
const currentHostname = location.hostname;
checkWhitelist(currentHostname).then((isWhitelisted) => {
if (!isWhitelisted) {
const styles = `
* {
border-radius: 0 !important;
}
`;
const injectedStyle = document.createElement("style");
injectedStyle.type = "text/css";
injectedStyle.innerText = styles;
document.head.appendChild(injectedStyle);
} else {
console.log("[Mango] Mercy! This page is whitelisted.")
}
`
var injectedStyle = document.createElement("style")
injectedStyle.type = "text/css"
injectedStyle.innerText = styles
document.head.appendChild(injectedStyle)
});