本文档在线地址：https://www.bidianer.com/blog/detail/15159378?bid=1276572


会员标志代码：<div data-v-733ff9c5="" class="avatar"><img data-v-733ff9c5="" src="https://pic.bidianer.com/avatar/202107/01/60ddd1200b28aPbYoxH66KoF2hPQO.jpg?imageView2/1/w/240/h/240/q/100/ignore-error/1" width="64" alt=""> <button data-v-f96d00ce="" data-v-733ff9c5="" class="vip-badge active"><i data-v-f96d00ce="" class="ri-star-fill"></i></button></div>


非会员标志代码：<div data-v-733ff9c5="" class="avatar"><img data-v-733ff9c5="" src="https://pic.bidianer.com/avatar/202210/03/633a978bea7b7oyLOhRmBciqwdSoD.jpg?imageView2/1/w/240/h/240/q/100/ignore-error/1" width="64" alt=""> <button data-v-f96d00ce="" data-v-733ff9c5="" class="vip-badge"><i data-v-f96d00ce="" class="ri-star-fill"></i></button></div>



右下角侧边栏代码:<div data-v-a3ebe2d4="" class="layout-slider-container"><div data-v-a3ebe2d4="" class="mb-10"><div data-v-a3ebe2d4="" class="layout-slider slider-doubao"><a data-v-a3ebe2d4="" href="https://www.doubao.com/chat/?channel=bidiandaohang&amp;source=doutui_cqt_db_bddh_n3kjsf" rel="noopener" target="_blank" class="el-tooltip card-opacity item" aria-describedby="el-tooltip-3414" tabindex="0"><img data-v-a3ebe2d4="" src="https://pic.bidianer.com/website/202508/22/68a88bcd19c91emg0eoaDtciON5j0.png!ico64" alt="" style="width: 32px;"></a></div><div data-v-a3ebe2d4="" class="layout-slider slider-doubao"><a data-v-a3ebe2d4="" href="https://jd.yhzswl.com?cn=jd2" rel="noopener" target="_blank" class="el-tooltip card-opacity item" aria-describedby="el-tooltip-6889" tabindex="0"><img data-v-a3ebe2d4="" src="https://pic.bidianer.com/website/201805/11/5af56bd11e6beGDXzjbIO8UYpQQbh.svg!ico64" alt="" style="width: 32px;"></a></div><div data-v-a3ebe2d4="" class="layout-slider slider-doubao"><a data-v-a3ebe2d4="" href="https://tb.yhzswl.com?cn=tb2" rel="noopener" target="_blank" class="el-tooltip card-opacity item" aria-describedby="el-tooltip-3750" tabindex="0"><img data-v-a3ebe2d4="" src="https://pic.bidianer.com/static/taobao.1772455822.svg" alt="" style="width: 32px;"></a></div></div> <div data-v-a3ebe2d4="" class="layout-slider mb-10"><button data-v-1ab99c36="" data-v-a3ebe2d4="" class="br-btn fixed-slider-button el-tooltip mb-10" aria-describedby="el-tooltip-3556" tabindex="0"><i data-v-a3ebe2d4="" data-v-1ab99c36="" class="ri-draft-line"></i></button> <button data-v-1ab99c36="" data-v-a3ebe2d4="" class="br-btn fixed-slider-button el-tooltip mb-10" aria-describedby="el-tooltip-304" tabindex="0"><i data-v-a3ebe2d4="" data-v-1ab99c36="" class="ri-cloud-line"></i></button> <button data-v-1ab99c36="" data-v-a3ebe2d4="" class="br-btn fixed-slider-button el-tooltip" aria-describedby="el-tooltip-7427" tabindex="0"><i data-v-a3ebe2d4="" data-v-1ab99c36="" class="ri-archive-drawer-line"></i></button></div> <div data-v-a3ebe2d4="" class="layout-slider"><button data-v-1ab99c36="" data-v-a3ebe2d4="" class="br-btn fixed-slider-button el-tooltip mb-10" aria-describedby="el-tooltip-7747" tabindex="0"><i data-v-a3ebe2d4="" data-v-1ab99c36="" class="ri-sort-desc"></i></button> <div data-v-a3ebe2d4="" class="el-dropdown"><button data-v-1ab99c36="" data-v-a3ebe2d4="" class="br-btn fixed-slider-button el-tooltip el-dropdown-selfdefine" aria-describedby="el-tooltip-7598" tabindex="0" aria-haspopup="list" aria-controls="dropdown-menu-1623" role="button"><i data-v-a3ebe2d4="" data-v-1ab99c36="" class="iconfont ri-sun-line"></i></button> <ul data-v-a3ebe2d4="" class="el-dropdown-menu el-popper" id="dropdown-menu-1623" style="display: none;"><li data-v-a3ebe2d4="" tabindex="-1" class="el-dropdown-menu__item theme-active"><i class="ri-sun-line"></i>日间模式
                        </li> <li data-v-a3ebe2d4="" tabindex="-1" class="el-dropdown-menu__item"><i class="ri-moon-line"></i>夜间模式
                        </li> <li data-v-a3ebe2d4="" tabindex="-1" class="el-dropdown-menu__item el-dropdown-menu__item--divided"><i class="ri-contrast-fill"></i>跟随系统
                        </li></ul></div> <!----></div></div>




