From 19b142c7c9afc41971259b4b20ecbc1662c63497 Mon Sep 17 00:00:00 2001 From: Wilamaxin <63302372+Wilamaxin@users.noreply.github.com> Date: Tue, 23 May 2023 23:43:12 +0200 Subject: [PATCH 1/3] "Highlight Unanswered" update to feature version 2 --- features/features.json | 21 +++++---------------- features/highlight-unanswered/data.json | 10 ++++++++++ features/highlight-unanswered/script.js | 18 ++++++++++++++++++ 3 files changed, 33 insertions(+), 16 deletions(-) create mode 100644 features/highlight-unanswered/data.json create mode 100644 features/highlight-unanswered/script.js diff --git a/features/features.json b/features/features.json index f3b5ed09..b45cd505 100644 --- a/features/features.json +++ b/features/features.json @@ -203,15 +203,9 @@ { "id": "Studio ID", "name": "Studio ID", "default": "27205657" } ] }, - { - "title": "Highlight Unanswered Forum Topics", - "description": "Adds a blue highlight to topics in the forums that have no replies.", - "credits": ["rgantzos"], - "urls": ["https://scratch.mit.edu/users/rgantzos/"], - "file": "highlight-unanswered", - "type": ["Website"], - "tags": ["New", "Recommended"], - "dynamic": true + { + "version": 2, + "id": "highlight-unanswered" }, { "title": "Hide Project Tags", @@ -764,13 +758,8 @@ "type": ["Website"] }, { - "title": "Go to Parent Button", - "description": "In the editor for any project that is a remix, you can click a button to go to the editor in the parent project.", - "credits": ["rgantzos"], - "urls": ["https://scratch.mit.edu/users/rgantzos/"], - "file": "go-to-parent", - "tags": [], - "type": ["Editor"] + "version": 2, + "id": "go-to-parent" }, { "title": "Most Popular Project", diff --git a/features/highlight-unanswered/data.json b/features/highlight-unanswered/data.json new file mode 100644 index 00000000..422489e4 --- /dev/null +++ b/features/highlight-unanswered/data.json @@ -0,0 +1,10 @@ +{ + "title": "Highlight Unanswered Forum Topics", + "description": "Adds a blue highlight to topics in the forums that have no replies.", + "credits": [ + { "username": "rgantzos", "url": "https://scratch.mit.edu/users/rgantzos/" } + ], + "type": ["Website"], + "tags": ["New", "Recommended"], + "scripts": [{ "file": "script.js", "runOn": "/discuss/*" }] +} \ No newline at end of file diff --git a/features/highlight-unanswered/script.js b/features/highlight-unanswered/script.js new file mode 100644 index 00000000..c96183f8 --- /dev/null +++ b/features/highlight-unanswered/script.js @@ -0,0 +1,18 @@ +if ( + window.location.href + .toLowerCase() + .startsWith("https://scratch.mit.edu/discuss/") && + window.location.href.toLowerCase() !== "https://scratch.mit.edu/discuss/" && + window.location.href.toLowerCase() !== "https://scratch.mit.edu/discuss" +) { + document.querySelectorAll("tbody > tr").forEach(function (el) { + if (el.querySelector("td.tc2").textContent === "0") { + el.style.backgroundColor = "#dce8f7"; + } + }); +} +ScratchTools.setDisable("highlight-unanswered", function () { + document.querySelectorAll("tbody > tr").forEach(function (el) { + el.style.backgroundColor = null; + }); +}); \ No newline at end of file From 3238c11df3b705a1fb2110b4f70e4dc87b54efab Mon Sep 17 00:00:00 2001 From: Wilamaxin <63302372+Wilamaxin@users.noreply.github.com> Date: Tue, 23 May 2023 23:44:15 +0200 Subject: [PATCH 2/3] Delete old .js --- features/highlight-unanswered.js | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 features/highlight-unanswered.js diff --git a/features/highlight-unanswered.js b/features/highlight-unanswered.js deleted file mode 100644 index ec9b231f..00000000 --- a/features/highlight-unanswered.js +++ /dev/null @@ -1,19 +0,0 @@ -if ( - window.location.href - .toLowerCase() - .startsWith("https://scratch.mit.edu/discuss/") && - window.location.href.toLowerCase() !== "https://scratch.mit.edu/discuss/" && - window.location.href.toLowerCase() !== "https://scratch.mit.edu/discuss" -) { - document.querySelectorAll("tbody > tr").forEach(function (el) { - if (el.querySelector("td.tc2").textContent === "0") { - el.style.backgroundColor = "#dce8f7"; - } - }); -} - -ScratchTools.setDisable("highlight-unanswered", function () { - document.querySelectorAll("tbody > tr").forEach(function (el) { - el.style.backgroundColor = null; - }); -}); From c5ddfdf7d5d47aeb6081d71f3cfa042fb7884cfd Mon Sep 17 00:00:00 2001 From: rgantzos Date: Wed, 31 May 2023 10:34:37 -0700 Subject: [PATCH 3/3] Update features.json --- features/features.json | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/features/features.json b/features/features.json index b45cd505..f0874327 100644 --- a/features/features.json +++ b/features/features.json @@ -203,9 +203,9 @@ { "id": "Studio ID", "name": "Studio ID", "default": "27205657" } ] }, - { - "version": 2, - "id": "highlight-unanswered" + { + "id": "highlight-unanswered", + "version": 2 }, { "title": "Hide Project Tags", @@ -758,8 +758,13 @@ "type": ["Website"] }, { - "version": 2, - "id": "go-to-parent" + "title": "Go to Parent Button", + "description": "In the editor for any project that is a remix, you can click a button to go to the editor in the parent project.", + "credits": ["rgantzos"], + "urls": ["https://scratch.mit.edu/users/rgantzos/"], + "file": "go-to-parent", + "tags": [], + "type": ["Editor"] }, { "title": "Most Popular Project",