Discuss Scratch

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:
alert []::extension//opens a basic dialog.
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.
And comes too with other help to manage code:
newline::reporter extension//creates a new line. (it works everywhere, not just in dialogs)
evaluate []::extension//useful for ignoring the "ask for" and the "confirm" dialog when you don't need to receive inputs.
JS code:
(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);
})({});
(I used ScratchX wiki's template)
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)


IMPORTANT! READ:
Don't write things someone already said. It's useless.
If you want to point a duplicate, please don't write just “Duplicate” when you don't have the link. At least say that you can't do it because -reasons-. Writing it and then going away does not help.
Don't write “I agree”, “this” or just quote without adding something constructive. It doesn't help.
No supporting because “you can do this elsewhere” is not a valid reason. If it was, the suggestion forum wouldn't exist because you can do everything elsewhere.
A simple workaround is not, never was and will never be a reason to no-support a suggestion. There are plenty of blocks with simple workarounds in Scratch right now, and there's a reason if the ST still added them.
No supporting because “it can turn into a competition” is not a reason, since it can happen everywhere (such as follows). Post count: 1900+
mrbumppo
Scratcher
100+ 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.

mrbumppo
“You can give up yourself, but doing so will make nature give up on you.”



Ender OS Scratch Wiki Profile
Botcho_Otkho
Scratcher
1000+ posts

Chromedials - extension

mrbumppo wrote:

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'd like that idea

IMPORTANT! READ:
Don't write things someone already said. It's useless.
If you want to point a duplicate, please don't write just “Duplicate” when you don't have the link. At least say that you can't do it because -reasons-. Writing it and then going away does not help.
Don't write “I agree”, “this” or just quote without adding something constructive. It doesn't help.
No supporting because “you can do this elsewhere” is not a valid reason. If it was, the suggestion forum wouldn't exist because you can do everything elsewhere.
A simple workaround is not, never was and will never be a reason to no-support a suggestion. There are plenty of blocks with simple workarounds in Scratch right now, and there's a reason if the ST still added them.
No supporting because “it can turn into a competition” is not a reason, since it can happen everywhere (such as follows). Post count: 1900+
mrbumppo
Scratcher
100+ posts

Chromedials - extension

Botcho_Otkho wrote:

mrbumppo wrote:

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'd like that idea
So should I?

mrbumppo
“You can give up yourself, but doing so will make nature give up on you.”



Ender OS Scratch Wiki Profile
Botcho_Otkho
Scratcher
1000+ posts

Chromedials - extension

mrbumppo wrote:

Botcho_Otkho wrote:

mrbumppo wrote:

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'd like that idea
So should I?
Yes!

IMPORTANT! READ:
Don't write things someone already said. It's useless.
If you want to point a duplicate, please don't write just “Duplicate” when you don't have the link. At least say that you can't do it because -reasons-. Writing it and then going away does not help.
Don't write “I agree”, “this” or just quote without adding something constructive. It doesn't help.
No supporting because “you can do this elsewhere” is not a valid reason. If it was, the suggestion forum wouldn't exist because you can do everything elsewhere.
A simple workaround is not, never was and will never be a reason to no-support a suggestion. There are plenty of blocks with simple workarounds in Scratch right now, and there's a reason if the ST still added them.
No supporting because “it can turn into a competition” is not a reason, since it can happen everywhere (such as follows). Post count: 1900+
mrbumppo
Scratcher
100+ posts

Chromedials - extension

YourJavascript is done! http://yourjavascript.com/15712442823/chromedials.js

mrbumppo
“You can give up yourself, but doing so will make nature give up on you.”



Ender OS Scratch Wiki Profile
Botcho_Otkho
Scratcher
1000+ posts

Chromedials - extension

mrbumppo wrote:

YourJavascript is done! http://yourjavascript.com/15712442823/chromedials.js
Thanks!

IMPORTANT! READ:
Don't write things someone already said. It's useless.
If you want to point a duplicate, please don't write just “Duplicate” when you don't have the link. At least say that you can't do it because -reasons-. Writing it and then going away does not help.
Don't write “I agree”, “this” or just quote without adding something constructive. It doesn't help.
No supporting because “you can do this elsewhere” is not a valid reason. If it was, the suggestion forum wouldn't exist because you can do everything elsewhere.
A simple workaround is not, never was and will never be a reason to no-support a suggestion. There are plenty of blocks with simple workarounds in Scratch right now, and there's a reason if the ST still added them.
No supporting because “it can turn into a competition” is not a reason, since it can happen everywhere (such as follows). Post count: 1900+

Powered by DjangoBB

Standard | Mobile