diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4373977 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +mango.zip \ No newline at end of file diff --git a/LICENSE b/LICENSE index 4cf91da..57c338f 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 adrianvictor +Copyright (c) 2024 Adrian Victor Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.MD b/README.MD index e1a9055..5b0d050 100644 --- a/README.MD +++ b/README.MD @@ -1,17 +1,20 @@ # Mango -Obliterates rounded corners... BECAUSE I HATE THEM +I declare war to rouded corners! -Mango configuration UI -Mango VS YouTube default design +Firefox Addon Store Icon + +## Example +Mango VS YouTube default design ## How it works -``* { +```css +* { border-radius: 0 !important; -}`` -That's everything we inject into your page, feel free to check the source code to be sure we're not doing anything malicious. +} +``` +This CSS tells your browser that everything (`*`) should have the property `border-radius` (amount of rounded corner) to 0. -## Why 'Mango' -Mango is the codename of the first Windows Phone OS to have a codename (Windows Phone 7.5). I had a WP as a child and I always loved the "minimalist square" design of Windows Phone. +The extension just injects this into your page after checking if the page is whitelisted. This extension is so tiny that you can review `mango.js` and `main.js` by yourself or with help of AI. -## Contributing -Just do a pull request \ No newline at end of file +## Why Mango +Mango is the codename of _Windows Phone 7.5_, the first version to adopt Microslop's "Metro UI". I grew up as a kid using Windows Phone and that shaped the way I see rounded corners—and I absolutely hate them. \ No newline at end of file diff --git a/img/Firefox-badges.jpg b/img/Firefox-badges.jpg new file mode 100644 index 0000000..45917bf Binary files /dev/null and b/img/Firefox-badges.jpg differ diff --git a/mango.html b/mango.html index e1e3020..d1a0b95 100644 --- a/mango.html +++ b/mango.html @@ -1,17 +1,20 @@ - Mango - - + Mango + +

mango

whitelist


+ example.com + example2.com" id="whitelist" rows="10" cols="30">
-

source-code

+ + diff --git a/mango.js b/mango.js index 96adbb6..6a712fb 100644 --- a/mango.js +++ b/mango.js @@ -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); + } +}); diff --git a/mangoui.js b/mangoui.js deleted file mode 100644 index 6678764..0000000 --- a/mangoui.js +++ /dev/null @@ -1,14 +0,0 @@ -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 d216be3..701cfe2 100644 --- a/manifest.json +++ b/manifest.json @@ -1,40 +1,39 @@ { - "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": { - "id": "adrianvictor.mango@disroot.org" - } - }, - - "browser_action": { - "default_icon": "img/mango-96.jpg", - "default_title": "Mango", - "default_popup": "mango.html" - }, - - "permissions": [ + "manifest_version": 2, + "name": "Mango", + "version": "3.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": { + "id": "adrianvictor.mango@disroot.org" + } + }, + + "browser_action": { + "default_icon": "img/mango-96.jpg", + "default_title": "Mango", + "default_popup": "mango.html" + }, + + "permissions": [ "storage", "activeTab" ], - "content_scripts": [ - { - "matches": [""], - "js": ["mango.js"] - } - ] - } - \ No newline at end of file + "content_scripts": [ + { + "matches": [""], + "js": ["mango.js"] + } + ] +} diff --git a/mangoUI.css b/menu/main.css similarity index 54% rename from mangoUI.css rename to menu/main.css index 3af64cc..4d81f11 100644 --- a/mangoUI.css +++ b/menu/main.css @@ -1,11 +1,22 @@ +:root { + --accent: orangered; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + body { background-color: black; color: white; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + padding: 1em; } a { - color: orangered; + color: var(--accent); text-decoration: none; } @@ -26,26 +37,53 @@ body::before { opacity: .25; } -#whitelist { +textarea { + outline: medium solid transparent; + transition: .4s; background-color: black; margin-bottom: 10px; color: white; + border: thin solid white; + padding: .4em; } -#title { +textarea:focus { + outline-color: var(--accent); +} + +h1 { font-weight: 300; - font-size: 50px; + font-size: 3em; margin: 0; } -#whitelistSave { +h2 { + margin-bottom: .4em; +} + +button { + transition: .2s; border: 1px solid white; background-color: black; color: white; font-size: large; + padding: .2em; +} + +button:hover { + background-color: white; + color: black; } h2 { font-weight: 300; margin-top: 0; +} + +footer { + margin-top: 1em; +} + +#version { + opacity: .6; } \ No newline at end of file diff --git a/menu/main.js b/menu/main.js new file mode 100644 index 0000000..d63802f --- /dev/null +++ b/menu/main.js @@ -0,0 +1,33 @@ +let enabled = true; + +const toggleButton = document.getElementById("toggle"); +updateButtonText(); + +function updateButtonText() { + toggleButton.textContent = enabled ? "disable" : "enable"; +} + +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 }); +}); + +browser.storage.local.get("enabled").then((result) => { + enabled = result.enabled ?? true; + updateButtonText(); +}).catch((error) => { + console.error("Error retrieving enabled state:", error); +}); + +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); +}); + +toggleButton.addEventListener('click', () => { + enabled = !enabled; + updateButtonText(); + browser.storage.local.set({enabled: enabled}); +}) \ No newline at end of file