UserScript:井戸端
井戸端投稿支援スクリプト(ではないか)
/villagepump
/villagepump/井戸端
井戸端の自分のページ /villagepump/suto3の大福帳 に更新したページのページタイトルを送ることを想定していた
code:script.js
scrapbox.PopupMenu.addButton({
title: '🕳️井戸端',
onClick: text => {
const lines = text
.split(/\r\n/)
.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)
}
}
})
scrapbox.Project.name
scrapbox.Page.title
改行が入ってしまうのが残念
元ネタ
shokai - /shokai/選択範囲をtweetするUserScript
UserScript.icon
https://img.shields.io/badge/JavaScript-UserScript_井戸端-F7DF1E.svg?logo=javascript&style=for-the-badge