A couple of years ago I wrote a small bookmarklet for copying Pocket article
highlights to an org-mode
file. Pocket recently made some large updates to
their site which modified the markup and broke the bookmarklet (and also ruined
their iOS app).
I've written a new version of the bookmarklet. It works the same as before and
will copy highlights to the clipboard, wrapped in org-mode
quote blocks.
Drag the button below to your bookmarks toolbar, and then click it when viewing any highlighted article in Pocket to copy notes to the clipboard (tested in Firefox):
The un-minified source is below and can be modified to remove org-mode
specific formatting if needed:
let to_clipboard = "#+TITLE: " + document.getElementsByTagName('h1')[0].innerHTML + "\n\n"; const all_highlights = document.querySelectorAll('.sidebar-anchor aside > div > div > div > button'); all_highlights.forEach((highlight) => { if (highlight.classList.contains('inline-button') || highlight.hasAttribute('aria-label')) { return; } let highlight_text = highlight.innerHTML; if (typeof highlight_text !== 'undefined' && highlight_text.trim() != '') { to_clipboard += "#+begin_quote\n"; to_clipboard += highlight_text.trim() + "\n"; to_clipboard += "#+end_quote\n\n"; } }); to_clipboard += "*Source*: " + document.getElementById('reader.external-link.view-original').href; navigator.clipboard.writeText(to_clipboard);