Discuss Scratch
- Discussion Forums
- » Developing Scratch Extensions
- » Javascript dialog extension
- Blank1234
-
Scratcher
500+ posts
Javascript dialog extension
This is a short extension I created for js dialogs.
It adds these new blocks:
It adds these new blocks:
Alert [] :: extensionTo use this extension, type this code into inspect element on the project you want to use the extension on:
(Prompt [] :: extension)
<Confirm [] :: extension>
(function(ext) {
ext._shutdown = function() {};
ext._getStatus = function() {
return {status: 2, msg: 'Ready'};
};
ext.doAlert = function(x) {
alert(x);
};
ext.doPrompt = function(x) {
return prompt(x);
}
ext.doConfirm = function(x) {
return confirm(x);
}
var descriptor = {
blocks: [
['', 'Alert %s', 'doAlert', 'Hello world'],
['r', 'Prompt %s', 'doPrompt', 'What is your name?'],
['b', 'Confirm %s', 'doConfirm', ''],
]
};
ScratchExtensions.register('Javascript dialogs', descriptor, ext);
})({});Last edited by Blank1234 (Nov. 19, 2015 00:32:45)
- savaka
-
Scratcher
1000+ posts
Javascript dialog extension
I made one like that but yours is a little different
Mine has the confirm and prompt as stack blocks and has answer reporters like Scratch's “ask” block
Mine has the confirm and prompt as stack blocks and has answer reporters like Scratch's “ask” block
- squidoodly64
-
Scratcher
48 posts
Javascript dialog extension
oh you don't open the project first you just do it in the my stuff screen :-(
- Blank1234
-
Scratcher
500+ posts
Javascript dialog extension
where do you find “inspect element”?right click
- Discussion Forums
- » Developing Scratch Extensions
-
» Javascript dialog extension