|
1 | 1 | // ==UserScript== |
2 | 2 | // @name YouTube™ Classic 📺 — (Remove rounded design + Return YouTube dislikes) |
3 | | -// @version 2026.3.6.1 |
| 3 | +// @version 2026.4.14 |
4 | 4 | // @author Adam Lui, Magma_Craft, Fuim & hoothin |
5 | 5 | // @namespace https://github.com/adamlui |
6 | 6 | // @description Reverts YouTube to its classic design (before all the rounded corners & hidden dislikes) + redirects YouTube Shorts |
|
104 | 104 | settings.load(Object.keys(settings.controls)) |
105 | 105 |
|
106 | 106 | app.selectors = { site: { |
107 | | - ad: { masthead: 'div#masthead-ad' }, // https://imgur.com/a/kOWzh3O |
| 107 | + ad: { |
| 108 | + masthead: 'div#masthead-ad', // https://imgur.com/a/kOWzh3O |
| 109 | + thumbnail: 'ytd-rich-item-renderer:has(ytd-ad-slot-renderer)' |
| 110 | + }, |
108 | 111 | ai: { |
109 | 112 | askBtn: 'button:has(path[d*=M480-80q0-83])', |
110 | 113 | askSection: 'yt-video-description-youchat-section-view-model', |
111 | 114 | summary: 'div#header[class*=expandable-metadata]:has(path[d*=M480-80q0-83])' |
112 | 115 | }, |
113 | | - playables: { shelf: 'ytd-rich-section-renderer:has(a[href*="/playables/"])' }, |
| 116 | + playables: { |
| 117 | + shelf: 'ytd-rich-section-renderer:has(a[href*="/playables/"])' |
| 118 | + }, |
114 | 119 | shorts: { |
115 | 120 | navEntry: 'a#endpoint[title=Shorts]', |
116 | 121 | shelf: { |
117 | | - homepage: 'div.ytd-rich-shelf-renderer:has(a[href*="/shorts/"])', // https://imgur.com/a/LMdO92M |
| 122 | + homepage: 'ytd-rich-section-renderer:has(a[href*="/shorts/"])', // https://imgur.com/a/LMdO92M |
118 | 123 | results: 'grid-shelf-view-model:has(a[href*="/shorts/"])' // https://imgur.com/a/vVzoEfH |
119 | 124 | } |
120 | 125 | } |
|
1040 | 1045 |
|
1041 | 1046 | // CONFIG hacks |
1042 | 1047 |
|
1043 | | - let locationPath = location.pathname // to track nav |
1044 | | - const obsConfig = { childList: true, subtree: true } |
1045 | | - |
1046 | 1048 | // Redirect Shorts to classic player |
1047 | 1049 | if (app.config.disableShorts) checkShortsToRedir() |
1048 | 1050 | function checkShortsToRedir() { |
|
1051 | 1053 | checkShortsToRedir.id = requestAnimationFrame(checkShortsToRedir) |
1052 | 1054 | } |
1053 | 1055 |
|
1054 | | - // Remove homepage ads/rich sections |
1055 | | - const homeObserver = new MutationObserver(() => { |
1056 | | - if (location.pathname != locationPath) { // nav'd to diff page, re-observe |
1057 | | - locationPath = location.pathname ; homeObserver.disconnect() |
1058 | | - dom.get.loadedElem('html').then(() => homeObserver.observe(document.documentElement, obsConfig)) |
1059 | | - } else if (locationPath == '/') { // remove regenerating homepage stuff |
1060 | | - if (app.config.adBlock) // remove ads |
1061 | | - document.querySelector('ytd-ad-slot-renderer')?.closest('[rendered-from-rich-grid]')?.remove() |
1062 | | - if (app.config.shortsBlock || app.config.playablesBlock) // remove shelves |
1063 | | - document.querySelector(`ytd-rich-section-renderer${ |
1064 | | - !app.config.shortsBlock ? ':not(:has(a[href*="/shorts/"]))' : '' }${ |
1065 | | - !app.config.playablesBlock ? ':not(:has(a[href*="/playables/"]))' : '' }` |
1066 | | - )?.remove() |
1067 | | - } |
1068 | | - }) |
1069 | | - dom.get.loadedElem('html').then(() => homeObserver.observe(document.documentElement, obsConfig)) |
1070 | | - |
1071 | 1056 | // Set/update subscribe button pos |
1072 | 1057 | dom.get.loadedElem('ytd-subscribe-button-renderer button').then(subBtn => { |
1073 | 1058 | requestAnimationFrame(updateSubBtnPos) |
|
0 commit comments