Coding a Pocket Bookmarklet

I have never really coded in Javascript before, but I wasn’t afraid of trying to find a solution to a problem, once a quick Google returned nothing of interest. I’m talking about Pocket, and the fact that it hides the original link to a saved item in the Article view. The bookmarklet (or browser extension) I had in mind would simply swap out the ‘domain’ of the item, in favour of the original link, on a button press (bookmarklet) or in the background (browser extension).

I discovered through lots of tinkering with jQuery and HTML source code that this is probably best achieved by finding the original link and corresponding domain at http://getpocket.com/unread. These can then be matched with the domain from ‘sub’ at http://getpocket.com/a/queue/.

NB: I’ve just realized that this may not work if you have multiple items from the same ‘domain’.

Anyway, here’s what I came up with for the bookmarklet. Keep in mind this is just preliminary chicken scratch code that doesn’t do anything, but I’m sharing it in the hopes it will give someone with a better Javascript background a chance to make a useful tool.

Sample 1 – Get Domain

Sample 2 – Get Original URL

***

Ultimately I hope Pocket updates to include these features by default, because it is really kind of annoying, after everything else they got right.

Advertisements