UserScript:井戸端
井戸端投稿支援スクリプト(ではないか)
code:script.js
scrapbox.PopupMenu.addButton({
title: '🕳️井戸端',
onClick: text => {
const lines = text
.map(line => line.replace(/[\\\r\n]/g, '').replace(/^\s+/, '')) const now = new Date().toLocaleString()
if (scrapbox.Project.name==="suto3") {
const url = https://scrapbox.io/villagepump/suto3の大福帳?body=${now} ${encodeURIComponent(lines.join('\n'))} [/${scrapbox.Project.name}/${scrapbox.Page.title}]
//const url = https://scrapbox.io/suto3scratchpad/sandbox?body= ${now} :${encodeURIComponent(lines)} [/${scrapbox.Project.name}/${scrapbox.Page.title}]
//console.log(url)
window.open(url)
} else {
const url = https://scrapbox.io/suto3/一時保存?body= ${now} :${encodeURIComponent(lines)} [/${scrapbox.Project.name}/${scrapbox.Page.title}]
//console.log(url)
window.open(url)
}
}
})
改行が入ってしまうのが残念
元ネタ
UserScript.icon
https://img.shields.io/badge/JavaScript-UserScript_井戸端-F7DF1E.svg?logo=javascript&style=for-the-badge