Created
December 21, 2025 13:58
-
-
Save lucaswerkmeister/321cd83215bbcdb9c9b5caca34b88602 to your computer and use it in GitHub Desktop.
User script to normalize LilyPond URL versions
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 Normalize LilyPond URL version | |
| // @namespace http://tampermonkey.net/ | |
| // @version 2025-12-21 | |
| // @description Change the version number in LilyPond documentation URLs to a fixed version. | |
| // @author Lucas Werkmeister | |
| // @match https://lilypond.org/doc/v* | |
| // @icon https://www.google.com/s2/favicons?sz=64&domain=lilypond.org | |
| // @grant GM_xmlhttpRequest | |
| // @connect lilypond.org | |
| // ==/UserScript== | |
| (async function() { | |
| 'use strict'; | |
| const url = new URL(document.location); | |
| let [_, doc, version, ...rest] = url.pathname.split('/'); | |
| if (version === 'v2.24') { | |
| return; | |
| } | |
| version = 'v2.24'; | |
| url.pathname = [_, doc, version, ...rest].join('/'); | |
| const response = await new Promise((resolve, reject) => GM_xmlhttpRequest({ | |
| method: 'HEAD', | |
| url, | |
| onload: resolve, | |
| onerror: reject, | |
| onabort: reject, | |
| ontimeout: reject, | |
| })); | |
| if (response.status === 200) { | |
| document.location = url; | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment