Old Curseforge Please!

Converts curseforge.com links to legacy.curseforge.com links

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

Advertisement:

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Advertisement:

// ==UserScript==
// @name         Old Curseforge Please!
// @version      1.0
// @description  Converts curseforge.com links to legacy.curseforge.com links
// @namespace    hrudyplayz.com
// @license      MIT
// @author       HRudyPlayZ
// @match        *://www.curseforge.com/*
// @icon         https://www.google.com/s2/favicons?domain=www.curseforge.com
// @grant        none
// @run-at       document-start
// ==/UserScript==

// Adapted from Ksir's Old Reddit Please! https://greasyfork.org/fr/scripts/40897-old-reddit-please

function test(url) {
    return url.match(/^(|http(s?):\/\/)(|www\.)curseforge\.com(\/.*|$)/gim);
}

function getNewPagePlease(url) {
    return 'https://legacy.curseforge.com' + url.split('curseforge.com').pop();
}

function fixCurseforgeStuff() {
    var links = Array.prototype.slice.call(document.links, 0);

    links.filter(function(link) {
        if(test(link.href)) {
            var newLink = getNewPagePlease(link.href);
            link.setAttribute('href', newLink);
        }
    });
}

if (test(window.location.href)) window.location.assign(getNewPagePlease(window.location.href));

window.onload = fixCurseforgeStuff;
setInterval(fixCurseforgeStuff, 50);