Bookmarklets

Copyright 2023 Yawar Amin

This file is part of bookmarklets.

bookmarklets is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

bookmarklets is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with bookmarklets. If not, see https://www.gnu.org/licenses/.

ℹ️ The bookmarklets' source code in this page are in a minified form. To get the original code, go to the GitHub repo.

To install each bookmarklet, simply drag and drop its link to your browser's Bookmarks bar.

Anchors toggle

Show or hide all anchors (elements with id or name attributes) on the page.

anchors toggle

BitBucket comments minimize

In BitBucket PRs, some workflows (or long-winded reviews) can pile up a lot of comments. Unfortunately, you have to scroll past all the comments to get to the diff. It's much easier to do that if all the comments are automatically collapsed and can be expanded with a click. This collapses (minimizes) the PR comments.

bitbucket comments min

BitBucket merge

In BitBucket PRs, when you have the 'squash merge' feature enabled (which you really should), the default commit message is formatted really badly:

Merged in your-branch (pull request #nnn)

Real first line

Other lines

So when you do git log --oneline, the one-line summary logs are full of inscrutable 'Merged in...' messages which don't describe the actual commits themselves. This is a long-standing issue known to BitBucket: https://jira.atlassian.com/browse/BCLOUD-19402.

This bookmarklet fixes the message to look like this:

Real first line (PR #nnn)

Other lines

Then it copies the fixed text to the clipboard and asks you to paste it into the commit message textbox. Unfortunately this extra step seems unavoidable because of the way the BitBucket textbox is designed. But it works fairly well. To use it, you click on the bookmarklet instead of clicking on the PR's 'Merge' button. Then you do a paste operation, and click the dialog box's 'Merge' button.

bitbucket merge

Email+

Fills in your email address with a 'plus-address' extension using the website's domain name, so that you can sign up with a unique email address for each service you use. This is handy because if one email is leaked from a service, it protects your other emails from phishing attempts. Remember to position the cursor inside an empty field before you click on this bookmarklet!

This one is a bit special–you'll need to modify the bookmarklet URL with your specific email address parts.

Eg, if your email address is bob@foo.com, then you would change USERNAME to bob and HOST to foo.com.

Also remember to save this email address somewhere. Since it's a plus-address, you'll need to keep track of it because your base address won't work with the service. Store it in your password manager (either your browser's built-in one or a third-party one) or note it down somewhere.

Note: this only works with input fields which are not 'controlled' by JavaScript ie those whose value property is not reset on every render.

email+

Show external links on the page visually. Suffixes the text of the hyperlink with its hostname.

ext links

Home page

Go to this site's home page.

home page

Odoc index

If you are viewing an odoc-generated OCaml documentation module page like this, this bookmarklet will generate an alphabetically-sorted index of the contents of the module, and inject it into the left sidebar.

odoc idx

Paste enable

Some very annoying websites disable the paste functionality on some of their inputs by hijacking the paste event. This re-enables paste functionality.

paste enable

Password new

Fill the currently selected input with a cryptographically random password (technically, a UUID string, but it works well as a password).

The idea is that you generate a long random password and just let your browser's password manager save and remember it. Obviously, if you use some other specific password manager which generates passwords for you, you might prefer that one. But this is a simpler alternative otherwise.

Note: this only works with input fields which are not 'controlled' by JavaScript ie those whose value property is not reset on every render.

password 🆕

Scroll toggle

Scroll to the top or bottom of the page.

scroll toggle

Sticky kill

Kill sticky elements that hide parts of the page beneath them.

ℹ️ Go to https://github.com/t-mart/kill-sticky to install this bookmarklet.

URL decrement

Decrement the last number in the URL and navigate to the resulting page.

url decr

URL increment

Increment the last number in the URL and navigate to the resulting page.

url incr

Whois lookup

Do a WHOIS lookup of the current domain.

whois