Last active
March 28, 2026 03:15
-
-
Save hjdarnel/a4d5f24dc7917dc85a407a24386c99b1 to your computer and use it in GitHub Desktop.
Add hotkeys to Letterboxd's film detail page, like W for toggle watchlist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Letterboxd Film Hotkeys | |
| // @namespace hjdarnel | |
| // @version 1.0.1 | |
| // @description Press W to toggle watchlist status | |
| // @author Henry Darnell https://github.com/hjdarnel | |
| // @include /^https:\/\/letterboxd\.com\/film\/[^\/]+\/$/ | |
| // @downloadURL https://raw.githubusercontent.com/hjdarnel/letterboxd-tweaks/main/letterboxd-film-hotkeys.user.js | |
| // @updateURL https://raw.githubusercontent.com/hjdarnel/letterboxd-tweaks/main/letterboxd-film-hotkeys.user.js | |
| // @icon https://letterboxd.com/favicon.ico | |
| // @grant none | |
| // ==/UserScript== | |
| 'use strict'; | |
| const sleep = (ms) => new Promise((res) => setTimeout(res, ms)); | |
| document.addEventListener('keyup', async (event) => { | |
| // Check URL again, due to SPA-like navigation when reviewing a film | |
| if (!/^https:\/\/letterboxd\.com\/film\/[^\/]+\/$/.test(location.href)) return; | |
| switch (event.code) { | |
| case 'KeyW': { | |
| const removeEl = document.querySelector('a.remove-from-watchlist'); | |
| const addEl = document.querySelector('a.add-to-watchlist'); | |
| if (removeEl && !removeEl.parentElement.classList.contains('hidden')) { | |
| removeEl.click(); | |
| } else if (addEl && !addEl.parentElement.classList.contains('hidden')) { | |
| addEl.click(); | |
| } | |
| break; | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment