|
1 | 1 | // ==UserScript== |
2 | 2 | // @name YouTube™ Classic 📺 — (Remove rounded design + Return YouTube dislikes) |
3 | | -// @version 2025.10.20 |
| 3 | +// @version 2025.10.20.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.includes('Block')) |
| 300 | + if (options?.updatedKey == 'disableShorts') { |
| 301 | + if (config.disableShorts && !checkShortsToRedir.id) |
| 302 | + checkShortsToRedir() |
| 303 | + else if (!config.disableShorts && checkShortsToRedir.id) { |
| 304 | + cancelAnimationFrame(checkShortsToRedir.id) ; checkShortsToRedir.id = null } |
| 305 | + } else if (options?.updatedKey.includes('Block')) |
301 | 306 | window.configStyle.textContent = Object.entries(domSelectors) |
302 | 307 | .map(([key, selectors]) => !config[`${key}Block`] ? '' |
303 | 308 | : `${extractSelectors(selectors).join(',')} { display: none }` |
|
2214 | 2219 | const obsConfig = { childList: true, subtree: true } |
2215 | 2220 |
|
2216 | 2221 | // Redirect Shorts to classic player |
2217 | | - if (config.disableShorts) |
2218 | | - (function checkShorts() { |
2219 | | - if (location.pathname.startsWith('/shorts/')) |
2220 | | - return location.replace(`https://www.youtube.com/watch?v=${location.pathname.split('/')[2]}`) |
2221 | | - requestAnimationFrame(checkShorts) |
2222 | | - })() |
| 2222 | + if (config.disableShorts) checkShortsToRedir() |
| 2223 | + function checkShortsToRedir() { |
| 2224 | + if (location.pathname.startsWith('/shorts/')) |
| 2225 | + return location.replace(`https://www.youtube.com/watch?v=${location.pathname.split('/')[2]}`) |
| 2226 | + checkShortsToRedir.id = requestAnimationFrame(checkShortsToRedir) |
| 2227 | + } |
2223 | 2228 |
|
2224 | 2229 | // Remove homepage ads/rich sections |
2225 | 2230 | const homeObserver = new MutationObserver(() => { |
|
0 commit comments