Skip to content

Instantly share code, notes, and snippets.

@georgestephanis
Created June 20, 2012 14:13
Show Gist options
  • Save georgestephanis/2960102 to your computer and use it in GitHub Desktop.
Save georgestephanis/2960102 to your computer and use it in GitHub Desktop.
Press This Bookmarklet JS
var d=document,
w=window,
e=w.getSelection,
k=d.getSelection,
x=d.selection,
s=(e?e():(k)?k():(x?x.createRange().text:0)),
f='http://wordpress.site/wp-admin/press-this.php',
l=d.location,
e=encodeURIComponent,
u=f+'?u='+e(l.href)+'&t='+e(d.title)+'&s='+e(s)+'&v=4';
a=function(){if(!w.open(u,'t','toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=570'))l.href=u;};
if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0); else a();
void(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment