script.js// alert('load userscript')
scrapbox.PopupMenu.addButton({
title: 'reverse',
onClick: text => text.split('').reverse().join('')
})
script.jsscrapbox.PopupMenu.addButton({
title: 'quote',
onClick: text => text.split(/\n/).map(line => ` > ${line}`).join('\n')
})
script.jsscrapbox.PopupMenu.addButton({
title: 'search',
onClick: text => window.open(`https://google.com?q=${encodeURIComponent(text)}`)
})
script.jsscrapbox.PopupMenu.addButton({
title: 'Google翻訳',
onClick: text => window.open(`https://translate.google.com/#ja/en/${text}`)
})
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
})