summaryrefslogtreecommitdiff
path: root/popup
diff options
context:
space:
mode:
authorsameerasw <[email protected]>2025-02-27 22:00:35 +0530
committersameerasw <[email protected]>2025-02-27 22:00:35 +0530
commit9e8de1c7b8ab58b12924cedfb7284af58f5b8181 (patch)
tree6204c44144e4dfb9cda386ec7f4045c6cc73e86f /popup
parente6179900efbd867cad38536e645d620ffa2f74c5 (diff)
disabled style update on switching tabs
Diffstat (limited to 'popup')
-rw-r--r--popup/popup.html4
-rw-r--r--popup/popup.js59
2 files changed, 2 insertions, 61 deletions
diff --git a/popup/popup.html b/popup/popup.html
index b53ed87..4c20a90 100644
--- a/popup/popup.html
+++ b/popup/popup.html
@@ -36,13 +36,13 @@
</div>
<!-- All Websites Section (Collapsible) -->
- <div class="websites-container">
+ <!-- <div class="websites-container">
<button class="collapsible-button" id="toggle-websites">
<span>All Websites</span>
<i class="fas fa-chevron-down"></i>
</button>
<div id="websites-list" class="websites-list collapsed"></div>
- </div>
+ </div> -->
<div class="actions">
<button id="refetch-css" class="action-button primary">
diff --git a/popup/popup.js b/popup/popup.js
index 113b99e..595efb9 100644
--- a/popup/popup.js
+++ b/popup/popup.js
@@ -26,10 +26,6 @@ new (class ExtensionPopup {
// Bind event listeners
this.refetchCSSButton.addEventListener("click", this.refetchCSS.bind(this));
- document.getElementById("toggle-websites").addEventListener("click", () => {
- this.websitesList.classList.toggle("collapsed");
- });
-
this.autoUpdateSwitch.addEventListener(
"change",
this.saveSettings.bind(this)
@@ -38,7 +34,6 @@ new (class ExtensionPopup {
// Setup auto-update and display last fetched time
this.setupAutoUpdate();
this.displayLastFetchedTime();
- this.setupContentScriptInjection();
this.displayAddonVersion();
}
@@ -86,7 +81,6 @@ new (class ExtensionPopup {
this.autoUpdateSwitch.checked = this.browserStorageSettings.autoUpdate;
}
this.loadCurrentSiteFeatures();
- this.loadWebsitesList();
}
async loadSettings() {
@@ -120,7 +114,6 @@ new (class ExtensionPopup {
browser.storage.local.set({
[this.BROWSER_STORAGE_KEY]: this.browserStorageSettings,
});
-
console.info("Settings saved", this.browserStorageSettings);
}
@@ -181,38 +174,6 @@ new (class ExtensionPopup {
}
}
- async loadWebsitesList() {
- if (logging) console.log("loadWebsitesList called");
- // Load the list of websites with available styles
- try {
- const stylesData = await browser.storage.local.get("styles");
- const styles = stylesData.styles?.website || {};
-
- this.websitesList.innerHTML = "";
-
- const websites = Object.keys(styles);
-
- if (websites.length === 0) {
- const listItem = document.createElement("li");
- listItem.textContent =
- "No styles available. Click 'Refetch latest styles' to update.";
- this.websitesList.appendChild(listItem);
- return;
- }
-
- for (const site of websites) {
- const displayName = site.replace(/\.css$/, "");
- const listItem = document.createElement("li");
- listItem.textContent = displayName;
- this.websitesList.appendChild(listItem);
- }
- } catch (error) {
- console.error("Error loading websites list:", error);
- this.websitesList.innerHTML =
- "<li>Error loading websites list. Please try refetching styles.</li>";
- }
- }
-
isCurrentSite(siteName) {
if (logging) console.log("isCurrentSite called with", siteName);
// Check if the given site name matches the current site hostname
@@ -259,26 +220,6 @@ new (class ExtensionPopup {
}
}
- setupContentScriptInjection() {
- if (logging) console.log("setupContentScriptInjection called");
- // Setup content script injection for tab updates
- browser.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
- if (changeInfo.status === "complete") {
- this.applyCSSToTab(tab);
- }
- });
- this.updateAllTabs();
- }
-
- async updateAllTabs() {
- if (logging) console.log("updateAllTabs called");
- // Update CSS for all open tabs
- const tabs = await browser.tabs.query({});
- for (const tab of tabs) {
- this.applyCSSToTab(tab);
- }
- }
-
async updateActiveTabStyling() {
if (logging) console.log("updateActiveTabStyling called");
// Update CSS for the active tab