UserScript:Scaffolding-02
Level 2 辞書に載っていそうなこと
scriptjsconst l2links = text => {
const regexp = /^[a-zA-Z0-9!-/:-@\[-`{-~\s]*$/gm
if (regexp.test(text)) {
return `wikipedia [https://en.wikipedia.org/w/index.php?search=${encodeURIComponent(text)} ${text}]\n`
+ `weblio [https://ejje.weblio.jp/content/${encodeURIComponent(text)} ${text}]\n`
+ `kotobank [https://kotobank.jp/gs/?q=${encodeURIComponent(text)} ${text}]\n`
+ `jisho [https://jisho.org/search/${encodeURIComponent(text)} ${text}]`
} else {
return `wikipedia [https://ja.wikipedia.org/w/index.php?search=${encodeURIComponent(text)} ${text}]\n`
+ `weblio [https://www.weblio.jp/content/${encodeURIComponent(text)} ${text}]\n`
+ `kotobank [https://kotobank.jp/gs/?q=${encodeURIComponent(text)} ${text}]\n`
+ `jisho [https://jisho.org/search/${encodeURIComponent(text)} ${text}]`
}
}
scrapbox.PopupMenu.addButton({
title: 'L2',
onClick: l2links
})