Skip to content

Created the mondals extension. I want to add it to the turbowarp extension library. #2095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions extensions/Scratch_craft_2/modals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
// Name: Modals
// ID: htmlalert
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should contain a form of your name, and make sure the id's match

// Description: This extension adds modal dialog boxes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be better

// By: scratch_craft_2 <https://scratch.mit.edu/users/scratch_craft_2/>
// License: MPL-2.0

(function (Scratch) {
"use strict";

if (!Scratch.extensions.unsandboxed) {
throw new Error("This Extension must run unsandboxed");
}

class modals {
getInfo() {
return {
id: "htmlalert",
name: "modals",

Check failure on line 18 in extensions/Scratch_craft_2/modals.js

View workflow job for this annotation

GitHub Actions / lint

Extension name should usually be translated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this name doesnt match

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also Scratch.translate

color1: "#a3c0e1",
blocks: [
{
opcode: "alertb",
blockType: Scratch.BlockType.COMMAND,
text: "alert [textia]",

Check failure on line 24 in extensions/Scratch_craft_2/modals.js

View workflow job for this annotation

GitHub Actions / lint

Block text should usually be translated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to use Scratch.translate

arguments: {
textia: {
defaultValue: "hello!",
type: Scratch.ArgumentType.STRING,
},
},
},
{
opcode: "Promptb",
blockType: Scratch.BlockType.REPORTER,
text: "prompt [textip], default value: [classic]",

Check failure on line 35 in extensions/Scratch_craft_2/modals.js

View workflow job for this annotation

GitHub Actions / lint

Block text should usually be translated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scratch.translate

arguments: {
textip: {
defaultValue: "what's your name?",
type: Scratch.ArgumentType.STRING,
},
classic: {
defaultValue: " ",
type: Scratch.ArgumentType.STRING,
},
},
},
{
opcode: "Confirmb",
blockType: Scratch.BlockType.BOOLEAN,
text: "confirm [textic]",

Check failure on line 50 in extensions/Scratch_craft_2/modals.js

View workflow job for this annotation

GitHub Actions / lint

Block text should usually be translated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Scratch.translate

arguments: {
textic: {
defaultValue: "Did you see that movie?",
type: Scratch.ArgumentType.STRING,
},
},
},
],
};
}
alertb(args) {
alert([args.textia]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a bad way to access the arguments and you don't cast any of them

}
Promptb(args) {
return prompt([args.textip], [args.classic]);
}
Confirmb(args) {
return confirm([args.textic]);
}
}
Scratch.extensions.register(new modals());
})(Scratch);
1 change: 1 addition & 0 deletions extensions/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"sound",
"Lily/Video",
"iframe",
"Scratch_craft_2/modals",
"Clay/htmlEncode",
"Xeltalliv/clippingblending",
"clipboard",
Expand Down
5 changes: 5 additions & 0 deletions images/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ All images in this folder are licensed under the [GNU General Public License ver
- Created by [@David-Orangemoon](https://scratch.mit.edu/users/pinksheep2917/) in https://github.com/TurboWarp/extensions/pull/103.
- Font is Noto Sans.

## Scratch_craft_2/modals.png
- Created by [scratch_craft_2](https://scratch.mit.edu/users/scratch_craft_2/) in https://github.com/TurboWarp/extensions/pull/2095.
- Font is Noto Sans.
- Background based on https://turbowarp.org/static/assets/cf07199bb768b01e6ac2a5c68fd8c3bb.svg
- Communication icon from https://www.svgrepo.com/svg/533234/message-circle-chat
## pointerlock.svg
- Created by [@True-Fantom](https://scratch.mit.edu/users/TrueFantom/) in https://github.com/TurboWarp/extensions/pull/498.
- Chain from https://svgsilh.com/ru/image/1300304.html.
Expand Down
Binary file added images/Scratch_craft_2/modals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading