diff options
| author | TheArchons <github@thearchons.xyz> | 2026-01-26 17:16:14 -0500 |
|---|---|---|
| committer | TheArchons <github@thearchons.xyz> | 2026-01-26 17:16:14 -0500 |
| commit | d8da124df062724157d203b31bbf9e67ac9cd06f (patch) | |
| tree | df47a8aef61a68d7973e5dec052c4f7d0ae78a11 | |
| parent | a2f267b080ef775ea62a5f32a547612aa482f009 (diff) | |
Add redirect option to subscriptions and update popup checkboxes
| -rw-r--r-- | popup.html | 32 | ||||
| -rw-r--r-- | popup.js | 11 | ||||
| -rw-r--r-- | unhook.js | 43 |
3 files changed, 53 insertions, 33 deletions
@@ -49,6 +49,10 @@ <input type="checkbox" id="hideHomeFeed" checked> Hide Home Feed </label> + <label class="sub"> + <input type="checkbox" id="redirectToSubscriptions" checked> + Redirect To Subscriptions + </label> <label> <input type="checkbox" id="hideVideoSidebar" checked> @@ -72,11 +76,6 @@ </label> <label> - <input type="checkbox" id="hideEndScreenFeed" checked> - Hide End Screen Feed - </label> - - <label> <input type="checkbox" id="hideEndScreenCards" checked> Hide End Screen Cards </label> @@ -101,8 +100,8 @@ </label> <label> - <input type="checkbox" id="hideMerchTickets" checked> - Hide Merch, Tickets, Offers + <input type="checkbox" id="hideMerch" checked> + Hide Merch </label> <label> @@ -132,13 +131,8 @@ </label> <label> - <input type="checkbox" id="hideInaptSearch" checked> - Hide Inapt Search Results - </label> - - <label> - <input type="checkbox" id="hideExploreTrending" checked> - Hide Explore, Trending + <input type="checkbox" id="hideExplore" checked> + Hide Explore </label> <label> @@ -151,16 +145,6 @@ Hide Subscriptions </label> - <label> - <input type="checkbox" id="disableAutoplay" checked> - Disable Autoplay - </label> - - <label> - <input type="checkbox" id="disableAnnotations" checked> - Disable Annotations - </label> - <script src="popup.js"></script> </body> </html> @@ -1,29 +1,26 @@ const toggles = [ 'hideHomeFeed', + 'redirectToSubscriptions', 'hideVideoSidebar', 'hideRecommended', 'hideLiveChat', 'hidePlaylist', 'hideFundraiser', - 'hideEndScreenFeed', 'hideEndScreenCards', 'hideShorts', 'hideComments', 'hideProfilePhotos', 'hideMixes', - 'hideMerchTickets', + 'hideMerch', 'hideVideoInfo', 'hideButtonsBar', 'hideChannel', 'hideDescription', 'hideTopHeader', 'hideNotifications', - 'hideInaptSearch', - 'hideExploreTrending', + 'hideExplore', 'hideMoreFromYT', - 'hideSubscriptions', - 'disableAutoplay', - 'disableAnnotations' + 'hideSubscriptions' ]; // Load saved settings @@ -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 |
