generated at
PCでスクマ
PCでスクマ

最終形は以下。
script.js
javascript:(function(){var project = "inteltank";var title = document.title;var metaDiscre = document.head.children;var metaLength = metaDiscre.length;var imageURL;for(var i = 0;i < metaLength;i++){var proper = metaDiscre[i].getAttribute('property');if(proper === 'og:image'){imageURL = metaDiscre[i].content.replace(/"|'/,'');}}var d = new Date();var today = [d.getFullYear(),(d.getMonth()+1),d.getDate()].join('/');var URL = window.location.href.replace(/"|'/,'');var quote=window.getSelection().toString();var body = ["["+imageURL+"]",title,URL,">"+quote,"["+today+"]にpick","","[リンク未整理]"];var body_final = encodeURIComponent(body.join('\n'));window.open('https://scrapbox.io/'+project+'/'+encodeURIComponent(title.trim())+'?body='+body_final)})();


hr
作成作業を…メモしておいた。今後役にたつかもなので。

まずはScrapbox謹製のスクマを調べる
javascript
javascript:(function()%7Bvar title%3Dwindow.prompt(%27Scrap "Scrapbox" to inteltank.%27,document.title)%3Bif (!title) return%3Bvar lines%3D%5B%27%27,%27%5B%27%2Bwindow.location.href%2B%27 %27%2Bdocument.title%2B%27%5D%27%5D%3Bvar quote%3Dwindow.getSelection().toString()%3Bif (quote.trim()) lines%3Dlines.concat(quote.split(/%5Cn/g).map(function(line)%7Breturn %27 > %27%2Bline%7D))%3Blines.push(%27%27)%3Bvar body%3DencodeURIComponent(lines.join(%27%5Cn%27))%3Bwindow.open(%27https://scrapbox.io/inteltank/%27%2BencodeURIComponent(title.trim())%2B%27%3Fbody%3D%27%2Bbody)%7D)()%3B
このままだと見にくいので、まずデコードする
javascript
javascript:(function(){var title=window.prompt('Scrap "Scrapbox" to inteltank.',document.title);if (!title) return;var lines=['','['+window.location.href+' '+document.title+']'];var quote=window.getSelection().toString();if (quote.trim()) lines=lines.concat(quote.split(/\n/g).map(function(line){return ' > '+line}));lines.push('');var body=encodeURIComponent(lines.join('\n'));window.open('https://scrapbox.io/inteltank/'+encodeURIComponent(title.trim())+'?body='+body)})();
デコードしたものを改行する
javascript
javascript:(function(){ var title=window.prompt('Scrap "Scrapbox" to inteltank.',document.title); if (!title) return; var lines=['','['+window.location.href+' '+document.title+']']; var quote=window.getSelection().toString(); if (quote.trim()) lines=lines.concat(quote.split(/\n/g).map(function(line){return ' > '+line})); lines.push(''); var body=encodeURIComponent(lines.join('\n')); window.open('https://scrapbox.io/inteltank/'+encodeURIComponent(title.trim())+'?body='+body) })();

うむむ…browser上で、javascriptがどう動くのか?一つずつ試したいtsawada
調べてみた。
便利らしい。使ってみる
あれ、javascript consoleが見つからない。verが新しくなって亡くなったのかしら
画像URLを見つけ出す.js
javascript:(function(){ //初期設定 var project = "inteltank"; //title設定 var title = document.title; //画像URLを見つけ出す var metaDiscre = document.head.children; var metaLength = metaDiscre.length; var imageURL; for(var i = 0;i < metaLength;i++){ var proper = metaDiscre[i].getAttribute('property'); if(proper === 'og:image'){ imageURL = metaDiscre[i].content.replace(/"|'/,''); } } //今日の日付を見つけ出す var d = new Date(); var today = [d.getFullYear(),(d.getMonth()+1),d.getDate()].join('/') //ページURLを取得する var URL = window.location.href.replace(/"|'/,''); //選択範囲を取得する var quote=window.getSelection().toString(); //最終的な本文 var body = [ imageURL, title, URL, ">"+quote, "["+today+"]にpick", "", "[リンク未整理]"]; var body_final = encodeURIComponent(body.join('\n')); window.open('https://scrapbox.io/'+project+'/'+encodeURIComponent(title.trim())+'?body='+body_final) })();
まずコメントをなくす
code:コメントなくした後.js javascript:(function(){   var project = "inteltank";   var title = document.title;   var metaDiscre = document.head.children;   var metaLength = metaDiscre.length;   var imageURL;   for(var i = 0;i < metaLength;i++){ var proper = metaDiscre[i].getAttribute('property'); if(proper === 'og:image'){ imageURL = metaDiscre[i].content.replace(/"|'/,''); } } var d = new Date(); var today = [d.getFullYear(),(d.getMonth()+1),d.getDate()].join('/'); var URL = window.location.href.replace(/"|'/,''); var quote=window.getSelection().toString(); var body = [ "["+imageURL+"]", title, URL, ">"+quote, "["+today+"]にpick", "", "[リンク未整理]"]; var body_final = encodeURIComponent(body.join('\n')); window.open('https://scrapbox.io/'+project+'/'+encodeURIComponent(title.trim())+'?body='+body_final) })();

作ったので、改行をなくし、encodeする
改行・タブをなくしたもの.js
javascript:(function(){var project = "inteltank";var title = document.title;var metaDiscre = document.head.children;var metaLength = metaDiscre.length;var imageURL;for(var i = 0;i < metaLength;i++){var proper = metaDiscre[i].getAttribute('property');if(proper === 'og:image'){imageURL = metaDiscre[i].content.replace(/"|'/,'');}}var d = new Date();var today = [d.getFullYear(),(d.getMonth()+1),d.getDate()].join('/');var URL = window.location.href.replace(/"|'/,'');var quote=window.getSelection().toString();var body = ["["+imageURL+"]",title,URL,">"+quote,"["+today+"]にpick","","[リンク未整理]"];var body_final = encodeURIComponent(body.join('\n'));window.open('https://scrapbox.io/'+project+'/'+encodeURIComponent(title.trim())+'?body='+body_final)})();