YouTube Detox
+8
-0
@@ -7,2 +7,10 @@ # Changelog | ||
| ## [1.3.0] - 2026-02-12 | ||
| ### Added | ||
| - Removed YouTube Posts (Community posts) across feeds and channel pages | ||
| - Rewrote Home links to navigate directly to subscriptions | ||
| ### Fixed | ||
| - Prevented channel pages from breaking while still removing Shorts and recommendations | ||
| ## [1.2.2] - 2026-02-11 | ||
@@ -9,0 +17,0 @@ ### Changed |
@@ -14,2 +14,42 @@ // Redirect shorts, home page and trending to subscription feed | ||
| // Function to process channels properly | ||
| function isChannelPage() { | ||
| return window.location.pathname.startsWith('/@') || | ||
| window.location.pathname.startsWith('/channel/') || | ||
| window.location.pathname.startsWith('/c/'); | ||
| } | ||
| // Function to remove sections by its titles | ||
| function removeSectionsByTitle(containers, titles) { | ||
| const normalizedTitles = titles.map(t => t.toLowerCase()); | ||
| containers.forEach(container => { | ||
| const titleEl = container.querySelector('#title-text'); | ||
| if (!titleEl) { | ||
| return; | ||
| } | ||
| const title = titleEl.textContent.trim().toLowerCase(); | ||
| if (normalizedTitles.some(t => title.includes(t))) { | ||
| container.remove(); | ||
| } | ||
| }); | ||
| } | ||
| // Function to swap all Home links to Feed | ||
| function updateHomeLinks() { | ||
| const homeSelectors = [ | ||
| 'a[href="/"]', | ||
| 'a[href="/home"]', | ||
| 'a[href^="/?"]', | ||
| 'a[href^="/home?"]', | ||
| 'a[href="https://www.youtube.com/"]', | ||
| 'a[href="https://www.youtube.com"]', | ||
| 'a[href="https://m.youtube.com/"]', | ||
| 'a[href="https://m.youtube.com"]' | ||
| ]; | ||
| const homeLinks = document.querySelectorAll(homeSelectors.join(',')); | ||
| homeLinks.forEach(link => { | ||
| link.setAttribute('href', '/feed/subscriptions'); | ||
| }); | ||
| } | ||
| // Function to remove distracting elements from navigation | ||
@@ -56,2 +96,18 @@ function removeDistractingElements() { | ||
| const postsSelectors = [ | ||
| 'ytd-backstage-post-thread-renderer', // Community posts thread | ||
| 'ytd-backstage-post-renderer', // Single community post | ||
| 'ytd-post-renderer', // Post renderer in feeds | ||
| 'ytd-rich-item-renderer:has(ytd-backstage-post-renderer)', // Rich item wrapping posts | ||
| 'ytd-rich-item-renderer:has(ytd-post-renderer)', // Rich item wrapping posts | ||
| 'ytd-rich-section-renderer:has(ytd-backstage-post-renderer)',// Section with posts | ||
| 'ytd-rich-section-renderer:has(ytd-post-renderer)', // Section with posts | ||
| 'yt-tab-shape[tab-title="Posts"]', // Posts tab in channel | ||
| 'tp-yt-paper-tab:has(paper-item[role="tab"][aria-label="Posts"])', | ||
| 'yt-tab-shape[tab-title="Записи"]', | ||
| 'tp-yt-paper-tab:has(paper-item[role="tab"][aria-label="Записи"])', | ||
| 'a[href^="/post/"]', // Direct post links | ||
| 'a[href*="/post/"]' | ||
| ]; | ||
| const noConnectionSelectors = [ | ||
@@ -65,2 +121,5 @@ 'ytd-section-list-renderer' // No connection screen in the middle of redirect to subscriptions | ||
| // Rewrite home links to subscriptions for faster navigation | ||
| updateHomeLinks(); | ||
| // Remove end screen recommendations | ||
@@ -74,5 +133,31 @@ const endScreenElements = document.querySelectorAll(endScreenSelectors.join(',')); | ||
| // Remove no connection screen | ||
| const noConnectionElements = document.querySelectorAll(noConnectionSelectors.join(',')); | ||
| noConnectionElements.forEach(element => element.remove()); | ||
| // Remove posts from feeds and channel tabs | ||
| const postsElements = document.querySelectorAll(postsSelectors.join(',')); | ||
| postsElements.forEach(element => element.remove()); | ||
| // Remove no connection screen (avoid nuking channel page content) | ||
| if (!isChannelPage()) { | ||
| const noConnectionElements = document.querySelectorAll(noConnectionSelectors.join(',')); | ||
| noConnectionElements.forEach(element => element.remove()); | ||
| } | ||
| // On channel pages, remove Shorts and recommendation sections by title | ||
| if (isChannelPage()) { | ||
| const recommendationTitles = [ | ||
| 'recommended', | ||
| 'for you', | ||
| 'videos you may like', | ||
| 'рекомендованные', | ||
| 'рекомендовано', | ||
| 'для вас', | ||
| 'вам может понравиться', | ||
| 'posts', | ||
| 'записи', | ||
| 'сообщество' | ||
| ]; | ||
| const channelSections = document.querySelectorAll( | ||
| 'ytd-shelf-renderer, ytd-item-section-renderer, ytd-rich-section-renderer' | ||
| ); | ||
| removeSectionsByTitle(Array.from(channelSections), recommendationTitles); | ||
| } | ||
| } | ||
@@ -88,2 +173,3 @@ | ||
| handleNavigation(); | ||
| updateHomeLinks(); | ||
| removeDistractingElements(); | ||
@@ -99,2 +185,3 @@ }); | ||
| handleNavigation(); | ||
| updateHomeLinks(); | ||
| removeDistractingElements(); | ||
@@ -106,2 +193,3 @@ } | ||
| const observer = new MutationObserver(() => { | ||
| updateHomeLinks(); | ||
| removeDistractingElements(); | ||
@@ -108,0 +196,0 @@ }); |
+1
-1
| { | ||
| "manifest_version": 2, | ||
| "name": "YouTube Detox", | ||
| "version": "1.2.2", | ||
| "version": "1.3.0", | ||
| "homepage_url": "https://github.com/lemjoe/yt-detox", | ||
@@ -6,0 +6,0 @@ "description": "Transform YouTube into a focused, distraction-free space. Remove Shorts, recommendations, and stay in control of your viewing experience.", |
+5
-0
@@ -14,2 +14,3 @@ # YouTube Detox | ||
| - Automatically redirects homepage to your subscription feed | ||
| - Rewrites Home links to open subscriptions instantly | ||
@@ -22,2 +23,6 @@ - **Shorts-Free Experience** | ||
| - **Posts-Free Experience** | ||
| - Removes YouTube Posts (Community posts) across feeds | ||
| - Hides Posts tabs and sections on channel pages | ||
| - **Restored Dislike Counter** | ||
@@ -24,0 +29,0 @@ - Brings back the dislike count using Return YouTube Dislike API |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet