Skip to content

Instantly share code, notes, and snippets.

@mreidsma
Created April 29, 2016 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mreidsma/84e313c5339fdd01b023477107aefc8e to your computer and use it in GitHub Desktop.
Save mreidsma/84e313c5339fdd01b023477107aefc8e to your computer and use it in GitHub Desktop.
Short script to switch catalog 856 fields to https connections
$('table.bib_links').find('a').each(function() {
var eBookArray = Array('proquest.safaribooksonline.com');
// Get part of URL after ezproxy
var ezpUrl = $(this).attr('href');
var providerArray = ezpUrl.split('/');
console.log(providerArray[5]);
if(eBookArray.indexOf(providerArray[5]) !== -1) {
ezpUrl = ezpUrl.replace(/http\:/, 'https:');
ezpUrl = ezpUrl.replace(/url\=http\:/, 'url=https:');
console.log('Changing URL for ' + providerArray[5] + ' from HTTP to HTTPS to protect reader privacy');
$(this).attr('href', ezpUrl).removeAttr('onclick');
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment