Sorry, I'm new to Snap! modding. How exactly is the mod implemented into the editor?
Very cool, thanks !
Q: Where did you save the data?
Nice! This is very useful. Thanks!
EDIT: Also, don't you mean alpha?
I don't quite get what you mean, are you asking how I made the mod or how the mod works with the editor?
Former: I used the JavaScript function \( [] @delInput@verticalEllipsis@addInput \) \{ [] \} block and wrote and copy and pasted all of the code to the block. I used no external editors so it started getting really laggy when I wanted to make a quick edit. I am definitely going to try to relocate this somewhere as a source file AHEMNeocities.
Latter: I don't know, it just works.
The block data is saved in local storage with the key --teth-plib--
. It's formatted just like libraries/LIBRARIES.json except it has a few things missing to keep the size somewhat small.
Is it? I genuinely thought alpha meant it hadn't had a full release yet, or not released at all.
Nice! Can I make it into a userscript?
This. Wait...so there are no downloads? The JavaScript function just adds the menus in? Jeez. I didn't realize how malleable Morphic.js was!
It's up to the developer. Sometimes, alpha builds are released. Sometimes, they're not.
Will the blocks be saved between projects? (I would test it out, but my wi-fi keeps glitching but is fine for the forum for some reason)
It really is! one of the craziest JS projects i've seen is this.
Funny part is, this no longer requires JavaScript in the menus to fill it, and now only requires JavaScript in when slot [ V] signals [menu V]
I mean yeah, but you're using JS anyway. Still good that when slot [ V] signals [ V]
exists though :)
I don't know for sure how tethrarxitet adds a menu item, but what my userscript for variable monitor speeds does to add an item to the settings icon menu is get the function that creates the menu, splits it by the function that adds "Microphone Resolution", replaces it with that function and a modified version of it to add a "Variable Watcher Frequency" item, joins the split array together, and replaces the function that creates the menu with the modified version of it. The rest is just calling a function that creates the dialogs, which is way easier
They do a much better way (that I didn't think of before for some reason).
First it sets the original menu method to a new method.
IDE_Morph.prototype._projectMenu ||= IDE_Morph.prototype.projectMenu;
IDE_Morph.prototype.projectMenu = function() {
this._projectMenu();
let menu = world.activeMenu;
...
}
Since the original method doesn't return the menu, you have to get it from the world from world.activeMenu
.
Then in order to insert a menu item into the menu, just modify the menu.items
list.
menu.items.splice(
menu.items.findIndex(
item =>
item[0] == "Libraries..."
),
0,
[
'Personal libraries...',
pl,
null,
null,
null,
null,
null,
'\u25ba'
]);
This is just inserting the menu item after Libraries...
. The list is just the same values as menu.addItem()
(that method actually just adds an list with all it's arguments to the menu.items
list).
The only issue with this way, is that you can't really have multiple userscripts that modify the same menu, unless you have some script that keeps a list of override functions and calls them all in order.
Yes of course.
I probably would, but I decided against it and made it a different option.
Yes! Local storage saves everything in the browser, not just the session. Which means you can refresh as many times as you want and your little libraries will stay intact.
This is exactly what I did. Split the edit menu by the Libraries item, add a submenu, and replace the function with a modified version. Honestly way simpler than copying the whole function by itself. Saves tons of characters too.
I'll think about more menu-editing mod support.
Not really. What @mr_owlssssnap2 (and I) did was, getting the function as a string, and then split that by a line in the function string, and them insert code (as a string) into the function, then turn that back into a javascript function. What you did was so much better, and likely won't break if the function is changed to not include the exact string that the script is looking for.
Honestly I'm also thinking if creating a boilerplate snap menu api that would be able to work with multiple userscripts. I don't know if or when I'll make it, but I think I have an idea on how I could make it.
Another way to do patching is to store the original function in a normal variable (instead of in the prototype):
const oldProjectMenu = IDE_Morph.prototype.projectMenu;
IDE_Morph.prototype.projectMenu = function() {
oldProjectMenu.call(this);
let menu = world.activeMenu;
...
}
This should work with multiple userscripts, as long as they all do it the same way (though the order they run in matters).
I'm working on updating the mod, but my version was out of date. So, I added a version checker.
Instead of working on older version support, I have to obtain a newer version with




I'm also editing my egregiously organized code so that it doesn't look too much like a 4-score-and-7-year-old rug in a retail store.
Wha...?
- He
+
- Llama
- Letters of "Llama"
- Two letters of "Llama"
Now do the math
Oh...
like
+