LUOGU benben Better

· · 个人记录

显然是油猴脚本

// ==UserScript==
// @name         LUOGU benben Better
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  自动展开犇犇,屏蔽指定用户的犇犇
// @author       ln001
// @match        https://www.luogu.com.cn/
// @grant        none
// ==/UserScript==
const c = ['114', '514', '1919']; //在这里放想要屏蔽的用户的uid

(function() {
    'use strict';

    function fD(i) {
        const l = document.querySelector('#feed').querySelectorAll('a[href="/user/'+i+'"]:not(.center)');
        l.forEach(link => {
            let a = link;
            if(a.className != ""){
                for (let j = 0; j < 5; j++) {
                    if (a.parentElement) {
                        a = a.parentElement;
                    } else {
                        return;
                    }
                }
                a.remove();}
        });
    }

    function m() {
        for (let i = 0; i < c.length; i++) {
            setInterval(fD, 20, c[i]);
        }
    }

    m();

    function cC() {
        const e = document.evaluate(
            '/html/body/div[1]/div[2]/main/div/div[1]/div[3]/div[2]/div[5]/a',
            document,
            null,
            XPathResult.FIRST_ORDERED_NODE_TYPE,
            null
        ).singleNodeValue;

        if (e) {
            const r = e.getBoundingClientRect();
            const v = (
                r.top >= 0 &&
                r.left >= 0 &&
                r.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
                r.right <= (window.innerWidth || document.documentElement.clientWidth)
            );

            if (v) {
                e.click();
            }
        }
    }

    setInterval(cC, 200);
})();