快捷展开微博

快捷展开微博,无需去找“展开”链接

目前為 2023-03-28 提交的版本,檢視 最新版本

// ==UserScript==
// @name         快捷展开微博
// @namespace    https://greasyfork.org/zh-CN/users/1073-hzhbest
// @version      0.5
// @description  快捷展开微博,无需去找“展开”链接
// @author       hzhbest
// @match        https://weibo.com/*
// @match        https://s.weibo.com/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    document.body.addEventListener('mouseover',texpand,false);

	function texpand(event){
        let tnode = event.target;
        console.log('tnode: ', tnode);
        if (!tnode.className) {
            return;
        }
		let btnexpand;
		if (tnode.nodeName == 'DIV' && tnode.className.indexOf('detail_wbtext_') == 0) {
			btnexpand = tnode.querySelector('span.expand');
		} else if (tnode.nodeName == 'P' && tnode.className == 'txt') {
			btnexpand = tnode.querySelector('a[action-type="fl_unfold"]');
		}
        if (!!btnexpand) {
            btnexpand.click();
        }
    }
})();