油猴代码：
// ==UserScript==
// @name         笔点会员身份替换
// @namespace    https://AiiyiYei.com/tihuan
// @version      2026.5.8
// @description  会员替换+精准隐藏广告滑块，保留主题/排序功能按钮
// @match        *://*.bidianer.com/*
// @grant        none
// @run-at       document-load
// ==/UserScript==

(function() {
    // -------------------------- 配置区 --------------------------
    const classList = [
        { target: 'vip-badge', add: 'active' },
    ];
    const textList = [
        { target: '非会员', replacement: '至尊 VIP' }, // 第一个要重点处理的文本
        { target: '，购买高级会员获得更多权益！', replacement: '（终身版）' },
        { target: '2021年02月26日 注册', replacement: '2014年04月15日 注册' },
    ];
    // 可选：填写内容容器选择器（从F12复制，如".content"，加快定位）
    const contentSelector = '';
    // ------------------------------------------------------------

    // 新增：精准隐藏广告，保留主题切换、排序、layout-slider-container
    function addHideStyle() {
        const style = document.createElement('style');
        style.textContent = `
            /* 保留外层容器，完全不隐藏 */
            .layout-slider-container {
                display: block !important;
            }
            /* 只隐藏：里面包含广告图片、外链a标签的滑块 */
            .layout-slider:has(a > img) {
                display: none !important;
            }
            /* 保留：带排序、日间/夜间模式的功能滑块 */
            .layout-slider:has(.ri-sort-desc),
            .layout-slider:has(.ri-sun-line),
            .layout-slider:has(.ri-moon-line) {
                display: block !important;
            }
        `;
        document.head.appendChild(style);
    }
    addHideStyle();

    function escapeRegExp(str) {
        return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
    }

    function log(type, message) {
        console.log(`%c[稳定版脚本] [${type}] ${message}`, 'color: #4CAF50;');
    }

    // 处理class
    function processClasses(element) {
        if (!element || element.nodeType !== Node.ELEMENT_NODE) return;
        classList.forEach(item => {
            if (element.classList.contains(item.target) && !element.classList.contains(item.add)) {
                element.classList.add(item.add);
                log('class替换', `成功：${item.target}`);
            }
        });
        element.childNodes.forEach(child => processClasses(child));
    }

    // 处理文本（重点强化第一个文本的匹配）
    function processTexts(node) {
        // 跳过script/style
        if (node.nodeType === Node.ELEMENT_NODE) {
            const tag = node.tagName.toLowerCase();
            if (tag === 'script' || tag === 'style') return;
            // 处理输入框
            if (tag === 'input' || tag === 'textarea') {
                textList.forEach(item => {
                    if (node.value.includes(item.target)) {
                        node.value = node.value.replace(new RegExp(escapeRegExp(item.target), 'g'), item.replacement);
                        log('文本替换', `输入框：${item.target} → ${item.replacement}`);
                    }
                });
            }
        }

        // 处理普通文本节点（优先检查第一个文本）
        if (node.nodeType === Node.TEXT_NODE) {
            const firstText = textList[0];
            if (node.nodeValue.includes(firstText.target)) {
                node.nodeValue = node.nodeValue.replace(new RegExp(escapeRegExp(firstText.target), 'g'), firstText.replacement);
                log('文本替换', `第一个文本成功：${firstText.target} → ${firstText.replacement}`);
            }
            textList.slice(1).forEach(item => {
                if (node.nodeValue.includes(item.target)) {
                    node.nodeValue = node.nodeValue.replace(new RegExp(escapeRegExp(item.target), 'g'), item.replacement);
                    log('文本替换', `${item.target} → ${item.replacement}`);
                }
            });
        }

        node.childNodes.forEach(child => processTexts(child));
    }

    // 核心替换函数
    function fullReplace() {
        log('替换触发', '开始扫描替换...');
        let targetElement = document.body;
        if (contentSelector) {
            const container = document.querySelector(contentSelector);
            if (container) targetElement = container;
        }
        processClasses(targetElement);
        processTexts(targetElement);
    }

    // 动态监听
    const observer = new MutationObserver(mutations => {
        mutations.forEach(mutation => {
            mutation.addedNodes.forEach(addedNode => {
                if (addedNode.nodeType === Node.ELEMENT_NODE || addedNode.nodeType === Node.TEXT_NODE) {
                    processClasses(addedNode);
                    processTexts(addedNode);
                }
            });
        });
    });

    observer.observe(document, {
        childList: true,
        subtree: true,
        attributes: true,
        attributeFilter: ['class']
    });

    // 页面切换处理
    function handlePageChange() {
        log('页面切换', '检测到路由变化，启动多轮替换...');
        const delays = [300, 800, 1500, 2500, 4000];
        delays.forEach(ms => {
            setTimeout(() => {
                log('页面切换重试', `延迟${ms}ms执行替换`);
                fullReplace();
            }, ms);
        });
    }

    window.addEventListener('popstate', handlePageChange);
    window.addEventListener('hashchange', handlePageChange);
    const originalPushState = history.pushState;
    history.pushState = function(...args) {
        originalPushState.apply(this, args);
        handlePageChange();
    };

    // 初始替换+重试
    fullReplace();
    setTimeout(fullReplace, 1000);
    setTimeout(fullReplace, 3000);
    log('启动完成', '已精准隐藏广告，保留主题/排序功能按钮');
})();