UserScript:Popup-Link-Wikipedia
code:script.js
scrapbox.PopupMenu.addButton({
title: 'Wl',
onClick: text => {
const regexp = /^[a-zA-Z0-9!-/:-@\-`{-~\s*$/gm if (regexp.test(text)) {
if (regexp_en.test(text)){
return text.replace(regexp_en, "$2")
} else {
return [https://en.wikipedia.org/wiki/${encodeURIComponent(text)} ${text}]
}
} else {
if (regexp_ja.test(text)){
return text.replace(regexp_ja, "$2")
} else {
return [https://ja.wikipedia.org/wiki/${encodeURIComponent(text)} ${text}]
/*return [https://ja.wikipedia.org/wiki/${text} ${text}]*/
}
}
}
})
https://img.shields.io/badge/JavaScript-UserScript_Popup--Link--Wikipedia-F7DF1E.svg?logo=javascript&style=for-the-badge