|
1 | 1 | // ==UserScript== |
2 | 2 | // @name YouTube™ Classic 📺 — (Remove rounded design + Return YouTube dislikes) |
3 | | -// @version 2025.10.19.1 |
| 3 | +// @version 2025.10.19.2 |
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 == 'adBlock') |
301 | | - homeObserver[config.adBlock ? 'observe' : 'disconnect'](document.documentElement, obsConfig) |
302 | 300 | if (options?.updatedKey.includes('Block')) |
303 | 301 | window.configStyle.textContent = Object.entries(domSelectors) |
304 | 302 | .map(([key, selectors]) => !config[`${key}Block`] ? '' |
|
2228 | 2226 | if (location.pathname != locationPath) { // nav'd to diff page, re-observe |
2229 | 2227 | locationPath = location.pathname ; homeObserver.disconnect() |
2230 | 2228 | getLoadedElem('html').then(() => homeObserver.observe(document.documentElement, obsConfig)) |
2231 | | - } else if (locationPath == '/') { // remove homepage shelves (for no gaps) + ads |
2232 | | - const adSlot = document.querySelector('ytd-ad-slot-renderer') |
2233 | | - const richSection = document.querySelector( |
2234 | | - `ytd-rich-section-renderer${ !config.shortsBlock ? ':not(:has(a[href*="/shorts/"]))' : '' }${ |
2235 | | - !config.playablesBlock ? ':not(:has(a[href*="/playables/"]))' : '' }` |
2236 | | - ) |
2237 | | - adSlot?.closest('[rendered-from-rich-grid]')?.remove() ; richSection?.remove() |
| 2229 | + } else if (locationPath == '/') { // remove regenerating homepage stuff |
| 2230 | + if (config.adBlock) // remove ads |
| 2231 | + document.querySelector('ytd-ad-slot-renderer')?.closest('[rendered-from-rich-grid]')?.remove() |
| 2232 | + if (config.shortsBlock || config.playablesBlock) { // remove shelves |
| 2233 | + document.querySelector( |
| 2234 | + `ytd-rich-section-renderer${ !config.shortsBlock ? ':not(:has(a[href*="/shorts/"]))' : '' }${ |
| 2235 | + !config.playablesBlock ? ':not(:has(a[href*="/playables/"]))' : '' }` |
| 2236 | + )?.remove() |
| 2237 | + } |
2238 | 2238 | } |
2239 | 2239 | }) |
2240 | | - if (config.shortsBlock || config.playablesBlock || config.adBlock) |
2241 | | - getLoadedElem('html').then(() => homeObserver.observe(document.documentElement, obsConfig)) |
| 2240 | + getLoadedElem('html').then(() => homeObserver.observe(document.documentElement, obsConfig)) |
2242 | 2241 |
|
2243 | 2242 | // Block stuff |
2244 | 2243 | document.head.append(window.configStyle ??= document.createElement('style')) |
|
0 commit comments