aboutsummaryrefslogtreecommitdiff
path: root/unhook.js
diff options
context:
space:
mode:
authorTheArchons <github@thearchons.xyz>2026-01-26 15:09:56 -0500
committerTheArchons <github@thearchons.xyz>2026-01-26 15:09:56 -0500
commita2f267b080ef775ea62a5f32a547612aa482f009 (patch)
tree720214dd731347e6aed236c79daa48732f40f5f2 /unhook.js
parent53dae4c861f2343be00f7154d06f24555d200d1a (diff)
Add initial implementation of Unhook NG extension with manifest, popup, and content scripts
Diffstat (limited to 'unhook.js')
-rw-r--r--unhook.js34
1 files changed, 34 insertions, 0 deletions
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();
+});