Skip to content

Commit 22d036a

Browse files
authored
Merge pull request #669 from rgantzos/main
2 parents dce1fe6 + ce8ba37 commit 22d036a

4 files changed

Lines changed: 50 additions & 10 deletions

File tree

features/features.json

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
[
2+
{
3+
"version": 2,
4+
"id": "start-stop-hotkeys",
5+
"versionUpdated": "v3.2.0"
6+
},
27
{
38
"version": 2,
49
"id": "opacity-slider",
@@ -258,15 +263,6 @@
258263
"type": ["Website"],
259264
"tags": ["New"]
260265
},
261-
{
262-
"title": "Shortcuts for Starting and Stopping Projects",
263-
"description": "To start and stop a project you can use Control+G or Command+G (for Mac users).",
264-
"credits": ["rgantzos"],
265-
"urls": ["https://scratch.mit.edu/users/rgantzos/"],
266-
"file": "start-stop-hotkeys",
267-
"type": ["Website", "Editor"],
268-
"tags": ["New"]
269-
},
270266
{
271267
"title": "Direct Image Uploads",
272268
"description": "Allows you to upload images to the Scratch forums for posts and signatures without having to use third party image uploading services.",

features/opacity-slider/script.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ export default function ({ feature, console }) {
44
if (!feature.traps.paint().selectedItems[0]) return;
55
if (feature.traps.paint().format.startsWith("BITMAP")) return;
66
body = body.firstChild;
7-
window.feature = feature;
87
if (body.querySelector(".ste-opacity-slider")) return;
98

109
let div = document.createElement("div");
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"title": "Green Flag Hotkeys",
3+
"description": "Use Control + G to start or stop a project, depending on whether or not it is running.",
4+
"credits": [
5+
{ "username": "rgantzos", "url": "https://scratch.mit.edu/users/rgantzos/" }
6+
],
7+
"type": ["Website"],
8+
"tags": ["New"],
9+
"dynamic": true,
10+
"scripts": [{ "file": "script.js", "runOn": "/projects/*" }],
11+
"components": [
12+
{
13+
"type": "info",
14+
"content": "For Mac users, use Command + G to start and stop the project.",
15+
"if": {
16+
"type": "all",
17+
"conditions": [
18+
{
19+
"type": "os",
20+
"value": "Macintosh"
21+
}
22+
]
23+
}
24+
}
25+
]
26+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export default function ({ feature, console }) {
2+
document.addEventListener("keydown", function (e) {
3+
if (!feature.traps.vm) return;
4+
if (!feature.self.enabled) return;
5+
if (e.which === 71 && (e.metaKey || e.ctrlKey)) {
6+
e.preventDefault();
7+
if (feature.traps.gui().vmStatus.started) {
8+
if (feature.traps.gui().vmStatus.running) {
9+
feature.traps.vm.stopAll();
10+
} else {
11+
feature.traps.vm.greenFlag();
12+
}
13+
} else {
14+
feature.traps.vm.start();
15+
feature.traps.vm.greenFlag();
16+
}
17+
}
18+
});
19+
}

0 commit comments

Comments
 (0)