From 7cff9ea306f5f83abb1a7590ba132e24056fe9f9 Mon Sep 17 00:00:00 2001
From: rgantzos <86856959+rgantzos@users.noreply.github.com>
Date: Sun, 4 Aug 2024 13:06:28 -0700
Subject: [PATCH] Delete unused feature JS files
---
features/clone-counter.js | 51 ---------------
features/default-to-local.js | 17 -----
features/dumpster-fire.js | 25 -------
features/hide-scratch-news.js | 15 -----
features/message-count.js | 33 ----------
features/more-tutorials.js | 93 --------------------------
features/plain-background.js | 8 ---
features/start-stop-hotkeys.js | 15 -----
features/statistics.js | 26 --------
features/two-colors.js | 100 ----------------------------
features/user-stats.js | 116 ---------------------------------
11 files changed, 499 deletions(-)
delete mode 100644 features/clone-counter.js
delete mode 100644 features/default-to-local.js
delete mode 100644 features/dumpster-fire.js
delete mode 100644 features/hide-scratch-news.js
delete mode 100644 features/message-count.js
delete mode 100644 features/more-tutorials.js
delete mode 100644 features/plain-background.js
delete mode 100644 features/start-stop-hotkeys.js
delete mode 100644 features/statistics.js
delete mode 100644 features/two-colors.js
delete mode 100644 features/user-stats.js
diff --git a/features/clone-counter.js b/features/clone-counter.js
deleted file mode 100644
index 284cad21..00000000
--- a/features/clone-counter.js
+++ /dev/null
@@ -1,51 +0,0 @@
-var countClonesStill = true;
-function addCloneCounter() {
- if (document.querySelector("progress.clonecount.scratchtools") === null) {
- var bar = document.createElement("progress");
- bar.value = "0";
- bar.max = "300";
- bar.className = "clonecount scratchtools";
- bar.style.position = "absolute";
- bar.style.margin = "0";
- var style = document.createElement("style");
- style.innerHTML = `
- .clonecount {
- top: 50%;
- left: 50%;
- -ms-transform: translate(-50%, -50%);
- transform: translate(-50%, -50%);
- }
- `;
- document.body.appendChild(style);
- checkForCloneCounterPosition();
-
- function checkForCloneCounterPosition() {
- document.querySelectorAll("div").forEach(function (el) {
- if (el.className.includes("controls_controls-container_")) {
- el.appendChild(bar);
- cloneCount();
- }
- });
- if (document.querySelector("progress.clonecount.scratchtools") === null) {
- setTimeout(checkForCloneCounterPosition, 100);
- }
- }
-
- function cloneCount() {
- document.querySelector("progress.clonecount.scratchtools").value =
- ScratchTools.Scratch.vm.runtime._cloneCounter.toString();
- document.querySelector(
- "progress.clonecount.scratchtools"
- ).style.backgroundColor =
- ScratchTools.Scratch.vm.runtime._cloneCounter.toString();
- if (countClonesStill) {
- setTimeout(cloneCount, 200);
- }
- }
- }
-}
-addCloneCounter();
-ScratchTools.setDisable("clone-counter", function () {
- countClonesStill = false;
- document.querySelector(".clonecount").remove();
-});
diff --git a/features/default-to-local.js b/features/default-to-local.js
deleted file mode 100644
index 3a7dfb6e..00000000
--- a/features/default-to-local.js
+++ /dev/null
@@ -1,17 +0,0 @@
-var defaultToLocal = true;
-ScratchTools.waitForElements(
- ".ReactModalPortal",
- function (el) {
- if (el.querySelector('[class^="prompt_variable-name-text-input_"]')) {
- if (defaultToLocal) {
- document.querySelectorAll('[name="variableScopeOption"]')[1].click();
- }
- }
- },
- "default local",
- false
-);
-
-ScratchTools.setDisable("default-to-local", function () {
- defaultToLocal = false;
-});
diff --git a/features/dumpster-fire.js b/features/dumpster-fire.js
deleted file mode 100644
index b5e4ae2d..00000000
--- a/features/dumpster-fire.js
+++ /dev/null
@@ -1,25 +0,0 @@
-var enabledDumpsterFire = true;
-
-ScratchTools.waitForElements(
- "div.inner.mod-splash > div.box > div.box-header > h4",
- function (element) {
- if (enabledDumpsterFire) {
- element.textContent = "Dumpster Fire";
- }
- },
- "dumpster fire",
- false
-);
-
-ScratchTools.setDisable("dumpster-fire", function () {
- enabledDumpsterFire = false;
- if (
- document.querySelector(
- "div.inner.mod-splash > div.box > div.box-header > h4"
- )
- ) {
- document.querySelector(
- "div.inner.mod-splash > div.box > div.box-header > h4"
- ).textContent = "Featured Projects";
- }
-});
diff --git a/features/hide-scratch-news.js b/features/hide-scratch-news.js
deleted file mode 100644
index 6ab683df..00000000
--- a/features/hide-scratch-news.js
+++ /dev/null
@@ -1,15 +0,0 @@
-if (
- window.location.href === "https://scratch.mit.edu" ||
- window.location.href === "https://scratch.mit.edu/"
-) {
- function checkForDiv() {
- if (document.querySelector("div.box.news") !== null) {
- document.querySelector("div.box.news").remove();
- document.querySelector("div.box.activity").style.width =
- "calc(120% - 20px)";
- } else {
- setTimeout(checkForDiv, 100);
- }
- }
- checkForDiv();
-}
diff --git a/features/message-count.js b/features/message-count.js
deleted file mode 100644
index 4f2f3a18..00000000
--- a/features/message-count.js
+++ /dev/null
@@ -1,33 +0,0 @@
-if (!document.querySelector(".location").className.includes(" scratchtools")) {
- getapi2(
- `https://api.${window.location.href.replaceAll(
- "https://",
- ""
- )}messages/count`
- );
- async function getapi2(url) {
- if (!document.querySelector(".ste-messagecount")) {
- // Storing response
- const response = await fetch(url);
-
- // Storing data in form of JSON
- var data = await response.json();
- console.log(data);
- var stuff = data["count"];
- var span = document.createElement("span");
- span.className = "ste-messagecount";
- span.textContent = `${stuff} Messages`;
- span.title = "This was added by ScratchTools.";
- span.style.borderLeft = "1px solid #ccc";
- span.style.paddingLeft = "5px";
- span.style.marginLeft = "5px";
- span.setScratchTools();
-
- ScratchTools.appendToSharedSpace({
- space: "afterProfileCountry",
- element: span,
- order: 0,
- });
- }
- }
-}
diff --git a/features/more-tutorials.js b/features/more-tutorials.js
deleted file mode 100644
index 0020c46b..00000000
--- a/features/more-tutorials.js
+++ /dev/null
@@ -1,93 +0,0 @@
-if (window.location.href.includes("https://scratch.mit.edu/ideas")) {
- el = document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(1)"
- );
- var clone = el.cloneNode(true);
- document
- .querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div"
- )
- .appendChild(clone);
- var elem = document.createElement("a");
- elem.href = "https://www.youtube.com/watch?v=xZgeaYdx_uM&t";
- elem.textContent = "Make a Clicker Game";
- document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(10) > div > div.ttt-tile-info > h4"
- ).textContent = "";
- document
- .querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(10) > div > div.ttt-tile-info > h4"
- )
- .appendChild(elem);
- document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(10)"
- ).onClick = 'window.location.href = "https://scratchstatus.org/"';
- document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(10) > div > div.ttt-tile-info > p"
- ).textContent = "Make a game where people earn points by clicking an object!";
- document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(10) > div > div.ttt-tile-image > img"
- ).src = "https://i.ibb.co/m0Kp8BG/download-1-1.png";
-
- el = document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(1)"
- );
- var clone = el.cloneNode(true);
- document
- .querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div"
- )
- .appendChild(clone);
- var elem = document.createElement("a");
- elem.href = "https://youtu.be/aUmXJJww7KE";
- elem.textContent = "Make a Platformer Game";
- document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(11) > div > div.ttt-tile-info > h4"
- ).textContent = "";
- document
- .querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(11) > div > div.ttt-tile-info > h4"
- )
- .appendChild(elem);
- document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(11)"
- ).onClick = 'window.location.href = "https://scratchstatus.org/"';
- document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(11) > div > div.ttt-tile-info > p"
- ).textContent = "Make a game where characters jump over walls and spikes!";
- document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(11) > div > div.ttt-tile-image > img"
- ).src = "https://i.ibb.co/0ZsJKff/a-Um-XJJww7-KE-HD.jpg";
-
- el = document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(1)"
- );
- var clone = el.cloneNode(true);
- document
- .querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div"
- )
- .appendChild(clone);
- var elem = document.createElement("a");
- elem.href = "https://youtu.be/JEw3xiC3-aQ";
- elem.textContent = "Make a Snake Game";
- document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(12) > div > div.ttt-tile-info > h4"
- ).textContent = "";
- document
- .querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(12) > div > div.ttt-tile-info > h4"
- )
- .appendChild(elem);
- document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(12)"
- ).onClick = 'window.location.href = "https://scratchstatus.org/"';
- document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(12) > div > div.ttt-tile-info > p"
- ).textContent =
- "Make a game where you control a snake and make sure it does not die!";
- document.querySelector(
- "#view > div > div.tips-activity-guides > div > section > div.masonry > div > div:nth-child(12) > div > div.ttt-tile-image > img"
- ).src =
- "https://i.ytimg.com/vi/JEw3xiC3-aQ/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBBSeaBRVYFbQ99iUc4iqPTmVvytg";
-}
diff --git a/features/plain-background.js b/features/plain-background.js
deleted file mode 100644
index f6363ad5..00000000
--- a/features/plain-background.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var scratchtoolsPlainBackground = ScratchTools.styles.add(
- ".blocklyMainBackground { fill: none !important; }",
- "plain-background"
-);
-
-ScratchTools.setDisable("plain-background", function () {
- ScratchTools.styles.removeStyleById("plain-background");
-});
diff --git a/features/start-stop-hotkeys.js b/features/start-stop-hotkeys.js
deleted file mode 100644
index 2db0884d..00000000
--- a/features/start-stop-hotkeys.js
+++ /dev/null
@@ -1,15 +0,0 @@
-document.addEventListener("keydown", function (e) {
- if (e.which === 71 && (e.metaKey || e.ctrlKey)) {
- e.preventDefault();
- if (ScratchTools.Scratch.scratchGui().vmStatus.started) {
- if (ScratchTools.Scratch.scratchGui().vmStatus.running) {
- ScratchTools.Scratch.vm.stopAll();
- } else {
- ScratchTools.Scratch.vm.greenFlag();
- }
- } else {
- ScratchTools.Scratch.vm.start();
- ScratchTools.Scratch.vm.greenFlag();
- }
- }
-});
diff --git a/features/statistics.js b/features/statistics.js
deleted file mode 100644
index 5781a486..00000000
--- a/features/statistics.js
+++ /dev/null
@@ -1,26 +0,0 @@
-if (window.location.href.includes("https://scratch.mit.edu/mystuff")) {
- if (document.querySelector("li.statistics") === null) {
- function stuff() {
- el = document.querySelector("#tabs > li:nth-child(5)");
- var clone = el.cloneNode(true);
- document.querySelector("#tabs").appendChild(clone);
- document.querySelector("#tabs > li:nth-child(6) > a").textContent =
- "Statistics";
- document.querySelector("#tabs > li:nth-child(6)").className =
- "last statistics";
- document.querySelector("#tabs > li:nth-child(6)").dataTab = "stats";
- document.querySelector(
- "#tabs > li:nth-child(6) > a"
- ).href = `https://scratchstats.com/${
- document
- .querySelector(
- "#topnav > div > div > ul.account-nav.logged-in > li.logged-in-user.dropdown > div > ul > li:nth-child(1) > a"
- )
- .href.split("/users/")[1]
- }`;
- }
- setTimeout(() => {
- stuff();
- }, 50);
- }
-}
diff --git a/features/two-colors.js b/features/two-colors.js
deleted file mode 100644
index 9c99ca5e..00000000
--- a/features/two-colors.js
+++ /dev/null
@@ -1,100 +0,0 @@
-function GM_addStyle(text) {
- var style = document.createElement("style");
- style.innerHTML = text;
- document.body.appendChild(style);
-}
-//Procedures
-GM_addStyle(
- " path.blocklyBlockBackground[stroke='#FF3355'], .blocklyBlockBackground[stroke='#FF3355']{fill:#6d30a4 !important; stroke: #8a55d7 !important; stroke-width: 1px;} g[data-shapes='argument round'] > path.blocklyPath[fill='#FF6680']{fill: #6d30a4 !important;} path.blocklyPath[fill='#FF3355'][data-argument-type='boolean']{fill: #8357AC !important;}"
-);
-//Motion
-GM_addStyle(
- "g[data-category=motion] > path.blocklyBlockBackground{fill:#4a6cd4;}.blocklyDropDownDiv[data-category=motion]{background:#4a6cd4 !important;}"
-);
-//Looks
-GM_addStyle(
- "g[data-category=looks] > path.blocklyBlockBackground{fill:#8a55d7;}.blocklyDropDownDiv[data-category=looks]{background:#8a55d7 !important;}"
-);
-//Sound & Music
-GM_addStyle(
- "g[data-category=sounds] > path.blocklyBlockBackground,g[data-category=Music] > path.blocklyBlockBackground, g[data-category=Music] > g[data-shapes=round] > path.blocklyPath.blocklyBlockBackground {fill:#bb42c3; stroke:#99489e !important;}.blocklyDropDownDiv[data-category=sounds], .blocklyDropDownDiv[data-category=Music]{background:#bb42c3 !important; border-color: #99489e !important;} line[stroke='#0DA57A'] {stroke: white !important;} path[stroke='#0B8E69']:not(g[data-category='Pen'] > path.blocklyBlockBackground){stroke: #99489e !important;}"
-);
-//Events
-GM_addStyle(
- "g[data-category=events] > path.blocklyBlockBackground, .blocklyPath[fill='#FFBF00']{fill:#c88330;}.blocklyDropDownDiv[data-category=events], .blocklyPath[fill='#FFBF00'].blocklyDropDownDiv[data-category=events] /*Commented out for now, as this causes some issues ,.blocklyDropDownDiv[data-category=null]*/{background:#c88330 !important;}"
-);
-//Control
-GM_addStyle(
- "g[data-category=control] > path.blocklyBlockBackground{fill:#e1a91a;}.blocklyDropDownDiv[data-category=control]{background:#e1a91a !important;}"
-);
-//Sensing
-GM_addStyle(
- "g[data-category=sensing] > path.blocklyBlockBackground, .blocklyPath[fill='#5CB1D6'] {fill:#2ca5e2;}.blocklyDropDownDiv[data-category=sensing]{background:#2ca5e2 !important;}"
-);
-//Operators
-GM_addStyle(
- "g[data-category=operators] > path.blocklyBlockBackground{fill:#5cb712;}.blocklyDropDownDiv[data-category=operators]{background:#5cb712 !important;}"
-);
-//Pen
-GM_addStyle(
- "g[data-category=Pen] > path.blocklyBlockBackground{fill:#00a375; stroke: #009365}.blocklyDropDownDiv[data-category=Pen]{background:#00a375 !important;}"
-);
-//Data
-GM_addStyle(
- "g[data-category=data] > path.blocklyBlockBackground{fill:#ee7d16;}.blocklyDropDownDiv[data-category=data]{background:#ee7d16 !important;}"
-);
-//Lists
-GM_addStyle(
- "g[data-category=data-lists] > path.blocklyBlockBackground{fill:#d36518;}.blocklyDropDownDiv[data-category=data-lists]{background:#d36518 !important;}"
-);
-//Text Inputs
-GM_addStyle(
- "g[data-shapes='argument round']path.blocklyBlockBackground, path[fill='#ffffff']{fill: white; stroke-width: 1px;}"
-);
-//Make dropdowns stand out
-GM_addStyle(
- "g[data-argument-type='dropdown'] path.blocklyBlockBackground, g[data-argument-type='variable'] path.blocklyBlockBackground, rect.blocklyBlockBackground{fill: #55555555;}"
-);
-//Make color previews continue to work
-GM_addStyle(
- "g[data-argument-type='colour']path.blocklyBlockBackground{fill: initial;}"
-);
-//Make category colors match the block colors
-GM_addStyle(
- "div.scratchCategoryMenuRow:nth-child(1) > div:nth-child(1) > div:nth-child(1) {background: #4a6cd4 !important; border-color: #4e64aa !important;}"
-);
-GM_addStyle(
- "div.scratchCategoryMenuRow:nth-child(2) > div:nth-child(1) > div:nth-child(1) {background: #8a55d7 !important;}"
-);
-GM_addStyle(
- "div.scratchCategoryMenuRow:nth-child(3) > div:nth-child(1) > div:nth-child(1) {background: #bb42c3 !important;}"
-);
-GM_addStyle(
- "div.scratchCategoryMenuRow:nth-child(4) > div:nth-child(1) > div:nth-child(1) {background: #c88330 !important;}"
-);
-GM_addStyle(
- "div.scratchCategoryMenuRow:nth-child(5) > div:nth-child(1) > div:nth-child(1) {background: #e1a91a !important;}"
-);
-GM_addStyle(
- "div.scratchCategoryMenuRow:nth-child(6) > div:nth-child(1) > div:nth-child(1) {background: #2ca5e2 !important;}"
-);
-GM_addStyle(
- "div.scratchCategoryMenuRow:nth-child(7) > div:nth-child(1) > div:nth-child(1) {background: #5cb712 !important;}"
-);
-GM_addStyle(
- "div.scratchCategoryMenuRow:nth-child(8) > div:nth-child(1) > div:nth-child(1) {background: #ee7d16 !important;}"
-);
-GM_addStyle(
- "div.scratchCategoryMenuRow:nth-child(9) > div:nth-child(1) > div:nth-child(1) {background: #6d30a4 !important; border-color: #a249f3 !important;}"
-);
-//Various fixes
-GM_addStyle(
- ".removableTextInput, .blocklyWidgetDiv, .fieldTextInput {border-color: #ffffff66;"
-);
-GM_addStyle(".valueReportBox{color: #bfbfbf;}");
-GM_addStyle(
- ".blocklyWidgetDiv .fieldTextInput {border-color: #55555555;} g[data-shapes='argument round'] > .blocklyPath[stroke='#FF3355']{fill: white !important;}"
-);
-GM_addStyle(
- "g[data-argument-type='dropdown'] path.blocklyBlockBackground, g[data-shapes='argument round'] > .blocklyPath.blocklyBlockBackground {stroke: #55555555;} "
-);
diff --git a/features/user-stats.js b/features/user-stats.js
deleted file mode 100644
index 5a5b8f84..00000000
--- a/features/user-stats.js
+++ /dev/null
@@ -1,116 +0,0 @@
-async function getStats() {
- if (window.location.href.startsWith("https://scratch.mit.edu/users/")) {
- var response = await fetch(
- `https://scratchdb.lefty.one/v3/user/info/${window.location.href.replaceAll(
- "https://scratch.mit.edu/users/",
- ""
- )}`
- );
- var data = await response.json();
- if (data.statistics != undefined) {
- function image(url, alt) {
- return ``;
- }
- function space() {
- return " ";
- }
- function commafy(num) {
- if (num == undefined) {
- return "0";
- } else {
- return parseInt(num).toLocaleString();
- }
- }
- var activity = document.getElementById("activity-feed");
- activity.style.display = "none"; //remove();
- var box = document.getElementsByClassName("doing")[0];
- var table = `${
- "