跳到正文

个人记录

fuun.fun 强力插件

__biu_biu_biu__约 2 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月31日
篇幅
约 2 分钟

版本

  1. v1当前
代码
// ==UserScript==
// @name         fuun.fun强力学术
// @namespace    http://tampermonkey.net/
// @version      1.0
// @auther       Yt_4245
// @description  强制聚焦除了学习相关网站
// @match        *://*/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
'use strict';

// 允许的白名单规则
const ALLOW_RULES = [
    // 洛谷核心功能
    /^https:\/\/(https\.)?fuun\.fun\/?$/i,                          // 首页
];

// 智能路径检测
function shouldAllow() {
    const currentURL = window.location.href.toLowerCase();

    // 白名单匹配检测
    if (ALLOW_RULES.some(regex => regex.test(currentURL))) {
        return true;
    }

    // 特殊放行逻辑
    if (currentURL.startsWith('https://www.luogu.com.cn/problem/')) {
        return true;  // 放行具体题目页
    }

    return false;
}

// 执行重定向逻辑
if (!shouldAllow()) {
    // 保留原网站信息用于调试
    console.warn('[学术模式] 拦截非学习网站:', window.location.href);

    // 清除当前页面内容
    document.documentElement.innerHTML = '';

    // 跳转至洛谷题库
    window.location.replace('https://fuun.fun');
}
})();

将这个东西放进篡改猴就可以了

原文