Skip to content

Instantly share code, notes, and snippets.

@slippycheeze
Created December 18, 2022 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slippycheeze/c6a0311ba8dad558d402be28f81c201f to your computer and use it in GitHub Desktop.
Save slippycheeze/c6a0311ba8dad558d402be28f81c201f to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Elite Dangerous: old forum URL redirector - frontier.co.uk
// @namespace rimspace.net
// @match *://forums.frontier.co.uk/showthread.php/*
// @grant none
// @run-at document-start
// @version 1.0
// @author Daniel Pittman <daniel@rimspace.net>
// @description when you land on an old forum URL, instead redirect to the "modern" equivalent.
// does not try and rewrite the URL before you hit the 404 page, though.
// ==/UserScript==
const rewriter = /showthread[.]php\/(\d+)-([^/]+)$/;
let match = null;
if ((match = rewriter.exec(document.location.href)) !== null) {
document.location.href = `https://forums.frontier.co.uk/threads/${match[2]}.${match[1]}/`;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment