refactorIncentive
code:script.js_廃止済み
const statusDom = document.createElement("div");
document.body.appendChild(statusDom);
statusDom.style.fontSize = "20px";
updateStatusDom();
updateCount();
scrapbox.on("layout:changed", updateStatusDom);
scrapbox.on("lines:changed", updateCount);
function updateStatusDom() {
if (scrapbox.Layout !== "page") {
statusDom.remove();
} else {
document.querySelector(".status-bar").appendChild(statusDom);
}
}
function updateCount() {
const chars = scrapbox.Page.metadata.charsCount;
if (chars < 4096) {
statusDom.remove();
} else {
document.querySelector(".status-bar").appendChild(statusDom);
if(chars < 8192) {
statusDom.style.color = "#f80";
statusDom.innerText = ${chars}文字;
}else{
statusDom.style.color = "#f00";
statusDom.innerText = ${chars}文字;
}
}
}