Skip to content

Instantly share code, notes, and snippets.

@osamu2001
Created February 1, 2019 02:20
Show Gist options
  • Save osamu2001/1d4c1fe39e66bab067171e8420df9661 to your computer and use it in GitHub Desktop.
Save osamu2001/1d4c1fe39e66bab067171e8420df9661 to your computer and use it in GitHub Desktop.
今見ているページを日付情報付きで記録する
javascript:(function () {
var title = document.title;
if (!title) return;
var lines = ['', window.location.href];
var quote = window.getSelection().toString();
if (quote.trim()) lines = lines.concat(quote.split(/\n/g).map(function (line) {
return ' > ' + line;
}));
var dt = new Date();
var y = dt.getFullYear();
var m = ("00" + (dt.getMonth() + 1)).slice(-2);
var d = ("00" + dt.getDate()).slice(-2);
var ds = "[" + y + "-" + m + "-" + d + "]";
lines.push("[hr.icon]");
lines.push(ds);
var body = encodeURIComponent(lines.join('\n'));
window.open('https://scrapbox.io/osamu-private/' + encodeURIComponent(title.trim()) + '?body=' + body)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment