These are my personal bookmarklets, written in TypeScript and built by Deno. I use them to customize websites and programatically interact with them.
These bookmarks are currently highly particular to my own needs. In fact, at the moment, all of them exist to help me manage my blog. It's unlikely anyone will have any direct uses for them. Still, I always share code, even in cases like these, because others may find some patterns or helper functions useful.
Some code others may find useful include the following. Read the JSDoc comments in the source files for more information about how to use them.
- The
StepRunnerclass (permalink is from 2026-01-17) can be used to manage and run bookmarklet steps, where a step is some unique code that should be run each time the bookmarklet is clicked. JavaScript execution does not persist across page loads, so when a bookmarklet navigates across pages, you will probably need to split your logic into steps: step 1 for code that will run on the first page, step 2 for code that will run on the second page, etc.StepRunnerwill keep track of steps for you and run the appropriate step each time the bookmarklet is clicked. - The
getElementfunction (permalink is from 2026-01-17) returns aPromisewhich resolves to the first element that matches the given selector or which rejects after a specified timeout. - Similarly, the
getNonNullElementPropertyfunction (permalink is from 2026-01-17) resolves to the property of an element (e.g.,textContent) after waiting for the element to appear or rejects if the element cannot be found or the property is null. What makes this function interesting, in my opinion, is the typing. I'm no TypeScript expert, so maybe others with more experience wouldn't find it very interesting, but it really took a lot of effort for me to get the types right.
Some people prefer to use userscripts for things like this, with an add-on like Violentmonkey managing those userscripts. I decided to generate bookmarklets instead because they work in all browsers, they're synced to mobile browsers through normal browser sync functionality, and they don't require any add-ons. Userscript managers are great when using scripts written by others, when updating scripts written by others, and when one wants to write a quick script that doesn't need a build step. None of those properties really benefit this project, though, because no one else is likely to install these scripts and because I'm using TypeScript, which requires a build step anyway.
- Install Deno.
- Clone this repo and navigate to it's root directory.
- Run
deno task build.
To use a bookmarklet, copy the compiled code of the relevant bookmarklet from dist/, then create a bookmark in your browser with that code as the URL.