From: Suresh K. <ss...@co...> - 2006-06-28 05:57:03
|
When I use the connotea bookmarklet on pubmed, the URL that is sent often contains extra characters with session specific information. e.g. http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed&cmd=Retrieve&dopt=Abstract&list_uids=13054692&query_hl=44&itool=pubmed_docsum I have appended a new bookmarklet that strips off the dopt= and query_hl= and itool= fields and submits: http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed&cmd=Retrieve&list_uids=13054692 Now, when the same PMID is bookmarked again, Connotea correctly recognizes it as already having been bookmarked, instead of tagging it as a new bookmark. For me, this is extremely important. I use Pubmed a lot and find Connotea to be a heaven-sent boon, but having dozens of duplicate abstracts was making life very difficult. I just learnt the necessary javascript to be able to write this. I am not comfortable with regular expressions, but if someone can help me replace the for loop in the code below with a simple regular expression, I will be grateful. For now, it works.... If there are bugs, please do let me know. Regards, Suresh javascript:u=location.href;a=false;x=window;e=x.encodeURIComponent;d=document; /*BEGIN MY INSERTION*/ if(u.indexOf("http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=pubmed")>-1){urlArray=u.split("&");newVariable=urlArray[0]+"&"+urlArray[1];for(ind=2;ind<urlArray.length;ind++){tempString=urlArray[ind];if(tempString.indexOf("list_uids")>-1){newVariable=newVariable+"&"+tempString;}}u=newVariable;} /*END MY INSERTION*/ if((s=d.selection)?t=s.createRange().text:t=x.getSelection()+'')(r=/(doi:)?\s?(10\.\d{4}\/\S+)/.exec(t))?u='http://dx.doi.org/'+r[2]:a=true;a?alert('Please highlight a full DOI, or deselect text to add this page.'):w=open('http://www.connotea.org/addpopup?continue=confirm&uri='+e(u)+'&title='+e(d.title),'add','width=660,height=600,scrollbars,resizable');void(x.setTimeout('w.focus()',200)); |