diff --git a/themes/TAMU/js/check_item_statuses.js b/themes/TAMU/js/check_item_statuses.js
index 284d77fb789..6a4c32dd925 100644
--- a/themes/TAMU/js/check_item_statuses.js
+++ b/themes/TAMU/js/check_item_statuses.js
@@ -1,233 +1,233 @@
/*global Hunt, VuFind */
VuFind.register('itemStatuses', function ItemStatuses() {
- function formatCallnumbers(callnumber, callnumber_handler) {
- var cns = callnumber.split(',\t');
- for (var i = 0; i < cns.length; i++) {
- // If the call number has a special delimiter, it indicates a prefix that
- // should be used for display but not for sorting/searching.
- var actualCallNumber = cns[i];
- var displayCallNumber = cns[i];
- var parts = cns[i].split('::::');
- if (parts.length > 1) {
- displayCallNumber = parts[0] + " " + parts[1];
- actualCallNumber = parts[1];
- }
- cns[i] = callnumber_handler
- ? '' + displayCallNumber + ''
- : displayCallNumber;
+ function formatCallnumbers(callnumber, callnumber_handler) {
+ var cns = callnumber.split(',\t');
+ for (var i = 0; i < cns.length; i++) {
+ // If the call number has a special delimiter, it indicates a prefix that
+ // should be used for display but not for sorting/searching.
+ var actualCallNumber = cns[i];
+ var displayCallNumber = cns[i];
+ var parts = cns[i].split('::::');
+ if (parts.length > 1) {
+ displayCallNumber = parts[0] + " " + parts[1];
+ actualCallNumber = parts[1];
}
- return cns.join(',\t');
+ cns[i] = callnumber_handler
+ ? '' + displayCallNumber + ''
+ : displayCallNumber;
}
- function displayItemStatus(result, $item) {
- $item.addClass('js-item-done').removeClass('js-item-pending');
- $item.find('.status').empty().append(result.availability_message);
- $item.find('.ajax-availability').removeClass('ajax-availability hidden');
- if (typeof(result.error) != 'undefined'
- && result.error.length > 0
- ) {
- $item.find('.callnumAndLocation').empty().addClass('text-danger').append(result.error);
- $item.find('.callnumber,.hideIfDetailed,.location').addClass('hidden');
- } else if (typeof(result.full_status) != 'undefined'
- && result.full_status.length > 0
- && $item.find('.callnumAndLocation').length > 0
- ) {
- // Full status mode is on -- display the HTML and hide extraneous junk:
- $item.find('.callnumAndLocation').empty().append(result.full_status);
- $item.find('.callnumber,.hideIfDetailed,.location,.status').addClass('hidden');
- } else if (typeof(result.missing_data) !== 'undefined'
- && result.missing_data
- ) {
- // No data is available -- hide the entire status area:
- $item.find('.callnumAndLocation,.status').addClass('hidden');
- } else if (result.locationList) {
- // We have multiple locations -- build appropriate HTML and hide unwanted labels:
- $item.find('.callnumber,.hideIfDetailed,.location').addClass('hidden');
- var locationListHTML = "";
- for (var x = 0; x < result.locationList.length; x++) {
- locationListHTML += '
';
- if (result.locationList[x].availability) {
- locationListHTML += '
'
- + result.locationList[x].location + ' ';
- } else if (typeof(result.locationList[x].status_unknown) !== 'undefined'
- && result.locationList[x].status_unknown
- ) {
- if (result.locationList[x].location) {
- locationListHTML += '
'
- + result.locationList[x].location + ' ';
- }
- } else {
- locationListHTML += '
'
- + result.locationList[x].location + ' ';
+ return cns.join(',\t');
+ }
+ function displayItemStatus(result, $item) {
+ $item.addClass('js-item-done').removeClass('js-item-pending');
+ $item.find('.status').empty().append(result.availability_message);
+ $item.find('.ajax-availability').removeClass('ajax-availability hidden');
+ if (typeof (result.error) != 'undefined'
+ && result.error.length > 0
+ ) {
+ $item.find('.callnumAndLocation').empty().addClass('text-danger').append(result.error);
+ $item.find('.callnumber,.hideIfDetailed,.location').addClass('hidden');
+ } else if (typeof (result.full_status) != 'undefined'
+ && result.full_status.length > 0
+ && $item.find('.callnumAndLocation').length > 0
+ ) {
+ // Full status mode is on -- display the HTML and hide extraneous junk:
+ $item.find('.callnumAndLocation').empty().append(result.full_status);
+ $item.find('.callnumber,.hideIfDetailed,.location,.status').addClass('hidden');
+ } else if (typeof (result.missing_data) !== 'undefined'
+ && result.missing_data
+ ) {
+ // No data is available -- hide the entire status area:
+ $item.find('.callnumAndLocation,.status').addClass('hidden');
+ } else if (result.locationList) {
+ // We have multiple locations -- build appropriate HTML and hide unwanted labels:
+ $item.find('.callnumber,.hideIfDetailed,.location').addClass('hidden');
+ var locationListHTML = "";
+ for (var x = 0; x < result.locationList.length; x++) {
+ locationListHTML += '
';
+ if (result.locationList[x].availability) {
+ locationListHTML += ' '
+ + result.locationList[x].location + ' ';
+ } else if (typeof (result.locationList[x].status_unknown) !== 'undefined'
+ && result.locationList[x].status_unknown
+ ) {
+ if (result.locationList[x].location) {
+ locationListHTML += ' '
+ + result.locationList[x].location + ' ';
}
- locationListHTML += '
';
- locationListHTML += '
';
- locationListHTML += (result.locationList[x].callnumbers)
- ? formatCallnumbers(result.locationList[x].callnumbers, result.locationList[x].callnumber_handler) : '';
- locationListHTML += '
';
- }
- $item.find('.locationDetails').removeClass('hidden');
- $item.find('.locationDetails').html(locationListHTML);
- } else {
- // Default case -- load call number and location into appropriate containers:
-
- //TAMU Customization - Separate each location for display
- let locations = result.location.split(",\t");
- let displayLocations = "";
- if (locations.length > 1) {
- $(locations).each(function(i,l) {
- displayLocations += '
'+l+'
';
- });
} else {
- displayLocations = result.location;
+ locationListHTML += '
'
+ + result.locationList[x].location + ' ';
}
- $item.find('.callnumber').empty().append(formatCallnumbers(result.callnumber, result.callnumber_handler) + '
');
- $item.find('.location').empty().append(
- result.reserve === 'true'
- ? result.reserve_message
- : displayLocations
- );
+ locationListHTML += '
';
+ locationListHTML += '';
+ locationListHTML += (result.locationList[x].callnumbers)
+ ? formatCallnumbers(result.locationList[x].callnumbers, result.locationList[x].callnumber_handler) : '';
+ locationListHTML += '
';
+ }
+ $item.find('.locationDetails').removeClass('hidden');
+ $item.find('.locationDetails').html(locationListHTML);
+ } else {
+ // Default case -- load call number and location into appropriate containers:
+
+ //TAMU Customization - Separate each location for display
+ let locations = result.location.split(",\t");
+ let displayLocations = "";
+ if (locations.length > 1) {
+ $(locations).each(function (i, l) {
+ displayLocations += '' + l + '
';
+ });
+ } else {
+ displayLocations = result.location;
}
+ $item.find('.callnumber').empty().append(formatCallnumbers(result.callnumber, result.callnumber_handler) + '
');
+ $item.find('.location').empty().append(
+ result.reserve === 'true'
+ ? result.reserve_message
+ : displayLocations
+ );
}
+ }
- var ItemStatusHandler = {
- name: "default",
- // Object that holds item IDs, states and elements
- items: {},
- url: '/AJAX/JSON?method=getItemStatuses',
- itemStatusRunning: false,
- dataType: 'json',
- method: 'POST',
- itemStatusTimer: null,
- itemStatusDelay: 200,
+ var ItemStatusHandler = {
+ name: "default",
+ // Object that holds item IDs, states and elements
+ items: {},
+ url: '/AJAX/JSON?method=getItemStatuses',
+ itemStatusRunning: false,
+ dataType: 'json',
+ method: 'POST',
+ itemStatusTimer: null,
+ itemStatusDelay: 200,
- checkItemStatusDone: function checkItemStatusDone(response) {
- var data = response.data;
- for (var j = 0; j < data.statuses.length; j++) {
- var status = data.statuses[j];
- this.items[status.id].result = status;
- this.items[status.id].state = 'done';
- for (var e = 0; e < this.items[status.id].elements.length; e++) {
- displayItemStatus(status, this.items[status.id].elements[e]);
- }
- }
- },
- itemStatusFail: function itemStatusFail(response, textStatus) {
- if (textStatus === 'error' || textStatus === 'abort' || typeof response.responseJSON === 'undefined') {
- return;
+ checkItemStatusDone: function checkItemStatusDone(response) {
+ var data = response.data;
+ for (var j = 0; j < data.statuses.length; j++) {
+ var status = data.statuses[j];
+ this.items[status.id].result = status;
+ this.items[status.id].state = 'done';
+ for (var e = 0; e < this.items[status.id].elements.length; e++) {
+ displayItemStatus(status, this.items[status.id].elements[e]);
}
- // display the error message on each of the ajax status place holder
- $('.js-item-pending .callnumAndLocation').addClass('text-danger').empty().removeClass('hidden')
- .append(typeof response.responseJSON.data === 'string' ? response.responseJSON.data : VuFind.translate('error_occurred'));
- },
- itemQueueAjax: function itemQueueAjax(id, el) {
- el.addClass('js-item-pending').removeClass('hidden');
- el.find('.callnumAndLocation').removeClass('hidden');
- el.find('.callnumAndLocation .ajax-availability').removeClass('hidden');
- el.find('.status').removeClass('hidden');
- // If this id has already been queued, just add it to the elements or display a
- // cached result.
- if (typeof this.items[id] !== 'undefined') {
- if ('done' === this.items[id].state) {
- displayItemStatus(this.items[id].result, el);
- } else {
- this.items[id].elements.push(el);
- }
- return;
+ }
+ },
+ itemStatusFail: function itemStatusFail(response, textStatus) {
+ if (textStatus === 'error' || textStatus === 'abort' || typeof response.responseJSON === 'undefined') {
+ return;
+ }
+ // display the error message on each of the ajax status place holder
+ $('.js-item-pending .callnumAndLocation').addClass('text-danger').empty().removeClass('hidden')
+ .append(typeof response.responseJSON.data === 'string' ? response.responseJSON.data : VuFind.translate('error_occurred'));
+ },
+ itemQueueAjax: function itemQueueAjax(id, el) {
+ el.addClass('js-item-pending').removeClass('hidden');
+ el.find('.callnumAndLocation').removeClass('hidden');
+ el.find('.callnumAndLocation .ajax-availability').removeClass('hidden');
+ el.find('.status').removeClass('hidden');
+ // If this id has already been queued, just add it to the elements or display a
+ // cached result.
+ if (typeof this.items[id] !== 'undefined') {
+ if ('done' === this.items[id].state) {
+ displayItemStatus(this.items[id].result, el);
+ } else {
+ this.items[id].elements.push(el);
}
- clearTimeout(this.itemStatusTimer);
- this.items[id] = {
- id: id,
- state: 'queued',
- elements: [el]
- };
- this.itemStatusTimer = setTimeout(this.runItemAjaxForQueue.bind(this), this.itemStatusDelay);
- },
+ return;
+ }
+ clearTimeout(this.itemStatusTimer);
+ this.items[id] = {
+ id: id,
+ state: 'queued',
+ elements: [el]
+ };
+ this.itemStatusTimer = setTimeout(this.runItemAjaxForQueue.bind(this), this.itemStatusDelay);
+ },
- runItemAjaxForQueue: function runItemAjaxForQueue() {
- if (this.itemStatusRunning) {
- this.itemStatusTimer = setTimeout(this.runItemAjaxForQueue.bind(this), this.itemStatusDelay);
- return;
+ runItemAjaxForQueue: function runItemAjaxForQueue() {
+ if (this.itemStatusRunning) {
+ this.itemStatusTimer = setTimeout(this.runItemAjaxForQueue.bind(this), this.itemStatusDelay);
+ return;
+ }
+ var ids = [];
+ var self = this;
+ $.each(this.items, function selectQueued() {
+ if ('queued' === this.state) {
+ self.items[this.id].state = 'running';
+ ids.push(this.id);
}
- var ids = [];
- var self = this;
- $.each(this.items, function selectQueued() {
- if ('queued' === this.state) {
- self.items[this.id].state = 'running';
- ids.push(this.id);
- }
+ });
+ $.ajax({
+ dataType: this.dataType,
+ method: this.method,
+ url: VuFind.path + this.url,
+ context: this,
+ data: { 'id': ids }
+ })
+ .done(this.checkItemStatusDone)
+ .fail(this.itemStatusFail)
+ .always(function queueAjaxAlways() {
+ this.itemStatusRunning = false;
});
- $.ajax({
- dataType: this.dataType,
- method: this.method,
- url: VuFind.path + this.url,
- context: this,
- data: { 'id': ids }
- })
- .done(this.checkItemStatusDone)
- .fail( this.itemStatusFail)
- .always(function queueAjaxAlways() {
- this.itemStatusRunning = false;
- });
- }//end runItemAjaxForQueue
- };
+ }//end runItemAjaxForQueue
+ };
- //add you own overridden handler here
- var OdItemStatusHandler = Object.create(ItemStatusHandler);
- OdItemStatusHandler.url = '/Overdrive/getStatus';
- OdItemStatusHandler.itemStatusDelay = 200;
- OdItemStatusHandler.name = "overdrive";
- OdItemStatusHandler.items = {};
+ //add you own overridden handler here
+ var OdItemStatusHandler = Object.create(ItemStatusHandler);
+ OdItemStatusHandler.url = '/Overdrive/getStatus';
+ OdItemStatusHandler.itemStatusDelay = 200;
+ OdItemStatusHandler.name = "overdrive";
+ OdItemStatusHandler.items = {};
- //store the handlers in a "hash" obj
- var checkItemHandlers = {
- 'ils': ItemStatusHandler,
- 'overdrive': OdItemStatusHandler,
- };
+ //store the handlers in a "hash" obj
+ var checkItemHandlers = {
+ 'ils': ItemStatusHandler,
+ 'overdrive': OdItemStatusHandler,
+ };
- function checkItemStatus(el) {
- var $item = $(el);
- if ($item.hasClass('js-item-pending') || $item.hasClass('js-item-done')) {
- return;
- }
- if ($item.find('.hiddenId').length === 0) {
- return false;
- }
- var id = $item.find('.hiddenId').val();
- var handlerName = 'ils';
- if ($item.data("handler-name")) {
- handlerName = $item.data("handler-name");
- } else if ($item.find('.handler-name').length > 0) {
- handlerName = $item.find('.handler-name').val();
- }
-
- //queue the element into the handler
- checkItemHandlers[handlerName].itemQueueAjax(id, $item);
+ function checkItemStatus(el) {
+ var $item = $(el);
+ if ($item.hasClass('js-item-pending') || $item.hasClass('js-item-done')) {
+ return;
+ }
+ if ($item.find('.hiddenId').length === 0) {
+ return false;
}
+ var id = $item.find('.hiddenId').val();
+ var handlerName = 'ils';
+ if ($item.data("handler-name")) {
+ handlerName = $item.data("handler-name");
+ } else if ($item.find('.handler-name').length > 0) {
+ handlerName = $item.find('.handler-name').val();
+ }
+
+ //queue the element into the handler
+ checkItemHandlers[handlerName].itemQueueAjax(id, $item);
+ }
+
+ function checkItemStatuses(_container) {
+ var container = typeof _container === 'undefined'
+ ? document.body
+ : _container;
- function checkItemStatuses(_container) {
+ var ajaxItems = $(container).find('.ajaxItem');
+ for (var i = 0; i < ajaxItems.length; i++) {
+ checkItemStatus($(ajaxItems[i]));
+ }
+ }
+ function init(_container) {
+ if (typeof Hunt === 'undefined') {
+ checkItemStatuses(_container);
+ } else {
var container = typeof _container === 'undefined'
? document.body
: _container;
-
- var ajaxItems = $(container).find('.ajaxItem');
- for (var i = 0; i < ajaxItems.length; i++) {
- checkItemStatus($(ajaxItems[i]));
- }
- }
- function init(_container) {
- if (typeof Hunt === 'undefined') {
- checkItemStatuses(_container);
- } else {
- var container = typeof _container === 'undefined'
- ? document.body
- : _container;
- new Hunt(
- $(container).find('.ajaxItem').toArray(),
- { enter: checkItemStatus }
- );
- }
+ new Hunt(
+ $(container).find('.ajaxItem').toArray(),
+ { enter: checkItemStatus }
+ );
}
+ }
- return { init: init, check: checkItemStatuses, checkRecord: checkItemStatus };
- });
+ return { init: init, check: checkItemStatuses, checkRecord: checkItemStatus };
+});
diff --git a/themes/TAMU/js/tamu_fulltext.js b/themes/TAMU/js/tamu_fulltext.js
index c61b7e8a77c..9933eac84e0 100644
--- a/themes/TAMU/js/tamu_fulltext.js
+++ b/themes/TAMU/js/tamu_fulltext.js
@@ -1,12 +1,12 @@
-$(document).ready(function() {
+$(document).ready(function () {
let $sfxButton = $("#sfxButton");
let title = $sfxButton.data("title");
let issn = $sfxButton.data("issn");
if (title && issn) {
$.ajax({
- url: gifmBase+"catalog-access/check-full-text",
- data: {"title": title,"issn": issn}
- }).done(function(data) {
+ url: gifmBase + "catalog-access/check-full-text",
+ data: { "title": title, "issn": issn }
+ }).done(function (data) {
if (data.payload.Boolean == true) {
$("#sfxRow td").children().removeClass("hidden");
}
diff --git a/themes/TAMU/js/tamu_gifm.js b/themes/TAMU/js/tamu_gifm.js
index 57988846471..539a3f94905 100644
--- a/themes/TAMU/js/tamu_gifm.js
+++ b/themes/TAMU/js/tamu_gifm.js
@@ -1,43 +1,43 @@
//check with GIFM Service for buttons
-var buildButtons = function() {
+var buildButtons = function () {
let bibId = $("#hiddenInstanceId").val();
if (bibId) {
if ($(".getit").length > 0) {
- $(".getit").each(function(index,button) {
+ $(".getit").each(function (index, button) {
$(this).append("");
});
let messageIncrement = 0;
- let startTimer = function() {
- patience = setInterval(function() {
- let messages = ["This title has a lot of volumes, so this may take a while.",
- "We're still working on creating the Get It For Me buttons.",
- "Please stay on the page. We're still working on it",
- "Please stay on the page while we retrieve the information."];
- if (messageIncrement >= messages.length) {
+ let startTimer = function () {
+ patience = setInterval(function () {
+ let messages = ["This title has a lot of volumes, so this may take a while.",
+ "We're still working on creating the Get It For Me buttons.",
+ "Please stay on the page. We're still working on it",
+ "Please stay on the page while we retrieve the information."];
+ if (messageIncrement >= messages.length) {
messageIncrement = 0;
- }
- $(".getit div.buttons .updates").text(messages[messageIncrement]);
+ }
+ $(".getit div.buttons .updates").text(messages[messageIncrement]);
messageIncrement++;
}, 15000);
};
$.ajax({
- url: gifmBase+"catalog-access/get-buttons",
- data: {"bibId": bibId,"catalogName":catalogName},
- beforeSend: function() {
+ url: gifmBase + "catalog-access/get-buttons",
+ data: { "bibId": bibId, "catalogName": catalogName },
+ beforeSend: function () {
startTimer();
}
- }).done(function(data) {
+ }).done(function (data) {
if (data.meta.status === "ERROR") {
$(".getit div.buttons i").text(data.meta.message);
} else {
$(".getit .buttons").html("");
- $.each(data.payload.HashMap,function(mfhd,buttonPresentation) {
+ $.each(data.payload.HashMap, function (mfhd, buttonPresentation) {
if (buttonPresentation && buttonPresentation.buttons) {
- $.each(buttonPresentation.buttons,function(index,button) {
- let buttonHtml = ''+button.linkText+'';
+ $.each(buttonPresentation.buttons, function (index, button) {
+ let buttonHtml = '' + button.linkText + '';
if (button.itemKey) {
- $("#getit_"+button.itemKey+" .buttons").append(buttonHtml);
+ $("#getit_" + button.itemKey + " .buttons").append(buttonHtml);
} else {
$("#getit_purchase-it .buttons").append(buttonHtml);
}
@@ -45,27 +45,27 @@ var buildButtons = function() {
}
});
}
- }).fail(function(xhr,status,error) {
+ }).fail(function (xhr, status, error) {
$(".getit div.buttons").html("Error retrieving holding details");
- }).always(function() {
+ }).always(function () {
clearInterval(patience);
});
}
}
};
-var buildMapButton = function() {
+var buildMapButton = function () {
if ($(".localmap").length > 0) {
- $(".localmap").each(function(index,mapButton) {
+ $(".localmap").each(function (index, mapButton) {
let locationCode = $(mapButton).data("locationcode");
if (locationCode) {
$.ajax({
- url: gifmBase+"catalog-access/get-map-link",
- data: {"location": locationCode,"catalogName":catalogName}
- }).done(function(data) {
+ url: gifmBase + "catalog-access/get-map-link",
+ data: { "location": locationCode, "catalogName": catalogName }
+ }).done(function (data) {
let mapDetail = data.payload.MapDetail;
if (mapDetail.type == "URL") {
- $(mapButton).append(' Map it');
+ $(mapButton).append(' Map it');
}
});
}
@@ -73,11 +73,11 @@ var buildMapButton = function() {
}
};
-$(document).ready(function() {
+$(document).ready(function () {
buildButtons();
buildMapButton();
- $(document).ajaxSuccess(function( event, xhr, settings ) {
- if (settings.data && settings.data=='tab=holdings') {
+ $(document).ajaxSuccess(function (event, xhr, settings) {
+ if (settings.data && settings.data == 'tab=holdings') {
buildButtons();
buildMapButton();
}