Custom menu types

I, personally, think that it would be cool if you could create your own types of global menus for custom blocks (like the message dropdown).

You can if your willing to enable JavaScript (and learn how to write them)

Unfortunately, it was one of the facilities that took the hit when JavaScript had to be disabled a few years ago due to security issues

Huh. Interesting.

can you explain how?

This is a sample script that opens an alert window with the contents being the first block input whenever you click on the dropdown.

untitled script pic (1)
You can edit the dropdown code in newDD > options...
Screenshot 2024-05-09 09.50.31

download (4)
download (3)
images (3)

To make it somewhat simpler? I recreated it with a boolean. If the boolean is true, the dropdown will tell you that the first input is true. If the boolean is false, it will tell you that the first input is false, and will open a different menu.

untitled script pic (2)

Here is an old project that I did in the past

It lets you generate a menu from a list

https://snap.berkeley.edu/snap/snap.html#present:Username=cymplecy&ProjectName=userMenuFromList&editMode

Click on the vars in the custom block definition and then right-click on default value and then select options

https://snap.berkeley.edu/snap/snap.html#present:Username=cymplecy&ProjectName=userMenuFromList&editMode

You'll then see the JavaScript used to generate the menu
image

The basic principle is that your code needs to return exactly the same text as you would use if you were manually entering it

Nice example :slight_smile:

??

If you're confused, it just gets the first input of the block and alerts it. Nothing else.

Look at the image in the 1st quote and tell me that's normal for Snap!

Yes. There's even an official(?) block in Snap! for it.
untitled script pic (3)

Or are you implying you're confused because the alert is in a different style than Snap!?

You can do it with a vanilla Snap! block:
pic

EDIT: Ninja'd

It's literally the same box that shows up when you are editing something and you close the tab and it says something like "Are you sure? ...".

Bruh. Good thing that hasn't happened to me. Yet.

This?
Screenshot 2024-05-09 10.12.03

Screenshot 2024-05-09 10.09.32

It is similar, but it's not the same. You can't change the title of the dialog or the text of the buttons.

Uhhh, yes, that box.

Literally compare those 2 with your OG post.

Ok... for those, that's true.

The "The changes you made may not be saved" is activated by trying to close / reload the page.

The alert/confirm/prompt menu is called at will by JS.

Well, DUH, of course! As if I never knew that!

Sarcasm aside, that's what @tethrarxitet was talking about, which of course, is the only difference between them.

To get back to the point of this post, This seems pretty useful.