Skip to content

Instantly share code, notes, and snippets.

@lucaswerkmeister
Created December 21, 2025 13:58
Show Gist options
  • Select an option

  • Save lucaswerkmeister/321cd83215bbcdb9c9b5caca34b88602 to your computer and use it in GitHub Desktop.

Select an option

Save lucaswerkmeister/321cd83215bbcdb9c9b5caca34b88602 to your computer and use it in GitHub Desktop.
User script to normalize LilyPond URL versions
// ==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