|
1 | 1 | // ==UserScript== |
2 | 2 | // @name YouTube™ Classic 📺 — (Remove rounded design + Return YouTube dislikes) |
3 | | -// @version 2025.10.19 |
| 3 | +// @version 2025.10.19.1 |
4 | 4 | // @author Adam Lui, Magma_Craft, Anarios, JRWR, 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 |
|
297 | 297 | } |
298 | 298 |
|
299 | 299 | function syncConfigToUI(options) { |
300 | | - if (options?.updatedKey == 'disableShorts') |
301 | | - shortsObserver[config.disableShorts ? 'observe' : 'disconnect'](document.body, obsConfig) |
302 | | - else if (options?.updatedKey == 'adBlock') |
| 300 | + if (options?.updatedKey == 'adBlock') |
303 | 301 | homeObserver[config.adBlock ? 'observe' : 'disconnect'](document.documentElement, obsConfig) |
304 | 302 | if (options?.updatedKey.includes('Block')) |
305 | 303 | window.configStyle.textContent = Object.entries(domSelectors) |
|
2214 | 2212 |
|
2215 | 2213 | // CONFIG hacks |
2216 | 2214 |
|
2217 | | - // Redirect Shorts to classic player |
2218 | 2215 | let locationPath = location.pathname // to track nav |
2219 | 2216 | const obsConfig = { childList: true, subtree: true } |
2220 | | - const shortsObserver = new MutationObserver(() => { |
2221 | | - if (location.pathname != locationPath) { // nav'd to diff page, re-observe if no redir |
2222 | | - locationPath = location.pathname ; shortsObserver.disconnect() |
2223 | | - getLoadedElem('body').then(() => shortsObserver.observe(document.body, obsConfig)) |
2224 | | - } else if (location.pathname.startsWith('/shorts')) { |
2225 | | - const vidID = location.pathname.split('/')[2] |
2226 | | - if (vidID && /^[\w-]{11}$/.test(vidID)) location.replace(`https://www.youtube.com/watch?v=${vidID}`) |
2227 | | - } |
2228 | | - }) |
2229 | | - if (config.disableShorts) getLoadedElem('body').then(() => shortsObserver.observe(document.body, obsConfig)) |
| 2217 | + |
| 2218 | + // Redirect Shorts to classic player |
| 2219 | + if (config.disableShorts) |
| 2220 | + (function checkShorts() { |
| 2221 | + if (location.pathname.startsWith('/shorts/')) |
| 2222 | + return location.replace(`https://www.youtube.com/watch?v=${location.pathname.split('/')[2]}`) |
| 2223 | + requestAnimationFrame(checkShorts) |
| 2224 | + })() |
2230 | 2225 |
|
2231 | 2226 | // Remove homepage ads/rich sections |
2232 | 2227 | const homeObserver = new MutationObserver(() => { |
|
0 commit comments