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