How aashu-kattel/uner works
Main Components
• Manifest (manifest.json) – Declares permissions, content-script injection, and the popup UI.
• Popup UI (popup.html + popup.js) – Provides the toggle control and writes the enabled/disabled state to Chrome Storage Sync.
• Content Script (content.js) – Injected into every matching webpage; reads the toggle state, cleans existing links, and observes dynamic DOM changes.
• Chrome Storage Sync – Persists the toggle state across sessions and shares it between popup and content script.
• Host Webpage – Any webpage containing tags whose URLs need cleaning.
Relationships and Data Flows
• popup.js reads/writes the “enabled” flag in Chrome Storage Sync.
• popup.js sends a message or invokes chrome.tabs.reload() when toggled off.
• content.js checks the “enabled” flag on load; if true, it:
– Scans all tags, strips tracking parameters (utm_*, gclid, fbclid, etc.).
– Installs a MutationObserver to monitor newly added nodes and cleans their links.
• When the toggle is switched off, popup.js triggers a page reload; content.js sees “enabled = false” and does not clean.
Architectural Patterns
• Event-driven: popup UI events and DOM MutationObserver events.
• Separation of concerns: UI logic in popup, link-cleaning logic in content script.
• Message/state synchronization via Chrome Storage Sync (no persistent background script needed).
Technologies and APIs to Call Out
• Chrome Extensions APIs: chrome.storage.sync, chrome.tabs.reload, chrome.runtime.sendMessage/onMessage (if used)
• Web APIs: MutationObserver, DOM traversal (querySelectorAll)
• Standard HTML/CSS/JS for popup UI