aboutsummaryrefslogtreecommitdiff
path: root/unhook.js
diff options
context:
space:
mode:
authorTheArchons <github@thearchons.xyz>2026-01-26 17:16:14 -0500
committerTheArchons <github@thearchons.xyz>2026-01-26 17:16:14 -0500
commitd8da124df062724157d203b31bbf9e67ac9cd06f (patch)
treedf47a8aef61a68d7973e5dec052c4f7d0ae78a11 /unhook.js
parenta2f267b080ef775ea62a5f32a547612aa482f009 (diff)
Add redirect option to subscriptions and update popup checkboxes
Diffstat (limited to 'unhook.js')
-rw-r--r--unhook.js43
1 files changed, 41 insertions, 2 deletions
diff --git a/unhook.js b/unhook.js
index 05c073f..4e2066a 100644
--- a/unhook.js
+++ b/unhook.js
@@ -2,6 +2,15 @@
let styleElement = null;
function applyStyles(settings) {
+ // Redirect homepage to subscriptions
+ if (settings.redirectToSubscriptions) {
+ const path = window.location.pathname;
+ if (path === '/' || path === '/feed/trending') {
+ window.location.replace('https://www.youtube.com/feed/subscriptions');
+ return;
+ }
+ }
+
if (!styleElement) {
styleElement = document.createElement('style');
styleElement.id = 'unhook-styles';
@@ -10,13 +19,39 @@ function applyStyles(settings) {
const rules = [];
- if (settings.hideVideoSidebar) rules.push('#secondary { display: none !important; }')
+ if (settings.hideHomeFeed) rules.push('ytd-rich-grid-renderer { display: none !important; }');
+ 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; }');
-
+ if (settings.hideEndScreenCards) rules.push('.ytp-fullscreen-grid, .ytp-ce-element { display: none !important; }');
+ if (settings.hideShorts) rules.push('a#endpoint[title="Shorts"], ytd-shorts, grid-shelf-view-model, ytd-rich-shelf-renderer { display: none !important; }')
+
+ if (settings.hideComments) rules.push('.ytd-comments { display: none !important; }');
+ if (settings.hideProfilePhotos) rules.push('#author-thumbnail { display: none !important; }');
+
+ if (settings.hideMixes) rules.push('yt-lockup-view-model:has(a[href*="list=RDMM"]), ytd-playlist-renderer:has(a[href*="list=RDMM"]) { display: none !important; }');
+ if (settings.hideMerch) rules.push('ytd-merch-shelf-renderer { display: none !important; }');
+
+ if (settings.hideVideoInfo) rules.push('ytd-watch-metadata { display: none !important; }');
+ if (settings.hideButtonsBar) rules.push('#actions { display: none !important; }');
+ if (settings.hideChannel) rules.push('#owner { display: none !important; }');
+ if (settings.hideDescription) rules.push('#description { display: none !important; }');
+
+ if (settings.hideTopHeader) rules.push('#masthead-container { display: none !important; }');
+ if (settings.hideNotifications) rules.push('ytd-notification-topbar-button-renderer { display: none !important; }');
+
+ // there is no unique id for the explore section but "Music" is inside of this section so we can find only sections with music
+ if (settings.hideExplore) rules.push('ytd-guide-section-renderer:has(a[title="Music"]) { display: none !important; }');
+
+ // same as hideExplore but instead we find only sections with YouTube Premium
+ if (settings.hideMoreFromYT) rules.push('ytd-guide-section-renderer:has(a[title="YouTube Premium"]) { display: none !important; }');
+
+ // same as hideExplore but instead we only find sections with Subscriptions
+ if (settings.hideSubscriptions) rules.push('ytd-guide-section-renderer:has(a[title="Subscriptions"]) { display: none !important; }');
+
styleElement.textContent = rules.join('\n');
}
@@ -32,3 +67,7 @@ main();
browser.storage.onChanged.addListener(() => {
main();
});
+
+document.body.addEventListener("yt-navigate-start", function(event) {
+ main();
+}); \ No newline at end of file