首页 > 其他分享 >E

E

时间:2024-10-09 15:59:39浏览次数:4  
标签: pathArray else substring problemName var newPathname

不会写啊。大佬们别拷打我。

// ==UserScript==
// @name         Redirect from luogu to vjudge
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Redirect to vjudge when your IP is being banned by luogu
// @author       int_R
// @match        https://www.luogu.com.cn/problem/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var pathArray = window.location.pathname.split('/');
    var problemName = pathArray[pathArray.length-1];
    var FLAG = true;
    var CheckCard = document.getElementsByClassName("card problem-card padding-defaul");
    if (CheckCard.length == 0) {
        if (pathArray[pathArray.length-2] == "problem") {
            var newPathname = "https://vjudge.net/problem/";
            if (problemName[0] == 'P' || problemName[0] == 'B') {
                newPathname += "洛谷-" + problemName;
            } else if (problemName.substring(0,2) == "CF") {
                newPathname += "CodeForces-" + problemName.substring(2);
            } else if (problemName.substring(0,2) == "AT") {
                newPathname += "AtCoder-" + problemName.substring(3);
            } else if (problemName.substring(0,3) == "UVA") {
                newPathname += "UVA-" + problemName.substring(3);
            } else {
                FLAG = false;
            }
            if(FLAG) window.location.href = newPathname;
        }
    }
})();

标签:,pathArray,else,substring,problemName,var,newPathname
From: https://www.cnblogs.com/int-R/p/18454477

相关文章