Skip to content

Instantly share code, notes, and snippets.

@justinkelly
Last active August 29, 2015 14:08
Show Gist options
  • Save justinkelly/1d060902b6ddc7773eda to your computer and use it in GitHub Desktop.
Save justinkelly/1d060902b6ddc7773eda to your computer and use it in GitHub Desktop.
Additional javascript for Alma to highlight the call number
//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;
@justinkelly
Copy link
Author

Here is what the current Alma Uresolver page looks like:

Here is what it looks like when the above javascript is applied:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment