Young People in Yaohuo

青少年模式

目前为 2022-11-13 提交的版本。查看 最新版本

// ==UserScript==
// @name         Young People in Yaohuo
// @description  青少年模式
// @version      0.1
// @author       Polygon
// @match        https://yaohuo.me/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        GM_addStyle
// @run-at       document-end
// @namespace https://gf.qytechs.cn/users/788115
// ==/UserScript==

(function() {
    'use strict';
    // 添加一个style,PC端字体有点看不清
    GM_addStyle(`
        body, html {
            font-family: Arial, SimHei !important;
        }
    `)
    const keywords = [
        "小姐姐", "拼夕夕", "老", "PDD", "学习通"
    ]
    let validate = (text) => {
        return keywords.filter((keyword) => {
            return text.includes(keyword)
        }).length
    }
    let currentURL = window.location.href
    // 判断当前网址是否为主页
    if (currentURL == 'https://yaohuo.me/') {
        console.log("主页")
        // 主页移除关键词
        let items = []
        document.querySelectorAll('.list a').forEach((e) => {
            // 每个节点有两个关键信息:1.href;2.innerText
            let href = e.href
            let text = e.innerText
            if (validate(text)) {
                console.log(`remove ${text}`)
            } else {
                items.push(`${items.length+1}.<a href="${href}">${text}</a>`)
            }
        })
        document.querySelector('.list').innerHTML = items.join("<br>")
    } else if (currentURL.startsWith('https://yaohuo.me/bbs/book_list.aspx?')) {
        // 可能是新帖,也可能是搜索页
        console.log("新帖或搜索页")
        let filterList = (mutations, observer) => {
            let items = []
            document.querySelectorAll("#KL_show_next_list div").forEach((e) => {
                // 每个节点有很多元素
                let text = e.querySelector('a').innerText
                if (validate(text)) {
                    console.log(`remove ${text}`)
                } else {
                    items.push(`<div class="list data line${(items.length % 2 == 0)+1}">${e.innerHTML}</div>`)
                } 
            })
            document.querySelector('#KL_show_next_list').innerHTML = items.join("")
        }
        var observer = new MutationObserver(filterList)
        var node = document.querySelector('#KL_show_tip')
        observer.observe(node, {childList: true})
    }
})();

QingJ © 2025

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