Implemented whitelist.
This commit is contained in:
parent
b582390d2c
commit
bcfe8fdfab
6 changed files with 116 additions and 10 deletions
31
mango.js
31
mango.js
|
|
@ -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)
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue