Skip to content

Instantly share code, notes, and snippets.

@jackysee
Created August 19, 2020 08:15
Show Gist options
  • Save jackysee/923aaa1c87d229b328eefee835bbf5a7 to your computer and use it in GitHub Desktop.
Save jackysee/923aaa1c87d229b328eefee835bbf5a7 to your computer and use it in GitHub Desktop.
extract note as citation
var c = document.querySelector('.e-content').innerHTML;
var a = document.querySelector('.u-url');
var w = window.open('', '', 'width=400,height=200');
w.document.write(`<textarea style="width:90vw;height:80vh"><p><cite class="h-cite">Note on <a class="u-url" href="${a.href}">${a.innerText}</a></cite></p><blockquote>${c.trim()}</blockquote></textarea>`);
var t = w.document.querySelector('textarea');
t.addEventListener('click', function(){ t.select(); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment