generated at
import
UserScript
script.js
scrapbox.PopupMenu.addButton({ title: (text) => { const words = text.split(/\s+/).filter(Boolean).length; const chars = text.length; return `${words}w ${chars}c`; }, onClick: () => null });

script.js
(() => { const counters = document.createElement('div'); counters.setAttribute('class', 'counters'); const counts = counters.appendChild(document.createElement('span')); counts.setAttribute('class', 'item'); const statusBar = document.getElementsByClassName('status-bar')[0]; if (scrapbox.Layout == 'page') { statusBar.appendChild(counters); } scrapbox.on('layout:changed', () => { if (scrapbox.Layout == 'page') { statusBar.prepend(counters); } else { statusBar.removeChild(counters); } }); const updateCounts = () => { if (!window.scrapbox.Page.lines) return; const words = scrapbox.Page.lines.map(line => line.text.split(/\s+/).filter(Boolean).length).reduce((a, b) => a + b); const chars = scrapbox.Page.lines.map(line => line.text.length).reduce((a, b) => a + b); const lines = scrapbox.Page.lines.length; counts.innerText = `${words} words, ${chars + lines - 1} chars, ${lines} lines`; } updateCounts(); scrapbox.on('lines:changed', updateCounts); })();

script.js
document.addEventListener('keydown', e => { if (e.ctrlKey && e.key === 'l') { document.execCommand('insertText', null, '[/icons/hr.icon]') } });