generated at
shokai



ここからUserScript
script.js
scrapbox.PopupMenu.addButton({ title: function (text) { const chars = text.replace(/[\r\n]/g, '').length const words = text.trim().split(/[\r\n\s]+/).length return `${chars}c ${words}w` }, onClick: () => null })

行頭に引用符を付ける
script.js
scrapbox.PopupMenu.addButton({ title: 'quote', onClick: text => text.split(/\n/).map(line => ` > ${line}`).join('\n') })

Google翻訳
script.js
scrapbox.PopupMenu.addButton({ title: 'Google翻訳', onClick: text => window.open(`https://translate.google.com/#ja/en/${text}`) })


script.js
scrapbox.PopupMenu.addButton({ title: 'NewPage', onClick: text => { const lines = text.split(/[\r\n]/g) const title = lines[0] .trim() .replace(/\[[^\]]+.icon\]/gm, '') .replace(/[\[\]]/g, '') const projectRoot = (() => { const tmp = location.href.split('/') tmp.pop() return tmp.join('/') })() const currentPageTitle = decodeURIComponent(location.href.split(/\//g).pop()) lines.unshift(`from [${currentPageTitle}]`) const body = encodeURIComponent(lines.join('\n')) window.open(`${projectRoot}/${title}?body=${body}`) return `[${title}]` } })

UserScript