Skip to content

Instantly share code, notes, and snippets.

@marcora
Created October 24, 2008 01:07
Show Gist options
  • Save marcora/19302 to your computer and use it in GitHub Desktop.
Save marcora/19302 to your computer and use it in GitHub Desktop.
javascript:sel=document.getSelection();doi=/doi\s*:\s*(10\.\S+\/\S+)/i;pmid=/pmid\s*:\s*(\d+)(:?\s+|$)/i;fonek=/href="\/pubmed\/(\d+)"/i;html=document.body.innerHTML;txt=html.replace(/(<([^>]+)>)/ig,'%20');if(!sel){if(html.search(fonek)>=0&&document.location.href.search("www.f1000")>=0){sel=fonek.exec(html)[1];}else%20if(txt.search(pmid)>=0){sel=pmid.exec(txt)[1];}else%20if(txt.search(doi)>=0){sel=doi.exec(txt)[1];}else{sel=prompt('Enter%20DOI%20or%20PMID%20of%20article%20to%20fetch:','')}}if(sel)location.href='http://localhost:8888/fetch?id='+escape(sel)+'&url='+escape(document.location.href);void%200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment