summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.DS_Storebin0 -> 6148 bytes
-rw-r--r--inject-css.js6
-rw-r--r--manifest.json5
-rw-r--r--mapper.json2
-rw-r--r--popup/popup.html1
-rw-r--r--popup/popup.js40
6 files changed, 53 insertions, 1 deletions
diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..7e05c9a
--- /dev/null
+++ b/.DS_Store
Binary files differ
diff --git a/inject-css.js b/inject-css.js
index c889e18..50e7c7f 100644
--- a/inject-css.js
+++ b/inject-css.js
@@ -8,7 +8,11 @@ browser.storage.sync.get("transparentZenSettings").then((settings) => {
currentUrl.includes(key)
);
const cssFileName = mapping[matchedKey];
- if (cssFileName) {
+ if (
+ cssFileName &&
+ settings.transparentZenSettings.websiteSettings?.[matchedKey] !==
+ false
+ ) {
browser.storage.sync.get(cssFileName).then((data) => {
if (data[cssFileName]) {
let style = document.createElement("style");
diff --git a/manifest.json b/manifest.json
index 408c91e..2fb6c38 100644
--- a/manifest.json
+++ b/manifest.json
@@ -3,6 +3,11 @@
"name": "Zen Internet",
"version": "0.2.0",
"description": "Inject custom css from my repository in real time",
+ "browser_specific_settings": {
+ "gecko": {
+ "id": "{91aa3897-2634-4a8a-9092-279db23a7689}"
+ }
+ },
"icons": {
"48": "assets/images/logo_48.png",
"96": "assets/images/logo_96.png"
diff --git a/mapper.json b/mapper.json
index 74e9267..1191511 100644
--- a/mapper.json
+++ b/mapper.json
@@ -2,7 +2,9 @@
"github.com": "github.com.css",
"keep.google.com": "keep.google.com.css",
"aistudio.google.com": "aistudio.google.com.css",
+ "calendar.google.com": "calendar.google.com.css",
"chat.openai.com": "chat.openai.com.css",
+ "chat.deepseek.com": "chat.deepseek.com.css",
"discord.com.css": "discord.com.css",
"facebook.com": "facebook.com.css",
"gemini.google.com": "gemini.google.com.css",
diff --git a/popup/popup.html b/popup/popup.html
index 3b267e7..c15351e 100644
--- a/popup/popup.html
+++ b/popup/popup.html
@@ -16,6 +16,7 @@
<input type="checkbox" id="enable-styling">
Enable Styling
</label>
+ <ul id="websites-list"></ul>
<button id="refetch-css">Refetch latest styles</button>
<button id="restart-background">Restart Background Script (optional)</button>
<a href="https://sameerasw.github.io/my-internet/">Styles repo</a>
diff --git a/popup/popup.js b/popup/popup.js
index 6a28e31..f9dacfd 100644
--- a/popup/popup.js
+++ b/popup/popup.js
@@ -3,6 +3,7 @@ new (class ExtensionPopup {
browserStorageSettings = {};
enableStylingSwitch = document.getElementById("enable-styling");
refetchCSSButton = document.getElementById("refetch-css");
+ websitesList = document.getElementById("websites-list");
constructor() {
this.loadSettings().then((settings) => {
@@ -22,6 +23,9 @@ new (class ExtensionPopup {
this.enableStylingSwitch.addEventListener("change", () => {
this.saveSettings();
});
+ this.websitesList.addEventListener("change", () => {
+ this.saveSettings();
+ });
}
restoreSettings() {
@@ -29,6 +33,7 @@ new (class ExtensionPopup {
this.enableStylingSwitch.checked =
this.browserStorageSettings.enableStyling;
}
+ this.loadWebsitesList();
}
async loadSettings() {
@@ -41,6 +46,14 @@ new (class ExtensionPopup {
this.browserStorageSettings.enableStyling =
this.enableStylingSwitch.checked;
+ const websiteSettings = {};
+ this.websitesList
+ .querySelectorAll("input[type=checkbox]")
+ .forEach((checkbox) => {
+ websiteSettings[checkbox.name] = checkbox.checked;
+ });
+ this.browserStorageSettings.websiteSettings = websiteSettings;
+
browser.storage.local.set({
[this.BROWSER_STORAGE_KEY]: this.browserStorageSettings,
});
@@ -50,6 +63,33 @@ new (class ExtensionPopup {
console.info("Settings saved", this.browserStorageSettings);
}
+ async loadWebsitesList() {
+ try {
+ const response = await fetch("/mapper.json", {
+ headers: {
+ "Cache-Control": "no-cache",
+ },
+ });
+ if (!response.ok) throw new Error("Failed to fetch mapper.json");
+ const mapping = await response.json();
+ this.websitesList.innerHTML = "";
+ for (const site of Object.keys(mapping)) {
+ const isChecked =
+ this.browserStorageSettings.websiteSettings?.[site] ?? true;
+ const listItem = document.createElement("li");
+ listItem.innerHTML = `
+ <label>
+ <input type="checkbox" name="${site}" ${isChecked ? "checked" : ""}>
+ ${site}
+ </label>
+ `;
+ this.websitesList.appendChild(listItem);
+ }
+ } catch (error) {
+ console.error("Error loading websites list:", error);
+ }
+ }
+
async refetchCSS() {
this.refetchCSSButton.textContent = "Fetching...";
try {