Skip to content

Commit 42066eb

Browse files
committed
Added live update on Redirect Shorts toggled
1 parent f51db03 commit 42066eb

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

youtube-classic/youtube-classic.user.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name YouTube™ Classic 📺 — (Remove rounded design + Return YouTube dislikes)
3-
// @version 2025.10.20
3+
// @version 2025.10.20.1
44
// @author Adam Lui, Magma_Craft, Anarios, JRWR, Fuim & hoothin
55
// @namespace https://github.com/adamlui
66
// @description Reverts YouTube to its classic design (before all the rounded corners & hidden dislikes) + redirects YouTube Shorts
@@ -297,7 +297,12 @@
297297
}
298298

299299
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'))
301306
window.configStyle.textContent = Object.entries(domSelectors)
302307
.map(([key, selectors]) => !config[`${key}Block`] ? ''
303308
: `${extractSelectors(selectors).join(',')} { display: none }`
@@ -2214,12 +2219,12 @@
22142219
const obsConfig = { childList: true, subtree: true }
22152220

22162221
// 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+
}
22232228

22242229
// Remove homepage ads/rich sections
22252230
const homeObserver = new MutationObserver(() => {

0 commit comments

Comments
 (0)