quickQuotes + easyDiary
「今見ているPage」をScrapboxにさっと転記できる
アホほど便利
他人のScrapbox Projectであっても引用取ってこれる
「自分のログPageに持ってきたい」場合にやるActionが1種類だけなのは最強
本当だったら「Scrapbox」「普通のWeb Page」でbookmarkletを変える必要がある
利用Image
clickすると
Quotesした内容、そのままDiaryに貼りたいケースが多々ある
今、記載しているPage/みているPageをコメント付きですぐにDiaryに持って行きたい
そもそもBookmarkletをshortcut keyで起動できると可能性が広がる
PCでもスマホでも
twitterでは動かない
「外部Scriptの読み込み」が禁止されている
以下Javascriptを「ブックマークのURL欄」に記載することで、機能する
bookmarklet.jsjavascript:(function(d,s){s=d.createElement('script');s.src='https://scrapbox.io/api/code/inteltank/quickQuotes_+_easyDiary/script.js';d.body.appendChild(s);})(document)
script.jsfunction easyDiary(body_lines){
const today = new Date();
const title = [today.getFullYear(),
("00" + (today.getMonth()+1)).slice(-2),today.getDate()].join('%2F');
if(Array.isArray[body_lines]){
body = body_lines.join('\n');
}else{
body = body_lines;
}
window.open("https://scrapbox.io/sawachin/" + title + '?body=' + encodeURIComponent(body));
}
function quickQuotes(){
var title = document.title;
var replacedStrings = {
':': ':',
'\\[': '[',
'\\]': ']',
'\\|': '|'
};
for (var key in replacedStrings) {
title = title.replace(new RegExp(key, 'g'), replacedStrings[key]);
}
var lines=['['+window.location.href+' '+title+']\n'];
var quote=window.getSelection().toString();
if (quote.trim())
lines=lines.concat(quote.replace(/^\n/g,"").split(/\n/g).map(function(line){return ' > '+line}));
return lines;
}
function quickQuotesAtScrapbox(){
var project_title = '[/' + scrapbox.Project.name + '/' + scrapbox.Page.title
if(document.getElementsByClassName("cursor-line")[0]){
var quote=window.getSelection().toString();
if(window.getSelection().toString()==""){
var url = project_title + "#" +
document.getElementsByClassName("cursor-line")[0].id.slice(1) + ']';
}else{
var lines = quote.split(/\n/g).map(function(line){return ' > '+line})
var url = project_title +
"#"+ document.getElementsByClassName("cursor-line")[0].id.slice(1) +
"]" +
"\r" +lines.join('\n');
}
}else{
var url = project_title + ']';
}
return url;
}
if(document.location.href.match(/scrapbox.io/)){
var body = quickQuotesAtScrapbox();
}else{
var body = quickQuotes();
}
easyDiary(body);