From 10d42a3dc0e98a9cca6ef94bae5cb42cd0f7e5d7 Mon Sep 17 00:00:00 2001 From: Spax Date: Thu, 15 Feb 2024 08:02:31 -0700 Subject: [PATCH] update the second method --- src/front/cobalt.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/front/cobalt.js b/src/front/cobalt.js index aa2662f4..35d15dc1 100644 --- a/src/front/cobalt.js +++ b/src/front/cobalt.js @@ -293,10 +293,8 @@ function checkbox(action) { case "disableAnimations": eid("cobalt-body").classList.toggle('no-animation'); break; case "wukkoDragonEmoji": document.getElementsByClassName("emoji").forEach((emoji) => { - if (emoji.attributes.src.value.match(/emoji\/dragon_face(?:_wukko)?\.svg/) === null) { + if (emoji.attributes.src.value.match(/emoji\/dragon_face(?:_wukko)?\.svg/) === null) return; - } - emoji.attributes.src.value = sGet("wukkoDragonEmoji") === "true" ? "emoji/dragon_face_wukko.svg" : "emoji/dragon_face.svg"; @@ -557,12 +555,13 @@ function loadSettings() { eid("downloadPopup").checked = true; if (sGet("wukkoDragonEmoji") === "true") eid("wukkoDragonEmoji").checked = true; - for (const emoji of document.getElementsByClassName("emoji")) - if (emoji.attributes.src.value.match(/emoji\/dragon_face(?:_wukko)?\.svg/) !== null) - if (sGet("wukkoDragonEmoji") === "true") - emoji.attributes.src.value = "emoji/dragon_face_wukko.svg"; - else - emoji.attributes.src.value = "emoji/dragon_face.svg"; + document.getElementsByClassName("emoji").forEach((emoji) => { + if (emoji.attributes.src.value.match(/emoji\/dragon_face(?:_wukko)?\.svg/) === null) + return; + emoji.attributes.src.value = sGet("wukkoDragonEmoji") === "true" + ? "emoji/dragon_face_wukko.svg" + : "emoji/dragon_face.svg"; + }); if (sGet("reduceTransparency") === "true" || isOldFirefox) eid("cobalt-body").classList.add('no-transparency'); if (sGet("disableAnimations") === "true")