generated at
UserScript:Page-Tweet
Twitter でつぶやくページメニュー版
元ネタ
本文を先頭から Twitter に送る。
scriptxx.js
scrapbox.PageMenu.addItem({ title: 'Tweet', image: 'https://twitter.com/favicon.ico' //onClick: () => window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(location.href)}&text=${encodeURIComponent(window.scrapbox.Page.title)}`) onClick: () => { //const body = window.scrapbox.Page.lines.map(line => line.text).join('\n'); const body = window.scrapbox.Page.lines .map(line => line.text) .join('\n') .replace(/\[|\]/g, ''); (body.length < 117) ? window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(location.href)}&text=${encodeURIComponent(body)}`) : window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(location.href)}&text=${encodeURIComponent(body.substr(0,116)+"…")}`) ; } })

script.js
scrapbox.PageMenu.addMenu({ title: 'X(twitter)', image: 'https://scrapbox.io/api/pages/suto3/ツイッター/icon#.png', }) scrapbox.PageMenu('Twitter').addItem({ title: 'Tweet', onClick: () => { //const body = window.scrapbox.Page.lines.map(line => line.text).join('\n'); const body = window.scrapbox.Page.lines .map(line => line.text) .join('\n') .replace(/\[|\]/g, ''); (body.length < 117) ? window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(location.href)}&text=${encodeURIComponent(body)}`) : window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(location.href)}&text=${encodeURIComponent(body.substr(0,116)+"…")}`) ; } }) scrapbox.PageMenu('Twitter').addItem({  title: 'Hash Tw',  onClick: () => { const body = window.scrapbox.Page.lines .map(line => line.text) .join('\n') .replace(/\[|\]/g, ''); (body.length < 108) ? window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(location.href)}&text=${encodeURIComponent(body+" #Cosense")} `) : window.open(`https://twitter.com/intent/tweet?url=${encodeURIComponent(location.href)}&text=${encodeURIComponent(body.substr(0,107)+"… #Cosense")}`); } })

UserScript:Popup-Tweet - ポップアップメニュー版

Twitter
UserScript