bookmarklet: TwitterをScrapboxにコピー
code:javascript
javascript:(function(){finder=function(tag,attr,value){return Array.from(document.getElementsByTagName(tag)).find(e=>{return e.getAttribute(attr)==value})};loc=finder("link","rel","canonical").getAttribute("href");user=loc.split("/")3;href=loc.split("twitter.com")1;date=finder("a","href",href).text;content=finder("meta","property","og:description").getAttribute("content");window.prompt("Twitter Scrap Text",""+loc+" @"+user+" - "+date+" \n\t>"+content.split("\n").join("\n\t>"));})(); 元コード
code:javascript
(function(){
finder=function(tag, attr, value){
return Array.from(document.getElementsByTagName(tag)).find(e => {
return e.getAttribute(attr)==value
})
};
loc = finder("link","rel","canonical").getAttribute("href");
href = loc.split("twitter.com")1; date = finder("a","href",href).text;
content = finder("meta","property","og:description").getAttribute("content");
window.prompt(
"Twitter Scrap Text",
);
})();
例
https://scrapbox.io/files/61f06e88196dd70022e92e78.png
今回、メモリドカ食いする時代の流れに反抗してみたくなって、メモリ8GBの機種にした。
これでメモリ節約できるかなあ..
* Chrome -> Edge 切り替えてみる
* Dropboxをインストールしない
新バージョン
code:javascript
javascript:(function(){finder=function(tag, attr, value){return Array.from(document.getElementsByTagName(tag)).find(e => {return e.getAttribute(attr)==value})};loc=finder("link","rel","canonical").getAttribute("href");user=loc.split("/")3;href=loc.split("twitter.com")1;date=finder("a","href",href).text;content=finder("meta","property","og:description").getAttribute("content").slice(1,-1);window.prompt("Twitter Scrap Text",">"+loc+" @"+user+" - "+date+" "+content.split("\n").join("\n\t>"));})(); これでメモリ節約できるかなあ..
* Chrome -> Edge 切り替えてみる
* Dropboxをインストールしない
* ローカルに開発環境をできるだけ置かない