Discuss Scratch

Blank1234
Scratcher
500+ posts

Javascript dialog extension

This is a short extension I created for js dialogs.
It adds these new blocks:
Alert [] :: extension
(Prompt [] :: extension)
<Confirm [] :: extension>
To use this extension, type this code into inspect element on the project you want to use the extension on:
(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)

bjskistad
Scratcher
1000+ posts

Javascript dialog extension

This could really be an extension!
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
squidoodly64
Scratcher
48 posts

Javascript dialog extension

where do you find “inspect element”?
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

squidoodly64 wrote:

where do you find “inspect element”?
right click
Blank1234
Scratcher
500+ posts

Javascript dialog extension

bump

Powered by DjangoBB