diff --git a/features/dumpster-fire/data.json b/features/dumpster-fire/data.json new file mode 100644 index 00000000..2715fac2 --- /dev/null +++ b/features/dumpster-fire/data.json @@ -0,0 +1,14 @@ +{ + "title": "Dumpster Fire", + "description": "The Scratch homepage is a liar with their \"Featured Projects\" section. This changes the name to the proper form, which is \"Dumpster Fire\".", + "credits": [ + { + "username": "Kuzyn_Official", + "url": "https://scratch.mit.edu/users/Kuzyn_Official/" + }, + { "username": "rgantzos", "url": "https://scratch.mit.edu/users/rgantzos/" } + ], + "type": ["Website", "Egg"], + "dynamic": true, + "scripts": [{ "file": "script.js", "runOn": "/" }] +} diff --git a/features/dumpster-fire/script.js b/features/dumpster-fire/script.js new file mode 100644 index 00000000..3bbdfea3 --- /dev/null +++ b/features/dumpster-fire/script.js @@ -0,0 +1,20 @@ +export default async function ({ feature }) { + let box = await ScratchTools.waitForElement(".inner.mod-splash > .box"); + + if (box.className.includes("scratchtoolsCustomStudio")) { + box = box.nextSibling; + } + + let oldContent = box.querySelector("h4").textContent; + if (feature.self.enabled) { + box.querySelector("h4").textContent = "Dumpster Fire"; + } + + feature.addEventListener("disabled", function () { + box.querySelector("h4").textContent = oldContent; + }); + + feature.addEventListener("enabled", function () { + box.querySelector("h4").textContent = "Dumpster Fire"; + }); +} diff --git a/features/features.json b/features/features.json index 3c81892b..127827d1 100644 --- a/features/features.json +++ b/features/features.json @@ -1,8 +1,13 @@ [ + { "version": 2, "id": "more-news", "versionAdded": "v3.1.0" + },{ + "version": 2, + "id": "dumpster-fire", + "versionUpdated": "v3.1.0" }, { "version": 2, @@ -429,18 +434,6 @@ "tags": [], "dynamic": true }, - { - "title": "Dumpster Fire", - "description": "The Scratch homepage is a liar with their \"Featured Projects\" section. This changes the name to the proper form, which is \"Dumpster Fire\".", - "credits": ["Kuzyn_Official", "rgantzos"], - "urls": [ - "https://scratch.mit.edu/users/Kuzyn_Official/", - "https://scratch.mit.edu/users/rgantzos/" - ], - "file": "dumpster-fire", - "type": ["Website", "Egg"], - "dynamic": true - }, { "title": "Follower Count on Projects", "description": "Displays the follower count of the project creator on their projects.",