From a2f267b080ef775ea62a5f32a547612aa482f009 Mon Sep 17 00:00:00 2001 From: TheArchons Date: Mon, 26 Jan 2026 15:09:56 -0500 Subject: Add initial implementation of Unhook NG extension with manifest, popup, and content scripts --- unhook.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 unhook.js (limited to 'unhook.js') diff --git a/unhook.js b/unhook.js new file mode 100644 index 0000000..05c073f --- /dev/null +++ b/unhook.js @@ -0,0 +1,34 @@ +// Single stylesheet for all hiding rules +let styleElement = null; + +function applyStyles(settings) { + if (!styleElement) { + styleElement = document.createElement('style'); + styleElement.id = 'unhook-styles'; + document.head.appendChild(styleElement); + } + + const rules = []; + + if (settings.hideVideoSidebar) rules.push('#secondary { display: none !important; }') + if (settings.hideRecommended) rules.push('#related { display: none !important; }'); + if (settings.hideLiveChat) rules.push('#chat-container { display: none !important; }'); + if (settings.hidePlaylist) rules.push('#playlist { display: none !important; }'); + if (settings.hideFundraiser) rules.push('#donation-shelf { display: none !important; }'); + + + styleElement.textContent = rules.join('\n'); +} + +async function main() { + const settings = await browser.storage.local.get(null); + applyStyles(settings); +} + +// Content scripts run after DOM is ready by default, so call main directly +main(); + +// Listen for storage changes and reapply all settings +browser.storage.onChanged.addListener(() => { + main(); +}); -- cgit v1.3.1