Skip to content

Commit c02cb9b

Browse files
committed
Condensed getDislikeTextContainer() ↞ [auto-sync from https://github.com/adamlui/youtube-classic]
1 parent 588eebc commit c02cb9b

1 file changed

Lines changed: 11 additions & 12 deletions

File tree

youtube-classic/youtube-classic.user.js

Lines changed: 11 additions & 12 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 2026.1.17.25
3+
// @version 2026.1.17.26
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
@@ -1793,17 +1793,16 @@
17931793
}
17941794

17951795
function getDislikeTextContainer() {
1796-
let result =
1797-
getDislikeBtn().querySelector('#text') ??
1798-
getDislikeBtn().getElementsByTagName('yt-formatted-string')[0] ??
1799-
getDislikeBtn().querySelector('span[role="text"]')
1800-
if (result == null) {
1801-
let textSpan = document.createElement('span')
1802-
textSpan.id = 'text'
1803-
textSpan.style.marginLeft = '2px'
1804-
getDislikeBtn().querySelector('button').appendChild(textSpan)
1805-
getDislikeBtn().querySelector('button').style.width = 'auto'
1806-
result = getDislikeBtn().querySelector('#text')
1796+
const dislikeBtn = getDislikeBtn() ; if (!dislikeBtn) return null
1797+
let result = dislikeBtn.querySelector('#text')
1798+
?? dislikeBtn.getElementsByTagName('yt-formatted-string')[0]
1799+
?? dislikeBtn.querySelector('span[role="text"]')
1800+
if (!result) {
1801+
const textSpan = document.createElement('span')
1802+
textSpan.id = 'text' ; textSpan.style.marginLeft = '2px'
1803+
dislikeBtn.querySelector('button').append(textSpan)
1804+
dislikeBtn.querySelector('button').style.width = 'auto'
1805+
result = dislikeBtn.querySelector('#text')
18071806
}
18081807
return result
18091808
}

0 commit comments

Comments
 (0)