Skip to content

Instantly share code, notes, and snippets.

@artlung
Created April 7, 2014 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artlung/10030191 to your computer and use it in GitHub Desktop.
Save artlung/10030191 to your computer and use it in GitHub Desktop.
javascript:function getSelectionHtml(){var e="";if(typeof window.getSelection!="undefined"){var t=window.getSelection();if(t.rangeCount){var n=document.createElement("div");for(var r=0,i=t.rangeCount;r<i;++r){n.appendChild(t.getRangeAt(r).cloneContents())}e=n.innerHTML}}else if(typeof document.selection!="undefined"){if(document.selection.type=="Text"){e=document.selection.createRange().htmlText}}return e};var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=getSelectionHtml(),f='http://example.com/wordpress/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