Remove the rows which have no content in Baijiahao editor.
// ==UserScript==
// @name 百家号去空行脚本(自用)
// @namespace http://tampermonkey.net/
// @version 0.13
// @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.getElementById("ueditor_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);
}
}
}
}
function adddog(){
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);
}
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);
window.onload = function () {
setTimeout(()=>{
adddog()
}, 10000)
}
})();