梦乡去广(测试版)

Kill AD

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         梦乡去广(测试版)
// @license      MIT
// @version      0.1
// @description  Kill AD
// @author       Memory
// @match        *://*.yume.ly/*
// @grant        none
// @namespace https://greasyfork.org/users/1230414
// ==/UserScript==

(function() {
    'use strict';

    // 获取当前页面的 URL
    let urlParams = new URLSearchParams(window.location.search);
    let currentPage = parseInt(urlParams.get('page')) || 1;

    // 检测所有的 a.name 元素
    let nameLinks = document.querySelectorAll('a.name');
    nameLinks.forEach(link => {
        if (link.textContent.trim() === '李财运') {
            // 删除该元素的父父节点
            let grandParent = link.parentNode.parentNode;
            grandParent.parentNode.removeChild(grandParent);
        }
    });

    // 检测 id 为 columnHomeA 的元素的子元素个数
    let columnHomeA = document.getElementById('columnHomeA');
    if (columnHomeA && columnHomeA.children.length === 1) {
        // 跳转到下一页
        let nextPageUrl = window.location.href.split('?')[0] + '?page=' + (currentPage + 1);
        window.location.href = nextPageUrl;
    }
})();