Last active
November 23, 2020 14:41
-
-
Save lmmx/4dafda42f50514f2de9a to your computer and use it in GitHub Desktop.
Button to navigate to articles from Nature publications which are published before DOIs are assigned - clicking the bookmarklet uses Nature's search engine to find the correct article and navigates there (copy the text as a bookmark, the other file is there for reference)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); } | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment