Clean repo/README.md, add option to disable extension and bump version to 2.

This commit is contained in:
天クマ 2026-04-25 17:22:46 -03:00
commit 9dc35139d6
7 changed files with 123 additions and 57 deletions

View file

@ -1,26 +1,31 @@
console.log("[Mango] Let's get the business done.")
const currentHostname = location.hostname;
let enabled = true;
browser.storage.local.get("enabled").then((result) => {
enabled = result.enabled ?? true;
}).catch((error) => {
console.error("Error retrieving enabled state:", error);
});
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 = `
return browser.storage.local.get("whitelist").then((result) => {
const whitelist = result.whitelist || [];
return whitelist.includes(url);
});
}
checkWhitelist(currentHostname).then((isWhitelisted) => {
if (!isWhitelisted && enabled) {
const styles = `
* {
border-radius: 0 !important;
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.")
}
});
const injectedStyle = document.createElement("style");
injectedStyle.type = "text/css";
injectedStyle.id = "mangoInjectedStyle";
injectedStyle.innerText = styles;
document.head.appendChild(injectedStyle);
}
});