// ==UserScript== // @name The Battle Cats Fandom --> Miraheze // @namespace https://github.com/dinosw // @version 0.1 // @description Redirects The Battle Cats Fandom wiki to the new Miraheze wiki. // @author dinosw // @match https://battle-cats.fandom.com/* // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; // Get the current URL var currentUrl = decodeURIComponent(window.location.href); // Regular expression to match The Battle Cats Fandom URL pattern var BattleCatRegex = /https:\/\/battle-cats\.fandom\.com\/@.*\/wiki\/([a-z0-9]+)/; // Extract the subpage from The Batte Cats Fandom URL using regex var match = currentUrl.match(BattleCatRegex); if (match && match[1]) { // Construct the new URL using the matched part of the original URL var redirectUrl = "https://battlecats.miraheze.org/wiki/" + match[1]; // Redirect the page to the new URL window.location.href = redirectUrl; } })();