C++// ==UserScript==
// @name 名字竞技场强力学术
// @namespace http://tampermonkey.net/
// @version 1.0
// @auther cqbzzlr
// @description 强制聚焦除了学习相关网站
// @match *://*/*
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
// 允许的白名单规则
const ALLOW_RULES = [
/^https:\/\/(https\.)?deepmess\.com\/?$/i, // 首页
];
// 智能路径检测
function shouldAllow() {
const currentURL = window.location.href.toLowerCase();
// 白名单匹配检测
if (ALLOW_RULES.some(regex => regex.test(currentURL))) {
return true;
}
// 特殊放行逻辑
if (currentURL.startsWith('https://deepmess.com/namerena/#')) {
return true; // 放行具体题目页
}
return false;
}
// 执行重定向逻辑
if (!shouldAllow()) {
// 保留原网站信息用于调试
console.warn('[学术模式] 拦截学习网站:', window.location.href);
// 清除当前页面内容
document.documentElement.innerHTML = '';
window.location.replace('https://deepmess.com/namerena/#');
}
})();