Created
April 29, 2016 19:58
-
-
Save mreidsma/84e313c5339fdd01b023477107aefc8e to your computer and use it in GitHub Desktop.
Short script to switch catalog 856 fields to https connections
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
$('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