|
1 | 1 | // ==UserScript== |
2 | 2 | // @name YouTube™ Classic 📺 — (Remove rounded design + Return YouTube dislikes) |
3 | | -// @version 2026.1.17.54 |
| 3 | +// @version 2026.1.17.55 |
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 |
|
1272 | 1272 | return result |
1273 | 1273 | } |
1274 | 1274 |
|
1275 | | - const mutationObserver = new Object() |
1276 | | - |
1277 | | - if (isShorts() && !mutationObserver.exists) { |
| 1275 | + const shortsObs = new Object() |
| 1276 | + if (isShorts() && !shortsObs.exists) { |
1278 | 1277 | cLog('initializing mutation observer') |
1279 | | - mutationObserver.options = { childList: false, attributes: true, subtree: false } |
1280 | | - mutationObserver.exists = true |
1281 | | - mutationObserver.observer = new MutationObserver(function(mutationList) { |
1282 | | - mutationList.forEach(mutation => { |
1283 | | - if ( |
1284 | | - mutation.type == 'attributes' && |
1285 | | - mutation.target.nodeName == 'TP-YT-PAPER-BUTTON' && |
1286 | | - mutation.target.id == 'button' |
1287 | | - ) { |
1288 | | - cLog('Short thumb button status changed') |
1289 | | - if (mutation.target.getAttribute('aria-pressed') == 'true') { |
1290 | | - mutation.target.style.color = |
1291 | | - mutation.target.parentElement.parentElement.id == 'like-button' |
1292 | | - ? getColorFromTheme(true) |
1293 | | - : getColorFromTheme(false) |
1294 | | - } else { |
1295 | | - mutation.target.style.color = 'unset' |
1296 | | - } |
1297 | | - return |
1298 | | - } |
1299 | | - cLog(`unexpected mutation observer event: ${mutation.target.nodeName} ${mutation.type}`) |
1300 | | - })}) |
| 1278 | + shortsObs.options = { childList: false, attributes: true, subtree: false } |
| 1279 | + shortsObs.exists = true |
| 1280 | + shortsObs.observer = new MutationObserver(mutations => mutations.forEach(mutation => { |
| 1281 | + if (mutation.type == 'attributes' |
| 1282 | + && mutation.target.nodeName == 'TP-YT-PAPER-BUTTON' |
| 1283 | + && mutation.target.id == 'button' |
| 1284 | + ) { |
| 1285 | + cLog('Short thumb button status changed') |
| 1286 | + return mutation.target.style.color = |
| 1287 | + mutation.target.getAttribute('aria-pressed') == 'true' ? |
| 1288 | + getColorFromTheme(mutation.target.parentElement.parentElement.id == 'like-button') |
| 1289 | + : 'unset' |
| 1290 | + } |
| 1291 | + cLog(`unexpected mutation observer event: ${mutation.target.nodeName} ${mutation.type}`) |
| 1292 | + })) |
1301 | 1293 | } |
1302 | 1294 |
|
1303 | 1295 | function checkForUserAvatarButton() { |
|
1397 | 1389 | shortLikeBtn.style.color = getColorFromTheme(true) |
1398 | 1390 | if (shortDislikeBtn.getAttribute('aria-pressed') == 'true') |
1399 | 1391 | shortDislikeBtn.style.color = getColorFromTheme(false) |
1400 | | - mutationObserver.observer.observe(shortLikeBtn, mutationObserver.options) |
1401 | | - mutationObserver.observer.observe(shortDislikeBtn, mutationObserver.options) |
| 1392 | + shortsObs.observer.observe(shortLikeBtn, shortsObs.options) |
| 1393 | + shortsObs.observer.observe(shortDislikeBtn, shortsObs.options) |
1402 | 1394 | } else { |
1403 | 1395 | getLikeBtn().style.color = getColorFromTheme(true) |
1404 | 1396 | getDislikeBtn().style.color = getColorFromTheme(false) |
|
0 commit comments