隐藏 Ynoi 题目背景

· · 科技·工程

如果题目名称包含子串 Ynoi(不区分大小写)则把题目背景更改为“Ynoi 题目背景已隐藏”。

Tampermonkey 脚本:

// ==UserScript==
// @name         隐藏 Ynoi 题目背景
// @namespace    http://tampermonkey.net/
// @version      2026-04-06
// @description  try to take over the world!
// @author       You
// @match        *://*.luogu.com.cn/problem/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    (new MutationObserver(() => { if(!window.location.href.includes("solution")) { let x=document.getElementsByClassName('lfe-caption problem-block-actions')[0].nextElementSibling; if(document.title.toLowerCase().includes('ynoi') && x.textContent == "题目背景" && x.nextSibling.children[0].innerHTML != '<p>Ynoi 题目背景已隐藏。</p>') { x.nextSibling.children[0].innerHTML = "<p>Ynoi 题目背景已隐藏。</p>"; }; }; }).observe(document.body, {childList:true, subtree:true, attributes:true}));
})();