百家号去空行脚本(自用)

Remove the rows which have no content in Baijiahao editor.

目前为 2021-05-30 提交的版本。查看 最新版本

// ==UserScript==
// @name         百家号去空行脚本(自用)
// @namespace    http://tampermonkey.net/
// @version      0.11
// @description  Remove the rows which have no content in Baijiahao editor.
// @author       dogcraft
// @match        https://baijiahao.baidu.com/builder/rc/*
// @icon         https://dogcraft.top/favicon.ico
// @grant        none
// ==/UserScript==

(function() {
    //'use strict';

    function rmkh() {
        let ifdog = document.getElementsByTagName("iframe")[0];
        let dogoc = ifdog.contentDocument;
        let doglist = dogoc.body;
        for (const sko of doglist.children) {
            console.log(sko.children.length);
            if (sko.children.length > 0 ) {
                if (sko.children[0].tagName=="BR") {
                    doglist.removeChild(sko);
                }
            }

        }

    }
    const Opdog = document.getElementsByClassName("op-list")[0];
    const Btdog = document.createElement("button");
    Btdog.className="ant-btn bjh-btn-normal op-preview";
    Btdog.innerText="去除空行";
    Btdog.addEventListener("click", function(){ alert("空行已移除!"); });
    Btdog.addEventListener("click", rmkh);
    Opdog.appendChild(Btdog);
    const Fmdog = document.createElement("iframe");
    Fmdog.src="https://wxdog.neko.red/fm.html";
    // Fmdog.frameBorder = 0;
    Fmdog.style.border=0;
    Fmdog.height=500;
    const Pudog = document.getElementById("write-secretary-box");
    const Fjdog = Pudog.getElementsByClassName("tab-2")[0];
    Fjdog.prepend(Fmdog);
})();

QingJ © 2025

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