From b35118f01adedb22667cf831bf019302ee9d9d6c Mon Sep 17 00:00:00 2001 From: MaterArc <105017592+MaterArc@users.noreply.github.com> Date: Sat, 28 Dec 2024 11:27:19 -0500 Subject: [PATCH 1/2] Remove Confirmation Remove the new sprite confirmation feature from Scratch --- features/remove-confirmation/data.json | 13 +++++++++++++ features/remove-confirmation/script.js | 12 ++++++++++++ features/remove-confirmation/style.css | 4 ++++ 3 files changed, 29 insertions(+) create mode 100644 features/remove-confirmation/data.json create mode 100644 features/remove-confirmation/script.js create mode 100644 features/remove-confirmation/style.css diff --git a/features/remove-confirmation/data.json b/features/remove-confirmation/data.json new file mode 100644 index 00000000..beaa2dab --- /dev/null +++ b/features/remove-confirmation/data.json @@ -0,0 +1,13 @@ +{ + "title": "Remove Delete Confirmation", + "description": "Removes the delete confirmation prompt when deleting sprites in the Scratch editor.", + "credits": [ + { "username": "MaterArc", "url": "https://scratch.mit.edu/users/MaterArc/" } + ], + "type": ["Editor"], + "tags": ["New", "Featured"], + "dynamic": true, + "styles": [{ "file": "style.css", "runOn": "/editor/*" }], + "scripts": [{ "file": "script.js", "runOn": "/editor/*" }] + } + \ No newline at end of file diff --git a/features/remove-confirmation/script.js b/features/remove-confirmation/script.js new file mode 100644 index 00000000..5aa71290 --- /dev/null +++ b/features/remove-confirmation/script.js @@ -0,0 +1,12 @@ +export default async function ({ feature, console }) { + ScratchTools.waitForElements("body", () => { + document.body.addEventListener("click", () => { + ScratchTools.waitForElements( + "[class^='delete-confirmation-prompt_ok-button_']", + (confirmButton) => { + if (feature.self.enabled) confirmButton.click(); + } + ); + }); + }); +} diff --git a/features/remove-confirmation/style.css b/features/remove-confirmation/style.css new file mode 100644 index 00000000..6175c942 --- /dev/null +++ b/features/remove-confirmation/style.css @@ -0,0 +1,4 @@ +[class*="delete-confirmation-prompt_modal-container"] { + visibility: hidden; + } + \ No newline at end of file From 9cdbc264e318bef570c2ce95d2f946e25b231970 Mon Sep 17 00:00:00 2001 From: MaterArc <105017592+MaterArc@users.noreply.github.com> Date: Sat, 28 Dec 2024 11:29:03 -0500 Subject: [PATCH 2/2] Update feature.json --- features/features.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/features/features.json b/features/features.json index caa770ce..779defe0 100644 --- a/features/features.json +++ b/features/features.json @@ -1,4 +1,9 @@ [ + { + "version": 2, + "id": "remove-confirmation", + "versionAdded": "v4.0.0" + }, { "version": 2, "id": "outline-shape-options",