Skip to content

Commit

Permalink
Merge pull request #624 from rgantzos/main
Browse files Browse the repository at this point in the history
  • Loading branch information
rgantzos authored Aug 7, 2023
2 parents b04bb44 + 1bce2ec commit f433bbf
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion features/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"version": 2,
"id": "steal-game",
"versionUpdated": "v3.1.0"
"versionAdded": "v3.1.0"
},
{
"version": 2,
Expand Down
30 changes: 18 additions & 12 deletions features/steal-game/script.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
if (window.location.href.startsWith("https://scratch.mit.edu/projects/")) {
var remixButton = document.querySelector('.remix-button')
var remixText = remixButton.querySelector('span');
remixText.textContent = "Steal game"
}
export default async function ({ feature, console }) {
ScratchTools.waitForElements(".remix-button span", function(remixText) {
if (feature.self.enabled) {
remixText.textContent = "Steal Game";
}
});

feature.addEventListener("enabled", async function () {
var remixText = await document.querySelector(".remix-button span");
if (!remixText) return;
remixText.textContent = "Steal Game";
});

ScratchTools.setDisable("steal-game", function () {
if (window.location.href.startsWith("https://scratch.mit.edu/projects) {
var remixButton = document.querySelector('.remix-button')
var remixText = remixButton.querySelector('span');
remixText.textContent = "Remix"
}
})
feature.addEventListener("disabled", async function () {
var remixText = await document.querySelector(".remix-button span");
if (!remixText) return;
remixText.textContent = "Remix";
});
}

0 comments on commit f433bbf

Please sign in to comment.