二 · 如何开启强力学术模式
原版链接 : https://www.luogu.com.cn/article/qz17qcj8 。
因为文中所说的 Gooreplacer 下载不了(主要是作者懒得想办法了),所以本人写了一个篡改猴插件。
// ==UserScript==
// @name 4245 - 洛谷强力学术
// @namespace http://tampermonkey.net/
// @version 1.0
// @author Yt_4245
// @icon https://cdn.luogu.com.cn/upload/usericon/1334245.png
// @description tuifei breaker
// @match *://*/*
// @grant none
// @license MIT
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
const ALLOW_RULES = [
/^https:\/\/(www\.)?luogu\.com\.cn\/?$/i,
/^https:\/\/(www\.)?luogu\.com\.cn\/problem(\/list)?/i,
/^https?:\/\/.*\.?deepseek\.com\/.*/i,
/^https?:\/\/.*\.?doubao\.com\/.*/i,
/^https:\/\/fanyi\.baidu\.com\/.*/i,
/^https:\/\/www\.baidu\.com\/s\?.*wd=.*/i,
/^https:\/\/(ai|chat|knowledge)\.baidu\.com\/.*/i
];
function shouldAllow() {
const currentURL = window.location.href.toLowerCase();
return ALLOW_RULES.some(regex => regex.test(currentURL));
}
if (!shouldAllow()) {
console.warn('[学术模式] 拦截非学习网站:', window.location.href);
window.location.replace('https://www.luogu.com.cn/problem/list');
}
})();
更改插件中 ALLOW_RULES 的白名单即可更改白名单。请一定要用正则表达式。
更改第 34 行 https://www.luogu.com.cn/problem/list 为想要跳转的网址。
GreasyFork 网址,但是现在貌似进不去了。
upd on 2025.8.15 :压缩了一下码量,添加更新地址,改了一点错字。