-
-
Notifications
You must be signed in to change notification settings - Fork 279
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
base: master
Are you sure you want to change the base?
Changes from all commits
93d6b5b
14efeb7
69296f6
fd0c255
4f573e5
fe764e6
932581b
f9f8c3d
62769de
05d7e92
a837679
67d86b5
f428e91
9a2b700
45163e7
e0790aa
1cadd75
761b2f1
d721812
64387ae
d409ce7
1aa3d0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Name: Modals | ||
// ID: htmlalert | ||
// Description: This extension adds modal dialog boxes. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this name doesnt match There was a problem hiding this comment. Choose a reason for hiding this commentThe 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]", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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]", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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]", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); |
There was a problem hiding this comment.
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