Luogu看主页

删除洛谷用户主页维护消息,并在用户页面上显示隐藏的介绍

目前為 2024-05-10 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Luogu看主页
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  删除洛谷用户主页维护消息,并在用户页面上显示隐藏的介绍
// @author       dreaum
// @license      GPL-3.0-or-later
// @match        https://www.luogu.com.cn/user/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Define a function to remove maintenance message
    function removeMaintenanceMessage() {
        var maintenanceMessage = document.querySelector('div[data-v-429fbdfe][data-v-f9624136][style="background-color: rgb(255, 235, 236); border-radius: 5px; border: 1px solid rgb(225, 50, 56); padding: 1em; font-style: italic;"]');
        if (maintenanceMessage) {
            maintenanceMessage.remove();
        }
    }

    // Define a function to show hidden introduction
    function showHiddenIntroduction() {
        var hiddenIntroduction = document.querySelector('div[data-v-e5ad98f0][data-v-429fbdfe][class="introduction marked"][style="display: none;"][data-v-f9624136=""]');
        if (hiddenIntroduction) {
            hiddenIntroduction.style.removeProperty('display');
        }
    }

    // Remove maintenance message when DOM changes
    var observer = new MutationObserver(function(mutationsList, observer) {
        for(var mutation of mutationsList) {
            if (mutation.type === 'childList') {
                removeMaintenanceMessage();
                showHiddenIntroduction();
            }
        }
    });

    // Start observing changes in the DOM
    observer.observe(document.body, { childList: true, subtree: true });

    // Remove maintenance message and show hidden introduction immediately
    removeMaintenanceMessage();
    showHiddenIntroduction();
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址