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.
Thanks! Re: listing bookmarklets, that's something I'd like to do but have yet to find a cheap/easy way to do it. One way would be to search gists for relevant metadata [1] but GitHub does not include searching gists in their API. Another way might be logging paths in an edge function. Open to suggestions/PRs.
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.
ohhh I thought it was primarily a repository for people to browse each other's bookmarklets, I am going to check it out if it would let me do my management in a more sane manner! I am still using the system in that blog post with regex and deletion+reimporting when I need to update several at a time (which is not that uncommon) and I still hate it haha
I love this project! I used to use a lot of bookmarklets, but lost a lot of them and couldn't find all I used to use. Is it possible for you to create a directory or listing for all the hosted bookmarklets, but that might need curation too.
The one they shared is backed by gist which is much better if you want to understand the code.
The gist also allow people to comment on the bookmarklet.
Of course - now they have a way of injecting arbitrary javascript code into the browser of the people using the service to bookmark the bookmarklet. Lack of trust sucks.
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 the content into instead of right-clicking a link and clicking "bookmark".
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.
> 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!
Ah, I see how that paragraph could be misunderstood. I actually meant it as an advantage of the service. Sharing a link to bookmarkl.ink is trivial in any system since it's just a regular link. Where as if you want to share a bookmarklet (as a use-friendly-link) directly in chat system like Slack (or in a github comment) you can't since these most likely refuse to display javascript: links
Unfortunately, no. This is a simple pet project aimed at easing sharing/versioning of bookmarklets. The site is entirely static. Listing bookmarklets is, however, something I'd love to add.
A simple and sensible way to list bookmarklets may be scraping GitHub's own search [1]. Using a flag in gists such as `// bookmarklink-index` or similar may be a good way to go.
I created a tool [1] to easily convert GitHub gists into bookmarklets and share them. Includes versioning, multi-file gists, etc. Some of my favourite examples hide images until mouseover [2] and play a procedural Brian Eno tune [3].
Thanks, would be cool to have a quick copy button, as these "bookmark me" buttons never work on mobile. With a simple copy button I could create a new bookmark easily on mobile.
I believe I had this at one point but ditched it as browser support was spotty (looking at you, iOS Safari). Looks like support for async clipboard API [1] is getting there so I'll look at adding this functionality back.
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