|
1 | 1 | // ==UserScript== |
2 | 2 | // @name YouTube™ Classic 📺 — (Remove rounded design + Return YouTube dislikes) |
3 | | -// @version 2026.1.17.46 |
| 3 | +// @version 2026.1.17.47 |
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 |
|
204 | 204 | const thisQuadrantQueue = notifyProps.queue[notificationDiv.quadrant] |
205 | 205 | if (thisQuadrantQueue.length > 1) { |
206 | 206 | try { // to move old notifications |
207 | | - for (const divId of thisQuadrantQueue.slice(0, -1)) { // exclude new div |
208 | | - const oldDiv = document.getElementById(divId), |
| 207 | + for (const divID of thisQuadrantQueue.slice(0, -1)) { // exclude new div |
| 208 | + const oldDiv = document.getElementById(divID), |
209 | 209 | offsetProp = oldDiv.style.top ? 'top' : 'bottom', // pick property to change |
210 | 210 | vOffset = +parseInt(oldDiv.style[offsetProp]) +5 + oldDiv.getBoundingClientRect().height |
211 | 211 | oldDiv.style[offsetProp] = `${vOffset}px` // change prop |
|
1384 | 1384 | cLog('Fetching votes...') |
1385 | 1385 | let statsSet = false |
1386 | 1386 | fetch( |
1387 | | - `https://returnyoutubedislikeapi.com/votes?videoId=${getVideoId()}` |
| 1387 | + `https://returnyoutubedislikeapi.com/votes?videoId=${getVideoID()}` |
1388 | 1388 | ).then((response) => { |
1389 | 1389 | response.json().then((json) => { |
1390 | 1390 | if (json && !('traceId' in response) && !statsSet) { |
|
1472 | 1472 |
|
1473 | 1473 | function setInitialState() { setState() } |
1474 | 1474 |
|
1475 | | - function getVideoId() { |
1476 | | - const urlObject = new URL(unsafeWindow.location.href) |
1477 | | - const pathname = urlObject.pathname |
1478 | | - if (pathname.startsWith('/clip')) { return document.querySelector('meta[itemprop="videoId"]').content |
1479 | | - } else { |
1480 | | - if (pathname.startsWith('/shorts')) { return pathname.slice(8) } |
1481 | | - return urlObject.searchParams.get('v') |
1482 | | - } |
| 1475 | + function getVideoID() { |
| 1476 | + const urlObj = new URL(unsafeWindow.location.href), pathname = urlObj.pathname |
| 1477 | + return pathname.startsWith('/clip') ? document.querySelector('meta[itemprop="videoId"]')?.content |
| 1478 | + : pathname.startsWith('/shorts') ? pathname.slice(8) |
| 1479 | + : urlObj.searchParams.get('v') |
1483 | 1480 | } |
1484 | 1481 |
|
1485 | 1482 | function isVideoLoaded() { |
1486 | | - if (isMobile) { return document.getElementById('player').getAttribute('loading') == 'false' } |
1487 | | - const videoId = getVideoId() |
1488 | | - return ( document.querySelector(`ytd-watch-flexy[video-id='${videoId}']`) != null ) |
| 1483 | + return isMobile ? document.getElementById('player').getAttribute('loading') == 'false' |
| 1484 | + : document.querySelector(`ytd-watch-flexy[video-id='${getVideoID()}']`) |
1489 | 1485 | } |
1490 | 1486 |
|
1491 | 1487 | function roundDown(num) { |
|
0 commit comments