微博阅读全文

自动显示全文,并替换关注按钮为“已显示全文”

目前为 2022-08-31 提交的版本。查看 最新版本

// ==UserScript==
// @name         微博阅读全文
// @version      0.1
// @description  自动显示全文,并替换关注按钮为“已显示全文”
// @author       shenmailg
// @match        *://weibo.com/ttarticle/*
// @grant        none
// @namespace https://gf.qytechs.cn/users/952802
// ==/UserScript==

(function() {
    'use strict';

    var newsDom = document.querySelector('.WB_editor_iframe_new');
    var readMore = document.querySelector('.artical_add_box');
    // 监听dom样式变化的回调
    var mCallBack = function() {
        // 等待透明度渐入结束
        if (newsDom.style.opacity === '1') {
            // 移除控制半文展示样式
            newsDom.style = '';
            // 替换关注按钮
            if (!!readMore) {
                readMore.innerHTML='<p style="text-align: center; font-size: 16px; padding: 12px;">已显示全文</p>';
            }
        }
    }

    var observer = new MutationObserver(mCallBack);
    observer.observe(newsDom, {
        attributes: true,
        attributeOldValue: true,
        attributeFilter: ['style']
    });
})();

QingJ © 2025

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