diff options
author | sameerasw <[email protected]> | 2025-05-31 13:04:54 +0530 |
---|---|---|
committer | sameerasw <[email protected]> | 2025-05-31 13:04:54 +0530 |
commit | c5dc8714a62529ce7e0755d57f50cfddca3fdfef (patch) | |
tree | 7c890a9b8835625c33cbebada60ff29cfc27368a /background.js | |
parent | d8c38bf21c7eb8943331d6cb2cde7ba55b2c8720 (diff) |
Revert "fixed themes applying upon fetching"
This reverts commit 176a8a76245ed60d347d445441e1b75a31f16461.
Diffstat (limited to 'background.js')
-rw-r--r-- | background.js | 46 |
1 files changed, 4 insertions, 42 deletions
diff --git a/background.js b/background.js index b7612c6..48f6add 100644 --- a/background.js +++ b/background.js @@ -386,10 +386,6 @@ browser.runtime.onMessage.addListener(async (message, sender) => { } else if (message.action === "disableAutoUpdate") { stopAutoUpdate(); return true; - } else if (message.action === "reapplyStylesAfterFetch") { - // Triggered after fetching new styles from popup - await reapplyStylesToAllTabs(); - return true; } // Update the icon when the content script reports ready @@ -910,53 +906,19 @@ async function refetchCSS() { }); console.info("Initialized default settings during first fetch"); } else { - // Just update the lastFetchedTime while preserving other settings - const updatedSettings = { - ...settingsData[BROWSER_STORAGE_KEY], - lastFetchedTime: Date.now(), - }; - await browser.storage.local.set({ - [BROWSER_STORAGE_KEY]: updatedSettings, - }); + // Just update the lastFetchedTime + await browser.storage.local.set({ lastFetchedTime: Date.now() }); } console.info(`All styles refetched and updated from ${repositoryUrl}`); - // Clear CSS cache to ensure we use fresh styles - cssCache.clear(); - - // Preload the new styles while keeping site-specific settings - await preloadStyles(); - - // Reapply CSS to all active tabs - await reapplyStylesToAllTabs(); + // Preload the new styles + preloadStyles(); } catch (error) { console.error("Error refetching styles:", error); } } -// New function to reapply styles to all active tabs -async function reapplyStylesToAllTabs() { - try { - // Clear styling state cache to ensure fresh evaluation - stylingStateCache.clear(); - - // Get all active tabs - const tabs = await browser.tabs.query({}); - - // Reapply CSS to each tab - for (const tab of tabs) { - if (tab.url && tab.url.startsWith("http")) { - applyCSSToTab(tab); - } - } - - if (logging) console.log("Reapplied styles to all active tabs after fetch"); - } catch (error) { - console.error("Error reapplying styles to tabs:", error); - } -} - // Create a directory to store CSS files async function initializeExtension() { // Check and initialize default settings |