diff --git a/img/mango-full.jpg b/img/mango-full.jpg new file mode 100644 index 0000000..894e389 Binary files /dev/null and b/img/mango-full.jpg differ diff --git a/mango.html b/mango.html index 8a9e56f..e1e3020 100644 --- a/mango.html +++ b/mango.html @@ -1 +1,17 @@ -

follow development at Git

\ No newline at end of file + + + + Mango + + + + +

mango

+

whitelist

+
+ +

source-code

+ + diff --git a/mango.js b/mango.js index 310bc5f..96adbb6 100644 --- a/mango.js +++ b/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) \ No newline at end of file + }); diff --git a/mangoUI.css b/mangoUI.css new file mode 100644 index 0000000..3af64cc --- /dev/null +++ b/mangoUI.css @@ -0,0 +1,51 @@ +body { + background-color: black; + color: white; + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; +} + +a { + color: orangered; + text-decoration: none; +} + +a:hover { + color: white; +} + +body::before { + content: ""; + background-image: url(/img/mango-full.jpg); + position: absolute; + background-size: cover; + top: 0; + left: 0; + bottom: 0; + right: 0; + z-index: -1; + opacity: .25; +} + +#whitelist { + background-color: black; + margin-bottom: 10px; + color: white; +} + +#title { + font-weight: 300; + font-size: 50px; + margin: 0; +} + +#whitelistSave { + border: 1px solid white; + background-color: black; + color: white; + font-size: large; +} + +h2 { + font-weight: 300; + margin-top: 0; +} \ No newline at end of file diff --git a/mangoui.js b/mangoui.js new file mode 100644 index 0000000..6678764 --- /dev/null +++ b/mangoui.js @@ -0,0 +1,14 @@ +document.getElementById('whitelistSave').addEventListener('click', () => { + const whitelist = document.getElementById('whitelist').value.split('\n').map(line => line.trim()).filter(line => line); + browser.storage.local.set({ whitelist: whitelist }); + console.log('Whitelist saved!'); + }); + + + browser.storage.local.get("whitelist").then((result) => { + const whitelist = result.whitelist || []; + document.getElementById('whitelist').value = whitelist.join('\n'); + }).catch((error) => { + console.error("Error retrieving the whitelist:", error); + }); + \ No newline at end of file diff --git a/manifest.json b/manifest.json index c5340c3..d216be3 100644 --- a/manifest.json +++ b/manifest.json @@ -2,13 +2,16 @@ "manifest_version": 2, "name": "Mango", "version": "1.0", - "description": "Obliterates rounded corners.", - + "icons": { "48": "img/mango-48.jpg", "96": "img/mango-96.jpg" }, + + "default_icon": { + "96": "img/mango-96.jpg" + }, "browser_specific_settings": { "gecko": { @@ -21,6 +24,11 @@ "default_title": "Mango", "default_popup": "mango.html" }, + + "permissions": [ + "storage", + "activeTab" + ], "content_scripts": [ {