Last active
August 29, 2015 14:08
-
-
Save justinkelly/1d060902b6ddc7773eda to your computer and use it in GitHub Desktop.
Additional javascript for Alma to highlight the call number
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
//trim left and right white space | |
String.prototype.trim = function() { | |
return this.replace(/^\s+|\s+$/g, ""); | |
}; | |
//get call number | |
var CALL = document.getElementById("holdingKey").value; | |
var CALL_LIST = CALL.split(','); | |
var NUMB = CALL_LIST.slice(-1)[0]; | |
var CALL_NUMBER = NUMB.split('=').slice(-1)[0]; | |
//get the display fields | |
var LOCATION = document.getElementsByClassName("width15")[0]; | |
var CALL_NUMBER_DISPLAY = document.getElementsByClassName("width60")[0]; | |
//format the fields | |
var ARRY = CALL_NUMBER_DISPLAY.innerHTML.split(' '); | |
var CALL_NUMBER_FORMATTED = ARRY[ARRY.length - 2].trim(); | |
var NEW_LOCATION = "Location: " + ARRY[0] + " " + ARRY[1]; | |
var NEW_CALL_NUMBER_DISPLAY = "<b>Call Number: " + CALL_NUMBER_FORMATTED; | |
//apply the change | |
LOCATION.innerHTML = NEW_LOCATION; | |
CALL_NUMBER_DISPLAY.innerHTML = NEW_CALL_NUMBER_DISPLAY; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is what the current Alma Uresolver page looks like:
Here is what it looks like when the above javascript is applied: