Skip to content

Instantly share code, notes, and snippets.

@pberry
Created April 27, 2011 16:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pberry/944541 to your computer and use it in GitHub Desktop.
Save pberry/944541 to your computer and use it in GitHub Desktop.
javascript:
(
function()
{
var source = document.documentElement.innerHTML;
var regex1 = /appeared in print on
((January|February|March|April|May|June|July|August|September|October|November|December)
([1-2][0-9]|3[0-1]|0?[1-9]), ((19|20)[0-9][0-9])), on page (\w+) of the
New York edition with the headline:(.*)</g;
var match = regex1.exec(source);
if (match)
{
var articleDate = new Date(match[2] + ' ' + match[3] + ', '
+ match[4]);
var articleYear = articleDate.getFullYear();
var articleMonth = articleDate.getMonth() + 1;
var articleDay = articleDate.getDate();
var regex2 = /([A-Z]+)(\d+)/g;
var pageMatch = regex2.exec(match[6]);
var articleURL =
'http://www.lexisnexis.com/us/lnacademic/api/version1/sr?shr=t&csi=6742&sr=HLEAD%28'
+ match[7] + '%29+AND+DATE+IS+' + articleMonth + '%2F' + articleDay +
'%2F' + articleYear;
window.open('http://proxy.library.vcu.edu/login?url=' +
articleURL);
}
else
{
alert("This article hasn't been published in the print
version of the NY Times and isn't accessible through VCU Libraries.");
}
}
)
();
javascript:
(
function()
{
var source = document.documentElement.innerHTML;
var regex1 = /A version of this article appeared in print on ((January|February|March|April|May|June|July|August|September|October|November|December) ([1-2][0-9]|3[0-1]|0?[1-9]), ((19|20)[0-9][0-9])), on page (\w+) of the New York edition with the headline:(.*)</g;
var match = regex1.exec(source);
if (match)
{
var articleDate = new Date(match[2] + ' ' + match[3] + ', ' + match[4]);
var articleYear = articleDate.getFullYear();
var articleMonth = articleDate.getMonth() + 1;
var articleDay = articleDate.getDate();
var regex2 = /([A-Z]+)(\d+)/g;
var pageMatch = regex2.exec(match[6]);
window.open('https://proxy.libraries.uc.edu/login?url=http://proquest.umi.com/pqdweb?RQT=305&SQ=issn%2803624331%29%20and%20ti%28' + match[7] + '%29%20and%20pdn%28' + articleMonth + '%2F' + articleDay + '%2F' + articleYear + '%29%20and%20startpage%28' + pageMatch[1] + '.' + pageMatch[2] + '%29');
}
else
{
alert("This article hasn't been published in the print version of the NY Times and isn't accessible through the UC Libraries.");
}
}
)
();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment