HN user

ashtonmeuser

82 karma
Posts4
Comments18
View on HN

For anyone stumbling upon this that deals with bookmarklets, I submit bookmarkl.ink[0], a tool I made to ease the maintenance of bookmarklets.

In short, it pulls code from GitHub Gists (which have the benefit of being backed by git repos), transpiles, minifies, bundles, and wraps in an IIFE. It's also got a basic module resolver that allows you to include libraries or remote files.

This allows you to use creature comforts like TS and libraries and maintain code readability while still ending up with the smallest possible bookmarklet. It also allows you to link to a particular version (git hash), present user-defined variables, edit code in an inline editor, etc.

Enjoy!

[0] https://bookmarkl.ink

Your wish is my command.

- https://bookmarkl.ink/ashtonmeuser/a36be4b6c835276f1a22a8c49...

- https://bookmarkl.ink/ashtonmeuser/a36be4b6c835276f1a22a8c49...

- https://bookmarkl.ink/ashtonmeuser/a36be4b6c835276f1a22a8c49...

Interestingly, in the URL CLI article, you mentioned the difficulty of maintaining such bookmarklets. That was a huge motivator for bookmarkl.ink. You can keep your verbose, commented code in a gist while the actual bookmarklet is tree shaken, stripped of comments, minified, and encoded. As of late, you even get some creature comforts like TypeScript support. Finally, every gist is a repo behind the scenes so you get version control for free.

Final nitpick.

And (due to lack of trust) most applications make it hard to share javscripts links - so you need to instead instruct people to create a new bookmark and past [sic] the content into instead of right-clicking a link and clicking "bookmark".

This is mostly true for mobile browsers. For desktop, simply dragging the button to the bookmarks bar ought to do the trick. Please feel free to open an issue if you've found this not to be the case!

Hi! Agreed re: advantages of gist/git backing. Comments and gist history via GitHub add a lot of value for free. The tool also allows bookmarklet creators to write in modern, un-obfuscated JS as there are transpilation, minification, and IIFE wrapping applied to the bookmarklet.

The security risk angle is also a concern I share. If you take a look at the disclaimer at the bottom of my project README [1], you'll see this exact issue mentioned. Versioning gists and thus bookmarklets is discussed in the same document [2]. This locks bookmarklet source to a specific commit of the git repo underlying a gist.

[1] https://github.com/ashtonmeuser/bookmarklet-platform?tab=rea...

[2] https://github.com/ashtonmeuser/bookmarklet-platform?tab=rea...

I created a platform[1] to more conveniently write and share bookmarklets. I’ve only ever mentioned it when I see bookmarklets shared as raw code with nasty URL encoding obfuscating things. Costs me a buck or two per year so I’ve kept it around. Seems the only folks who use it are some Twitch streamers from SK. No idea how they may have heard of my little site.

[1] https://bookmarkl.ink