From efd6945a13e93a6f5aff7ce1a818bd41b327ea31 Mon Sep 17 00:00:00 2001 From: rgantzos Date: Mon, 9 Jan 2023 12:37:45 -0800 Subject: [PATCH] Better method for Unbold Site Text + make dynamic --- features/features.json | 3 ++- features/unbold-site-text.js | 14 +++++--------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/features/features.json b/features/features.json index b61378d1..4067299c 100644 --- a/features/features.json +++ b/features/features.json @@ -979,7 +979,8 @@ "https://scratch.mit.edu/users/rgantzos/" ], "file": "unbold-site-text", - "type": ["Website", "Theme"] + "type": ["Website", "Theme"], + "dynamic": true }, { "title": "Compact Navbar", diff --git a/features/unbold-site-text.js b/features/unbold-site-text.js index 6ac571a4..374beda5 100644 --- a/features/unbold-site-text.js +++ b/features/unbold-site-text.js @@ -1,9 +1,5 @@ -function unbold() { - if (window.location.href.includes("https://scratch.mit.edu/")) { - document.querySelectorAll("*").forEach(function (el) { - el.style.fontWeight = "normal"; - }); - window.setTimeout(unbold, 100); - } -} -unbold(); +var style = ScratchTools.styles.add("* { font-weight: normal !important; }"); + +ScratchTools.setDisable("unbold-site-text", function () { + style.remove(); +});