bookmarklet: XのPOSTをScrapboxにコピー
XのポストをScrapboxにキレイに貼れるようにするBookmarkletです。
code:javascript
javascript:(function(){finder=(tag,attr,value)=>...document.getElementsByTagName(tag).find(e=>e.getAttribute(attr)==value);loc=finder("link","rel","canonical").getAttribute("href");user=loc.split("/")3;href=loc.split("x.com")2;date=finder("a","href",href).text;content=finder("div","data-testid","tweetText").textContent;window.prompt("X Scrap Text",">"+loc+" @"+user+" - "+date+" "+content.split("\n").join("\n\t>"));})();
元コード
code:javascript
javascript:(function(){
finder=(tag,attr,value)=>...document.getElementsByTagName(tag).find(e=>e.getAttribute(attr)==value);
loc=finder("link","rel","canonical").getAttribute("href");
user=loc.split("/")3;
href=loc.split("x.com")2;
date=finder("a","href",href).text;
content=finder("div","data-testid","tweetText").textContent;
window.prompt("X Scrap Text",">"+loc+" @"+user+" - "+date+" "+content.split("\n").join("\n\t>"));
})();
例
https://x.com/shimizukawa/status/1484811789359804416
https://scrapbox.io/files/61f06e88196dd70022e92e78.png
@shimizukawa - 午後5:54 · 2022年1月22日 今回、メモリドカ食いする時代の流れに反抗してみたくなって、メモリ8GBの機種にした。
これでメモリ節約できるかなあ..
* Chrome -> Edge 切り替えてみる
* Dropboxをインストールしない
* ローカルに開発環境をできるだけ置かない