Discuss Scratch
- Discussion Forums
- » Developing Scratch Extensions
- » Chromedials - extension
- Botcho_Otkho
- Scratcher
1000+ posts
Chromedials - extension
Warning: there aren't any links on github, just a code that you can copy in the JS console in one of your Scratch projects to add this. I have to get used on Github.
Tested on: Chrome
Hello! I worked on this extension called “Chromedials”. It opens dialogs to have a faster and fancier way to alert people, asking things or confirm things.
Here are the principal blocks:
(I used ScratchX wiki's template)
Hope you like it!
PS.: let me know if you tested it on other browsers and it worked.
Tested on: Chrome
Hello! I worked on this extension called “Chromedials”. It opens dialogs to have a faster and fancier way to alert people, asking things or confirm things.
Here are the principal blocks:
alert []::extension//opens a basic dialog.And comes too with other help to manage code:
ask for [] with original answer []::extension reporter//opens a dialog with a textbox to receive an input.
confirm []::extension boolean//if "ok" is clicked reports true, otherwise it reports false.
newline::reporter extension//creates a new line. (it works everywhere, not just in dialogs)JS code:
evaluate []::extension//useful for ignoring the "ask for" and the "confirm" dialog when you don't need to receive inputs.
(function(ext) {
// Cleanup function when the extension is unloaded
ext._shutdown = function() {};
// Status reporting code
// Use this to report missing hardware, plugin or unsupported browser
ext._getStatus = function() {
return {status: 2, msg: 'Ready'};
};
ext.my_first_block = function() {
// Code that gets executed when the block is run
};
// Block and block menu descriptions
var descriptor = {
blocks: [
// Block type, block name, function name
[' ', 'alert %s', 'alertDial', 'Done.'],
['r', 'ask for %s with original answer %s', 'promptDial', 'What is your name?', 'John Doe'],
['b', 'confirm %s', 'askDial', 'Are you sure?'],
['r', 'newline', 'newlineX', ''],
[' ', 'evaluate %s', 'evaluateX']
]
};
ext.alertDial = function(dialText) {
alert(dialText)
};
ext.promptDial = function(dialText, origAnswer) {
return prompt(dialText, origAnswer)
};
ext.askDial = function(dialText) {
return confirm(dialText)
};
ext.newlineX = function() {
return "\n"
};
ext.evaluateX = function(evaluate) {
eval(evaluate)
};
// Register the extension
ScratchExtensions.register('Chromedials', descriptor, ext);
})({});
Hope you like it!
PS.: let me know if you tested it on other browsers and it worked.
Last edited by Botcho_Otkho (April 4, 2018 17:20:58)
I see now that the circumstances of one's birth are irrelevant. It is what you do with the gift of life that determines who you are. - Mewtwo
- mrbumppo
- Scratcher
500+ posts
Chromedials - extension
Nice! Could I host code on YourJavascript or repl.it?
I also think we might be able to collaborate on making Chromedials 2.0 or something.
I also think we might be able to collaborate on making Chromedials 2.0 or something.
The Internet is a weird place, so don't question it.
- Botcho_Otkho
- Scratcher
1000+ posts
Chromedials - extension
I'd like that idea Nice! Could I host code on YourJavascript or repl.it?
I also think we might be able to collaborate on making Chromedials 2.0 or something.
I see now that the circumstances of one's birth are irrelevant. It is what you do with the gift of life that determines who you are. - Mewtwo
- mrbumppo
- Scratcher
500+ posts
Chromedials - extension
So should I?I'd like that idea Nice! Could I host code on YourJavascript or repl.it?
I also think we might be able to collaborate on making Chromedials 2.0 or something.
The Internet is a weird place, so don't question it.
- Botcho_Otkho
- Scratcher
1000+ posts
Chromedials - extension
Yes!So should I?I'd like that idea Nice! Could I host code on YourJavascript or repl.it?
I also think we might be able to collaborate on making Chromedials 2.0 or something.
I see now that the circumstances of one's birth are irrelevant. It is what you do with the gift of life that determines who you are. - Mewtwo
- mrbumppo
- Scratcher
500+ posts
Chromedials - extension
YourJavascript is done! http://yourjavascript.com/15712442823/chromedials.js
The Internet is a weird place, so don't question it.
- Botcho_Otkho
- Scratcher
1000+ posts
Chromedials - extension
http://yourjavascript.com/15712442823/chromedials.jsThanks! YourJavascript is done!
I see now that the circumstances of one's birth are irrelevant. It is what you do with the gift of life that determines who you are. - Mewtwo
- Discussion Forums
- » Developing Scratch Extensions
- » Chromedials - extension