Skip to content

Commit 070b61e

Browse files
committed
Replaced for loops w/ for-of ones ↞ [auto-sync from https://github.com/adamlui/youtube-classic]
1 parent f4a9ffc commit 070b61e

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

youtube-classic/youtube-classic.user.js

Lines changed: 12 additions & 14 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.3
3+
// @version 2026.1.17.4
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
@@ -406,15 +406,15 @@
406406
}
407407
static decodePlyrFlags(flags) {
408408
const obj = {}, dflags = flags.split('&')
409-
for (let i = 0 ; i < dflags.length ; i++) {
410-
const dflag = dflags[i].split('=') ; obj[dflag[0]] = dflag[1] }
409+
for (const dflagStr of dflags) {
410+
const dflag = dflagStr.split('=') ; obj[dflag[0]] = dflag[1] }
411411
return obj
412412
}
413413
static encodePlyrFlags(flags) {
414414
const keys = Object.keys(flags) ; let response = ''
415-
for (let i = 0 ; i < keys.length ; i++) {
415+
for (const [i, key] of keys.entries()) {
416416
if (i > 0) response += '&'
417-
response += keys[i] + '=' + flags[keys[i]]
417+
response += key + '=' + flags[key]
418418
}
419419
return response
420420
}
@@ -557,25 +557,24 @@
557557
else return
558558
} else if (cfi18n.en[string])
559559
str = cfi18n.en[string]
560-
for (let i = 0 ; i < args.length ; i++)
561-
str = str.replace(/%s/, args[i])
560+
for (const arg of args)
561+
str = str.replace(/%s/, arg)
562562
return str
563563
}
564564
function getSimpleString(object) {
565565
if (object.simpleText) return object.simpleText
566566
let str = ''
567-
for (let i = 0 ; i < object.runs.length ; i++)
568-
str += object.runs[i].text
567+
for (const run of object.runs) str += run.text
569568
return str
570569
}
571570
function formatComment(comment) {
572571
if (cfconfig.unicodeEmojis) {
573572
let runs
574573
try {
575574
runs = comment.contentText.runs
576-
for (let i = 0 ; i < runs.length ; i++) {
577-
delete runs[i].emoji
578-
delete runs[i].loggingDirectives
575+
for (const run of runs) {
576+
delete run.emoji
577+
delete run.loggingDirectives
579578
}
580579
} catch(err) {}
581580
}
@@ -628,8 +627,7 @@
628627
const commentObserver = new MutationObserver((list) => {
629628
list.forEach(async(mutation) => {
630629
if (mutation.addedNodes) {
631-
for (let i = 0 ; i < mutation.addedNodes.length ; i++) {
632-
const elm = mutation.addedNodes[i]
630+
for (const elm of mutation.addedNodes) {
633631
if (elm.classList && elm.data && !elm.data.fixedByCF) {
634632
if (elm.tagName == 'YTD-COMMENT-THREAD-RENDERER') {
635633
elm.data = await formatCommentThread(elm.data)

0 commit comments

Comments
 (0)