generated at
文字カウンター

選択範囲の単語数と文字数を表示するUserScript

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

変更点
単語のカウント方法を最適化した
文字数に改行を含むようにした
単語数→文字数の順番で表示されるようにした