Instapaper bookmarklet, modified to close the current tab
I’ve just recently started using Instapaper after repeatedly seeing discussions regarding its nascent Kindle support. It’s been around for a good while, but I never paid it much attention because I didn’t think I needed it (I’m pretty sure I just thought of it as a variation on delicious and never looked back).
After using it for a day or so I was pretty sure I didn’t want to go back to life without it. I’ll try to cover this more in-depth in a future post, but for now let me just say that Instapaper has liberated me from the 50-100+ tabs that usually occupy my browser window(s).
Anyway, the crux of the Instapaper workflow is the bookmarklet that drops your current tab into your Instapaper account. When you click the bookmarklet a small pop-up tells you whether the link has been saved to your account, and then closes (and this all occurs very quickly, which is why Instapaper just works for me). However, the tab you just saved to Instapaper remains open. Huh? The whole point of the service is to save for later things you can’t read now; what purpose is served by having a site open in two places?
In light of this, I modified the bookmarklet slightly so that the tab closes immediately, without disturbing the pop-up. This way, saving something for later is one simple action, instead of two.
To use the bookmarklet, drag [this link](javascript:var%20d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='https://www.instapaper.com/b',l=d.location,e=encodeURIComponent,p='?v=4&k=USER_KEY&u='+e(l.href) +'&t='+e(d.title) +'&s='+e(s),u=f+p;try{if(!/^(..)?instapaper([^.])?$/.test(l.host))throw(0);iptstbt();}catch(z){a%20=function(){if(!w.open(u,'t','toolbar=0,resizable=0,status=1,width=250,height=150'))l.href=u;};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else%20a();}window.close();void(0)) to your bookmarks bar. UPDATE: I’ve updated the bookmarklet.
A couple of notes:
- I’ve tested it only on Safari 4/Mac.
- The bookmarklet requires a user key. I’ve replaced my user key with USER_KEY (without quotes). Find that phrase and replace it with the user key found in the bookmarklet Instapaper generated for you.