大瀧
https://lh6.googleusercontent.com/-NpbTZMjGiPI/AAAAAAAAAAI/AAAAAAAAFMQ/pjJsxqG1UC8/photo.jpg
this is ootaki-masahiro’s page
code:import.js
import '/api/code/scrasobox/WebからコピペしたらSB記法に変換する/script.js'
選択範囲をtweetするUserScript
code:script.js
scrapbox.PopupMenu.addButton({
title: 'Tweet',
onClick: text => {
const lines = text
.map(line => line.replace(/[\\]/g, '').replace(/^\s+/, '')) lines.push(location.href)
const url = https://twitter.com/intent/tweet?&text=${encodeURIComponent(lines.join('\n'))}
const width = 550
const height = 420
const option = width=${width},height=${height},left=${(window.innerWidth - width) / 2},top=${(window.innerHeight - height) / 2},scrollbars=yes,resizable=yes,toolbar=no,location=yes
window.open(url, '_blank', option)
}
})
日付書式
code:script.js
scrapbox.TimeStamp.addFormat("_[]YYYY/MM/DD[]")
scrapbox.TimeStamp.addFormat("]YYYY/MM/DD[ HH:mm")
scrapbox.TimeStamp.addFormat("]YYMMDD[-HHmm=")
UserScript
code: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
})
code:script.js
scrapbox.PopupMenu.addButton({
title: 'quote',
onClick: text => text.split(/\n/).map(line => > ${line}).join('\n')
})
code:script.js
scrapbox.PopupMenu.addButton({
title: 'NewPage',
onClick: text => {
const lines = text.split(/\r\n/g) .trim()
.replace(/\^\+.icon\]/gm, '')
const projectRoot = (() => {
const tmp = location.href.split('/')
tmp.pop()
return tmp.join('/')
})()
const currentPageTitle = decodeURIComponent(location.href.split(/\//g).pop())
lines.unshift(from [${currentPageTitle}])
const body = encodeURIComponent(lines.join('\n'))
window.open(${projectRoot}/${title}?body=${body})
return [${title}]
}
})
hr.icon