Idea: DOI Rescue extension - lmmx/devnotes GitHub Wiki
DOI Rescue
Browser extension that kicks in on dx.doi.org/*
and doi.org/*
when a DOI hasn't been registered yet, redirects to the website and uses its search function
-
I wrote an example for Nature 10 months ago, would not be hard to programmatically pull in all others for which this could happen - https://gist.github.com/lmmx/4dafda42f50514f2de9a
-
extensible table of URLs and search pages, using the DOI of the publication.
[
"Nature": { DOI_prefix: "10.1038/nature",
URL: "http://www.nature.com/search?q=" },
"Nature Chemistry": { DOI_prefix: "10.1038/nchem",
URL: "" },
"Nature Genetics": { DOI_prefix: "10.1038/ng",
URL: "" }
]
etc.
Below this is the basic code to handle it, currently a bookmarklet but better as a minimal browser extension [i.e. one with no user activity required, like gmtfPDF]
- could be an extension to gmtfPDF...!
Bookmarklet:
javascript:(function(){if (window.location.href.indexOf('nature.com/doifinder/') > -1 && document.querySelector('span.largeParagraph > p').innerText.indexOf('DOI Handle') > -1) { doi = window.location.href.split('doifinder/')[1]; var naturexhr = new XMLHttpRequest(); naturexhr.open("GET","http://www.nature.com/search/executeSearch?sp-q="+doi.replace('/','%2F')+"&sp-p=all&pag-start=1&sp-c=25&sp-m=0&sp-s=&siteCode=default,true"); naturexhr.send(); naturexhr.onreadystatechange = function(){ if (naturexhr.readyState === 4 && naturexhr.status==200){ redirURL = naturexhr.response.match(/<h2 class="atl"><a href="(.*?)"/)[1]; window.location.href = redirURL; } } } else { alert('You need to be on the error page to do page redirect from the "invalid DOI" page'); }
})();
Full script:
if (window.location.href.indexOf('http://www.nature.com/doifinder/') > -1 && document.querySelector('span.largeParagraph > p').innerText.indexOf('DOI Handle') > -1) {
doi = window.location.href.split('doifinder/')[1];
var naturexhr = new XMLHttpRequest();
naturexhr.open("GET","http://www.nature.com/search/executeSearch?sp-q="+doi.replace('/','%2F')+"&sp-p=all&pag-start=1&sp-c=25&sp-m=0&sp-s=&siteCode=default,true");
naturexhr.send();
naturexhr.onreadystatechange = function(){
if (naturexhr.readyState === 4 && naturexhr.status==200){
redirURL = naturexhr.response.match(/<h2 class="atl"><a href="(.*?)"/)[1];
window.location.href = redirURL;
}
}
}
else {
alert('You need to be on the error page to do page redirect from the "invalid DOI" page');
}