跳到正文

个人记录

讨论区重定向脚本

Carey_chen约 1 分钟
原文
文章信息与版本

文章信息

发布
2025年2月12日
收录
2025年12月12日
更新
2026年11月15日
篇幅
约 1 分钟

版本

  1. v1当前
JavaScript
// ==UserScript==
// @name         洛谷讨论重定向
// @namespace    http://tampermonkey.net/
// @version      1.0
// @author       Carey_chen
// @match        https://www.luogu.com.cn/discuss/*
// @icon         https://www.luogu.com.cn/favicon.ico
// ==/UserScript==

(function() {
    'use strict';
    let now = window.location.href;
    for (let i = 0; i < now.length; i++)
    {
        if('0' <= now[i] && now[i] <= '9')
        {
            console.log(i);
            window.location.replace("https://lglg.top/" + now.substring(i));
            break;
        }
    }
})();
原文