Skip to content

Commit 130d043

Browse files
committed
Shortened comparison operators ↞ [auto-sync from https://github.com/adamlui/youtube-classic]
1 parent 6ae0481 commit 130d043

1 file changed

Lines changed: 25 additions & 25 deletions

File tree

youtube-classic/youtube-classic.user.js

Lines changed: 25 additions & 25 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.17
3+
// @version 2026.1.17.18
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
@@ -369,7 +369,7 @@
369369
static observer = new MutationObserver(this.onNewScript)
370370
static _config = {}
371371
static isObject(item) {
372-
return (item && typeof item === 'object' && !Array.isArray(item))
372+
return (item && typeof item == 'object' && !Array.isArray(item))
373373
}
374374
static mergeDeep(target, ...sources) {
375375
if (!sources.length) return target
@@ -1742,7 +1742,7 @@
17421742
let mobileDislikes = 0
17431743

17441744
function cLog(text, subtext = '') {
1745-
subtext = subtext.trim() === '' ? '' : `(${subtext})`
1745+
subtext = subtext.trim() == '' ? '' : `(${subtext})`
17461746
console.log(`[Return YouTube Dislikes] ${text} ${subtext}`)
17471747
}
17481748

@@ -1780,7 +1780,7 @@
17801780
document.querySelector('.slim-video-action-bar-actions')
17811781
)
17821782
}
1783-
if (document.getElementById('menu-container')?.offsetParent === null) {
1783+
if (document.getElementById('menu-container')?.offsetParent == null) {
17841784
return (
17851785
document.querySelector('ytd-menu-renderer.ytd-watch-metadata > div') ??
17861786
document.querySelector('ytd-menu-renderer.ytd-video-primary-info-renderer > div')
@@ -1793,7 +1793,7 @@
17931793
}
17941794

17951795
function getLikeButton() {
1796-
return getButtons().children[0].tagName ===
1796+
return getButtons().children[0].tagName ==
17971797
'YTD-SEGMENTED-LIKE-DISLIKE-BUTTON-RENDERER'
17981798
? getButtons().children[0].children[0]
17991799
: getButtons().children[0]
@@ -1808,7 +1808,7 @@
18081808
}
18091809

18101810
function getDislikeButton() {
1811-
return getButtons().children[0].tagName ===
1811+
return getButtons().children[0].tagName ==
18121812
'YTD-SEGMENTED-LIKE-DISLIKE-BUTTON-RENDERER'
18131813
? getButtons().children[0].children[1]
18141814
: getButtons().children[1]
@@ -1819,7 +1819,7 @@
18191819
getDislikeButton().querySelector('#text') ??
18201820
getDislikeButton().getElementsByTagName('yt-formatted-string')[0] ??
18211821
getDislikeButton().querySelector('span[role="text"]')
1822-
if (result === null) {
1822+
if (result == null) {
18231823
let textSpan = document.createElement('span')
18241824
textSpan.id = 'text'
18251825
textSpan.style.marginLeft = '2px'
@@ -1832,7 +1832,7 @@
18321832

18331833
let mutationObserver = new Object()
18341834

1835-
if (isShorts() && mutationObserver.exists !== true) {
1835+
if (isShorts() && mutationObserver.exists != true) {
18361836
cLog('initializing mutation observer')
18371837
mutationObserver.options = {
18381838
childList: false,
@@ -1843,14 +1843,14 @@
18431843
mutationObserver.observer = new MutationObserver(function(mutationList) {
18441844
mutationList.forEach((mutation) => {
18451845
if (
1846-
mutation.type === 'attributes' &&
1847-
mutation.target.nodeName === 'TP-YT-PAPER-BUTTON' &&
1848-
mutation.target.id === 'button'
1846+
mutation.type == 'attributes' &&
1847+
mutation.target.nodeName == 'TP-YT-PAPER-BUTTON' &&
1848+
mutation.target.id == 'button'
18491849
) {
18501850
cLog('Short thumb button status changed')
1851-
if (mutation.target.getAttribute('aria-pressed') === 'true') {
1851+
if (mutation.target.getAttribute('aria-pressed') == 'true') {
18521852
mutation.target.style.color =
1853-
mutation.target.parentElement.parentElement.id === 'like-button'
1853+
mutation.target.parentElement.parentElement.id == 'like-button'
18541854
? getColorFromTheme(true)
18551855
: getColorFromTheme(false)
18561856
} else {
@@ -1984,12 +1984,12 @@
19841984
likesvalue = likes
19851985
dislikesvalue = dislikes
19861986
setDislikes(numberFormat(dislikes))
1987-
if (extConfig.numberDisplayReformatLikes === true) {
1987+
if (extConfig.numberDisplayReformatLikes == true) {
19881988
const nativeLikes = getLikeCountFromButton()
19891989
if (nativeLikes != null) setLikes(numberFormat(nativeLikes))
19901990
}
19911991
createRateBar(likes, dislikes)
1992-
if (extConfig.coloredThumbs === true) {
1992+
if (extConfig.coloredThumbs == true) {
19931993
if (isShorts()) {
19941994
// for shorts, leave deactived buttons in default color
19951995
let shortLikeButton = getLikeButton().querySelector(
@@ -1998,10 +1998,10 @@
19981998
let shortDislikeButton = getDislikeButton().querySelector(
19991999
'tp-yt-paper-button#button'
20002000
)
2001-
if (shortLikeButton.getAttribute('aria-pressed') === 'true') {
2001+
if (shortLikeButton.getAttribute('aria-pressed') == 'true') {
20022002
shortLikeButton.style.color = getColorFromTheme(true)
20032003
}
2004-
if (shortDislikeButton.getAttribute('aria-pressed') === 'true') {
2004+
if (shortDislikeButton.getAttribute('aria-pressed') == 'true') {
20052005
shortDislikeButton.style.color = getColorFromTheme(false)
20062006
}
20072007
mutationObserver.observer.observe(
@@ -2040,7 +2040,7 @@
20402040
createRateBar(likesvalue, dislikesvalue)
20412041
previousState = 1
20422042
}
2043-
if (extConfig.numberDisplayReformatLikes === true) {
2043+
if (extConfig.numberDisplayReformatLikes == true) {
20442044
const nativeLikes = getLikeCountFromButton()
20452045
if (nativeLikes != null) setLikes(numberFormat(nativeLikes))
20462046
}
@@ -2065,7 +2065,7 @@
20652065
setDislikes(numberFormat(dislikesvalue))
20662066
createRateBar(likesvalue, dislikesvalue)
20672067
previousState = 2
2068-
if (extConfig.numberDisplayReformatLikes === true) {
2068+
if (extConfig.numberDisplayReformatLikes == true) {
20692069
const nativeLikes = getLikeCountFromButton()
20702070
if (nativeLikes != null) setLikes(numberFormat(nativeLikes))
20712071
}
@@ -2088,7 +2088,7 @@
20882088
function isVideoLoaded() {
20892089
if (isMobile) { return document.getElementById('player').getAttribute('loading') == 'false' }
20902090
const videoId = getVideoId()
2091-
return ( document.querySelector(`ytd-watch-flexy[video-id='${videoId}']`) !== null )
2091+
return ( document.querySelector(`ytd-watch-flexy[video-id='${videoId}']`) != null )
20922092
}
20932093

20942094
function roundDown(num) {
@@ -2101,7 +2101,7 @@
21012101

21022102
function numberFormat(numberState) {
21032103
let numberDisplay
2104-
if (extConfig.numberDisplayRoundDown === false) { numberDisplay = numberState
2104+
if (extConfig.numberDisplayRoundDown == false) { numberDisplay = numberState
21052105
} else { numberDisplay = roundDown(numberState) }
21062106
return getNumberFormatter(extConfig.numberDisplayFormat).format(numberDisplay)
21072107
}
@@ -2149,18 +2149,18 @@
21492149
let colorString
21502150
switch (extConfig.colorTheme) {
21512151
case 'accessible':
2152-
if (voteIsLike === true) {
2152+
if (voteIsLike == true) {
21532153
colorString = 'dodgerblue'
21542154
} else { colorString = 'gold' }
21552155
break
21562156
case 'neon':
2157-
if (voteIsLike === true) {
2157+
if (voteIsLike == true) {
21582158
colorString = 'aqua'
21592159
} else { colorString = 'magenta' }
21602160
break
21612161
case 'classic':
21622162
default:
2163-
if (voteIsLike === true) {
2163+
if (voteIsLike == true) {
21642164
colorString = 'lime'
21652165
} else { colorString = 'red' }
21662166
}
@@ -2202,7 +2202,7 @@
22022202
return originalPush.apply(history, args)
22032203
}
22042204
setInterval(() => {
2205-
if (getDislikeButton().querySelector('.button-renderer-text') === null) {
2205+
if (getDislikeButton().querySelector('.button-renderer-text') == null) {
22062206
getDislikeTextContainer().innerText = mobileDislikes
22072207
} else { getDislikeButton().querySelector('.button-renderer-text').innerText = mobileDislikes }
22082208
}, 1000)

0 commit comments

Comments
 (0)