The Battle Cats Fandom --> Miraheze

Redirects The Battle Cats Fandom wiki to the new Miraheze wiki.

目前为 2024-11-09 提交的版本。查看 最新版本

// ==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
// ==/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;
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址