Search Results for 'ONNEWANF' (2022)

').addClass('loadingDiv'); $J('body').append(div); } var backdrop = $J('body > .loadingBackdrop'); if(backdrop.length < 1) { backdrop = $J('

').addClass('loadingBackdrop'); $J('body').append(backdrop); } backdrop.show(); div.show(); createSpinnersForSelector(div); }, hideLoad:function() { $J('.loadingBackdrop').hide(); $J('.loadingDiv').hide(); stopSpinnersForSelector($J('.loadingDiv')); }, //format dialog functions findFormatDialog:function(callback, resultId, ercItem, isPreview) { if(!ercItem) { eRC_Dialogs.openErrorMessageDialog(callback, eRC_Dialogs.makeError('Error! Missing or malformed eResource Central item data')); return; } var formats = isPreview ? ercItem.previews : ercItem.formats; if(!formats || formats.length < 1) { eRC_Dialogs.openErrorMessageDialog(callback, eRC_Dialogs.makeError('Error! Missing or malformed eResource Central format data')); return; } if(formats.length === 1) { // Just one format to select, make it happen! eRC_Dialogs.hideLoad(); callback(formats[0], ercItem.drm, true); return; } var dialogId = eRC_Dialogs.makeId(isPreview ? eRC_Dialogs.previewDialogClass : eRC_Dialogs.formatDialogClass, resultId); var formatDialog = document.getElementById(dialogId); if(!formatDialog) { // We didn't find one, build it. eRC_Dialogs.showLoad(); formatDialog = eRC_Dialogs.buildFormatDialog(dialogId, ercItem, resultId, isPreview, callback); } formatDialog.setAttribute('value',''); // Ensure an empty value until one is selected. eRC_Dialogs.hideLoad(); $J(formatDialog).dialog('open'); }, buildFormatDialog:function(dialogId, ercItem, resultId, isPreview, callback) { if(!ercItem) { eRC_Dialogs.openErrorMessageDialog(callback, eRC_Dialogs.makeError('Error! Missing or malformed eResource Central item data')); return; } var formats = isPreview ? ercItem.previews : ercItem.formats; var formatDiv = eRC_Dialogs.buildFormatDiv(dialogId, formats, resultId, isPreview); var dialog = document.createElement('div'); dialog.setAttribute('id', dialogId); dialog.setAttribute('class', (isPreview ? eRC_Dialogs.previewDialogClass : eRC_Dialogs.formatDialogClass)+' ercDialog'); var form = document.createElement('form'); form.on('submit', function(event) { event.preventDefault(); closeModal($J('#' + dialogId), true); eRC_Dialogs.getFormat(callback, eRC_Dialogs.getRadioFormat(dialogId)); }); form.appendChild(formatDiv); if(formats.length > eRC_Dialogs.shownFormatCount) { form.appendChild(eRC_Dialogs.buildExpanderHandle(dialogId)); } dialog.appendChild(form); var dlgButtonDiv = document.createElement('div'); dlgButtonDiv.setAttribute('class', 'ercDialogButtonsDiv buttonSection'); var buttonValue = isPreview ? 'Preview' : (ercItem.drm ? 'Check Out' : 'Download'); dlgButtonDiv.appendChild(eRC_Dialogs.buildPrimaryButton('submit', buttonValue, dialogId + '_okButton')); dlgButtonDiv.appendChild(eRC_Dialogs.buildCancelButton(dialogId)); form.appendChild(dlgButtonDiv); document.body.appendChild(dialog); var title = isPreview ? 'Preview Options' : (ercItem.drm ? 'Checkout Options' : 'Download Options'); openModal($J(dialog), title, { autoOpen: false, resizable: false, appendTo: null, allowAutofocus: true, keepAlive: true, close: function() { if(eRC_DownloadButton.reloadNeeded) { window.location.reload(); }} }, true); return dialog; }, buildFormatDiv:function(dialogId, formats, resultId, isPreview) { var formatDivId = eRC_Dialogs.makeId(dialogId, eRC_Dialogs.formatDivId); var formatDiv = document.createElement('div'); formatDiv.setAttribute('id', formatDivId); formatDiv.setAttribute('class', 'fieldSection'); for(var i = 0; i < formats.length; i++) { var radioValue = (isPreview ? 'prev:' : 'down:') + resultId + ':' + formats[i].key; var isDisabled = formats[i].totalCopies && !formats[i].availableCopies; var labelText = formats[i].name; if(formats[i].description) { labelText += ' - ' + formats[i].description; } if (!com_sirsi_ent_page.isMobile) { if (i > 0) { var hRule = document.createElement('hr'); var hrClass = 'ercFormatSep'; if (i >= eRC_Dialogs.shownFormatCount) { hrClass += ' hidden'; } hRule.setAttribute('class', hrClass); formatDiv.appendChild(hRule); } } formatDiv.appendChild(eRC_Dialogs.buildRadioButton(dialogId, radioValue, labelText, isDisabled, i)); } return formatDiv; }, //hold dialog functions findHoldDialog:function(callback, resultId, ercItem, responseJson) { if(!ercItem) { eRC_Dialogs.openErrorMessageDialog(callback, eRC_Dialogs.makeError('Error! Missing or malformed eResource Central item data')); return; } var dialogId = eRC_Dialogs.makeId(eRC_Dialogs.holdDialogClass, resultId); var holdDialog = document.getElementById(dialogId); if(!holdDialog) { // We didn't find one, build it. eRC_Dialogs.showLoad(); holdDialog = eRC_Dialogs.buildHoldDialog(dialogId, ercItem, resultId, responseJson); } $J(holdDialog).find('.emailError').remove(); holdDialog.setAttribute('value',''); // Ensure an empty value until one is selected. $J(holdDialog).unbind('dialogclose').bind('dialogclose', function(event) { callback($J(holdDialog).val(), $J(holdDialog).find('input[id$=_autoCheckoutInput]').is(':checked')); }); eRC_Dialogs.hideLoad(); $J(holdDialog).dialog('open'); }, //responseJson could be the accounts call from erc or the email response, it's a bit overloaded buildHoldDialog:function(dialogId, ercItem, resultId, responseJson) { var dialog = document.createElement('div'); dialog.setAttribute('value',''); // Ensure an empty value until one is selected. dialog.setAttribute('id', dialogId); dialog.setAttribute('class', (eRC_Dialogs.holdDialogClass)+' ercDialog'); var holdDiv; if (com_sirsi_ent_page.isMobile) { eRC_Dialogs.addMobileHoldDiv(dialog, dialogId, ercItem, resultId, responseJson); } else { holdDiv = eRC_Dialogs.buildHoldDiv(dialogId, ercItem, resultId, responseJson); dialog.appendChild(holdDiv); } var makeableAccounts = []; if(responseJson.accountType) { for(var i = 0; i < responseJson.accountType.length; i++) { // JSON.parse(JSON.stringify(obj)) appears to be the fastest way to DEEP-copy an object // (see: http://jsperf.com/cloning-an-object/2) var account = JSON.parse(JSON.stringify(responseJson.accountType[i])); if(account.externalAccountUrl) { makeableAccounts.push(account); } } } var buttonHolder = document.createElement('div'); buttonHolder.setAttribute('class', 'ercDialogButtonsDiv buttonSection'); var buttonOnClick = 'javascript:$J(\'#' + dialogId + '\').val(eRC_Dialogs.getEmailHold(\'' + dialogId + '\',\'' + ercItem.id + '\')); if ($J(\'#' + dialogId + '\').val()) { closeModal($J(\'#' + dialogId + '\')); }'; buttonHolder.appendChild(eRC_Dialogs.buildPrimaryButton('button', 'Place Hold', dialogId + '_okButton', buttonOnClick)); dialog.appendChild(buttonHolder); if (com_sirsi_ent_page.isMobile) { buttonHolder.appendChild(eRC_Dialogs.buildCancelButton(dialogId)); var accountHolder = document.createElement('div') accountHolder.setAttribute('class', 'linkSection'); eRC_Dialogs.addAccountButtons(makeableAccounts, accountHolder, dialogId); dialog.appendChild(accountHolder); } else { eRC_Dialogs.addAccountButtons(makeableAccounts, buttonHolder, dialogId); buttonHolder.appendChild(eRC_Dialogs.buildCancelButton(dialogId)); } document.body.appendChild(dialog); openModal($J(dialog), 'Hold Options', {autoOpen: false, width: 'auto', resizable: false, appendTo: null, allowAutofocus: true, keepAlive: true}, true); return dialog; }, buildHoldDiv:function(dialogId, ercItem, resultId, responseJson) { var holdDivId = eRC_Dialogs.makeId(dialogId, eRC_Dialogs.holdDivId); var holdDiv = document.createElement('div'); holdDiv.setAttribute('id', holdDivId); var title = $J('#'+resultId+'_TITLE > .TITLE_value:first').text(); var format = $J('#'+resultId+'_FORMAT > .FORMAT_value').text(); var tbl = document.createElement('table'); tbl.setAttribute('id','holdTable'); tbl.setAttribute('class','holdsTable'); var thead = document.createElement('thead'); var tr = document.createElement('tr'); var th = document.createElement('th'); th.setAttribute('class','titleColumn'); var titleLabel = document.createTextNode('Title'); th.appendChild(titleLabel); tr.appendChild(th); th = document.createElement('th'); var formatLabel = document.createTextNode('Format'); th.appendChild(formatLabel); tr.appendChild(th); if (eRC_Dialogs.holdNeedsEmail) { th = document.createElement('th'); var emailLabel = document.createTextNode('Email Address'); th.appendChild(emailLabel); tr.appendChild(th); } if(ercItem['autoCheckoutSupported']) { th = document.createElement('th'); var autoCheckoutColumnLabel = document.createTextNode('Automatic Checkout'); th.appendChild(autoCheckoutColumnLabel); tr.appendChild(th); } thead.appendChild(tr); var tbody = document.createElement('tbody'); var tr1 = document.createElement('tr'); tr1.setAttribute('height','40'); tr1.setAttribute('valign','top'); var td = document.createElement('td'); td.setAttribute('class','titleCell'); var titleText = document.createTextNode(title); td.appendChild(titleText); tr1.appendChild(td); td = document.createElement('td'); td.setAttribute('class','formatCell'); var formatText = document.createTextNode(format); td.appendChild(formatText); tr1.appendChild(td); if (eRC_Dialogs.holdNeedsEmail) { td = document.createElement('td'); td.setAttribute('class','emailCell'); var emailInput = document.createElement("input"); emailInput.setAttribute('type','text'); emailInput.setAttribute('name','emailInput'); emailInput.setAttribute('class',dialogId+'_emailInput'); emailInput.setAttribute('size',30); if(responseJson.email) { emailInput.setAttribute('value', responseJson.email); } td.appendChild(emailInput); tr1.appendChild(td); } if(ercItem['autoCheckoutSupported']) { td = document.createElement('td'); td.setAttribute('class','autoCheckoutCell'); var autoCheckoutDiv = document.createElement('div'); var autoCheckoutInput = document.createElement("input"); autoCheckoutInput.setAttribute('type','checkbox'); autoCheckoutInput.setAttribute('name','autoCheckoutInput'); autoCheckoutInput.setAttribute('class',dialogId+'_autoCheckoutInput'); autoCheckoutInput.setAttribute('id',holdDivId+'_autoCheckoutInput'); autoCheckoutInput.setAttribute('size',30); autoCheckoutDiv.appendChild(autoCheckoutInput); var autoCheckoutLabel = document.createElement("label"); autoCheckoutLabel.setAttribute('for', holdDivId+'_autoCheckoutInput'); autoCheckoutLabel.setAttribute('class', 'cbLabel'); autoCheckoutLabel.innerText = "Automatically check out item when available"; autoCheckoutDiv.appendChild(autoCheckoutLabel); td.appendChild(autoCheckoutDiv); tr1.appendChild(td); } tbody.appendChild(tr1); tbl.appendChild(thead); tbl.appendChild(tbody); holdDiv.appendChild(tbl); return holdDiv; }, addMobileHoldDiv:function(dialog, dialogId, ercItem, resultId, responseJson) { var holdDivId = eRC_Dialogs.makeId(dialogId, eRC_Dialogs.holdDivId); var holdDiv = document.createElement('div'); holdDiv.setAttribute('id', holdDivId); holdDiv.setAttribute('class', 'holdsDiv'); var fieldList = document.createElement('div'); fieldList.setAttribute('class', 'fieldSection fieldList'); var title = $J('#'+resultId+'_TITLE > .TITLE_value:first').text(); var format = $J('#'+resultId+'_FORMAT > .FORMAT_value').text(); var titleFieldSection = document.createElement('div'); titleFieldSection.setAttribute('class','field'); var titleLabelDiv = document.createElement('div'); titleLabelDiv.setAttribute('class','label text-h5'); var titleLabel = document.createTextNode('Title'); titleLabelDiv.appendChild(titleLabel); titleFieldSection.appendChild(titleLabelDiv); var titleDiv = document.createElement('div'); titleDiv.setAttribute('class','fieldValue text-p'); var titleValue = document.createTextNode(title); titleDiv.appendChild(titleValue); titleFieldSection.appendChild(titleDiv); var formatFieldSection = document.createElement('div'); formatFieldSection.setAttribute('class','field'); var formatLabelDiv = document.createElement('div'); formatLabelDiv.setAttribute('class','label text-h5'); var formatLabel = document.createTextNode('Format'); formatLabelDiv.appendChild(formatLabel); formatFieldSection.appendChild(formatLabelDiv); var formatField = document.createElement('div'); formatField.setAttribute('class','fieldValue text-p'); var formatValue = document.createTextNode(format); formatField.appendChild(formatValue); formatFieldSection.appendChild(formatField); if (eRC_Dialogs.holdNeedsEmail) { var emailFieldSection = document.createElement('div'); emailFieldSection.setAttribute('class','fieldSection'); emailFieldSection.appendChild(eRC_Dialogs.buildLabel('Email Address', '')); var emailInput = document.createElement("input"); if(responseJson.email) { emailInput.setAttribute('value', responseJson.email); } emailInput.setAttribute('class', dialogId + '_emailInput fullwidth textbox'); emailFieldSection.appendChild(emailInput); } if(ercItem['autoCheckoutSupported']) { var autoCheckoutFieldSection = document.createElement('div'); autoCheckoutFieldSection.setAttribute('class','table fieldSection fullwidth'); var autoCheckoutDiv = document.createElement('div'); autoCheckoutDiv.setAttribute('class','checkbox-align'); var autoCheckoutInput = document.createElement("input"); autoCheckoutInput.setAttribute('type', 'checkbox'); autoCheckoutInput.setAttribute('name', 'autoCheckoutInput'); autoCheckoutInput.setAttribute('class', dialogId + '_autoCheckoutInput checkbox'); autoCheckoutInput.setAttribute('id', holdDivId + '_autoCheckoutInput'); var autoCheckoutLabel = document.createElement("label"); autoCheckoutLabel.setAttribute('for', holdDivId + '_autoCheckoutInput'); autoCheckoutLabel.setAttribute('class', 'label text-p checkbox-align'); autoCheckoutLabel.innerText = "Automatically check out item when available"; autoCheckoutDiv.appendChild(autoCheckoutInput); autoCheckoutFieldSection.appendChild(autoCheckoutDiv); autoCheckoutFieldSection.appendChild(autoCheckoutLabel); } fieldList.appendChild(titleFieldSection); fieldList.appendChild(formatFieldSection); holdDiv.appendChild(fieldList); dialog.appendChild(holdDiv); if (emailFieldSection) { dialog.appendChild(emailFieldSection); } if (autoCheckoutFieldSection) { dialog.appendChild(autoCheckoutFieldSection); } }, getEmailHold:function(dialogId,id) { if (!eRC_Dialogs.holdNeedsEmail) { return "@"; // This isn't a valid email address but that's okay, because we won't really use it } var dialog = $J('#' + dialogId); var emailField = dialog.find('.' + dialogId + '_emailInput'); var email = emailField.val().trim(); var regex = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/; if (regex.test(email) === true) { if (com_sirsi_ent_page.isMobile) { dialog.find('.errorSection').remove(); } return email; } else { if (dialog.find('.emailError').length === 0) { if (com_sirsi_ent_page.isMobile) { $J('#'+eRC_Dialogs.makeId(dialogId, eRC_Dialogs.holdDivId)).before(buildErrorDisplay(['Email addresses must match the pattern user@domain.extension'],'emailError')); } else { var span = document.createElement("span"); span.setAttribute('class','emailError'); $J('#'+eRC_Dialogs.makeId(dialogId, eRC_Dialogs.holdDivId)).before(span); $J('.emailError').text('Email addresses must match the pattern user@domain.extension'); } } return ""; } }, buildExpanderHandle:function(dialogId) { var expanderId = dialogId+'_expander'; var more = document.createElement('div'); more.setAttribute('id', expanderId); more.setAttribute('class', 'ercFormatExpander fieldSection'); more.setAttribute('onclick', '$J(\'#' + eRC_Dialogs.makeId(dialogId, eRC_Dialogs.formatDivClass) + ' .hidden\').each(function() { $J(this).removeClass("hidden"); }); $J(\'#' + expanderId + '\').hide();'); more.innerHTML = ''; return more; }, getRadioFormat:function(dialogId) { var key; $J('#'+dialogId+' .'+eRC_Dialogs.radioClass).each(function() { if(this.checked) { key = $J(this).val(); } }); return key; }, getFormat:function(callback, key) { var type = key.substring(0, key.indexOf(':')); key = key.substring(key.indexOf(':')+1); var resultId = key.substring(0, key.indexOf(':')); var formatKey = key.substring(key.indexOf(':')+1); eRC_Base.getTitleData(function(ercItem) { if(ercItem) { var formats = (type == 'prev') ? ercItem.previews : ercItem.formats; for(var i = 0; i < formats.length; i++) { if(formats[i].key == formatKey) { callback(formats[i], ercItem.drm); return; } } } callback(); }, resultId); }, //accounts dialog functions getSpecificAccountInputsClass:function(baseId) { return eRC_Dialogs.accountInputClass + baseId; }, findAccountsDialog:function(callback, resultId, format, responseJson, duration) { if(responseJson && responseJson.error) { eRC_Dialogs.openErrorMessageDialog(callback, responseJson); return; } if(!(responseJson && responseJson.accountType && responseJson.accountType.length > 0)) { eRC_Dialogs.openErrorMessageDialog(callback, eRC_Dialogs.makeError('Error! Missing or malformed response for eResource Central getAccounts call')); return; } var baseId = format.key+resultId; var dialogId = eRC_Dialogs.accountDialogClass + baseId; var accountDialog = document.getElementById(dialogId); if(!accountDialog) { // We didn't find one, build it. eRC_Dialogs.showLoad(); accountDialog = eRC_Dialogs.buildAccountDialog(baseId, dialogId, format, responseJson, duration); } if (!com_sirsi_ent_page.isMobile) { for (var i = 0; i < responseJson.accountType.length; i++) { eRC_Dialogs.fillAccountSelectionOptions(baseId, responseJson.accountType[i]); } } // Clear this value (it will be set upon form validation). accountDialog.removeAttribute('value'); $J('.'+eRC_Dialogs.accountErrorDiv).hide(); eRC_Dialogs.hideLoad(); var dialogOptions = { autoOpen: true, resizable: false, appendTo: null, close: function(event) { callback(accountDialog.getAttribute('value')); }, keepAlive: true, allowAutofocus: true } openModal($J(accountDialog), 'Checkout', dialogOptions, true); }, // you can get to this dialog by downloading RBdigital (Record a books, which is part of one click digital) buildAccountDialog:function(baseId, dialogId, format, responseJson, duration) { var errorDiv = document.createElement('div'); errorDiv.setAttribute('id', eRC_Dialogs.accountErrorDiv + baseId); errorDiv.setAttribute('class', eRC_Dialogs.accountErrorDiv); errorDiv.setAttribute('style', 'display: none;'); errorDiv.innerHTML = 'Error! The following fields are either missing or invalid.'; var formId = eRC_Dialogs.accountFormClass + baseId; var form = document.createElement('form'); form.setAttribute('id', formId); form.setAttribute('class', eRC_Dialogs.accountFormClass); form.setAttribute('onsubmit', 'javascript: eRC_Dialogs.handleAccountFormSubmit(\'' + baseId + '\', \'' + format.url + '\'); return false;'); var makeableAccounts = []; for(var i = 0; i < responseJson.accountType.length; i++) { // JSON.parse(JSON.stringify(obj)) appears to be the fastest way to DEEP-copy an object // (see: http://jsperf.com/cloning-an-object/2) var account = JSON.parse(JSON.stringify(responseJson.accountType[i])); if(format.authentication.ereaderAccount === account.key) { account.type = 'ereaderAccount'; } if(format.authentication.partnerAccount === account.key) { account.type = 'partnerAccount'; } if(!account.type) { return null; } if(account.externalAccountUrl) { makeableAccounts.push(account); } var accountDiv = eRC_Dialogs.buildAccountDiv(baseId, account); if(accountDiv) { form.appendChild(accountDiv); } } var slider = eRC_Dialogs.buildDurationSelector(baseId, duration); if(slider) { form.appendChild(slider); } var buttonHolder = document.createElement('div'); buttonHolder.setAttribute('class', 'ercDialogButtonsDiv buttonSection'); buttonHolder.appendChild(eRC_Dialogs.buildPrimaryButton('submit', 'Check Out')); form.appendChild(buttonHolder); if (com_sirsi_ent_page.isMobile) { buttonHolder.appendChild(eRC_Dialogs.buildCancelButton(dialogId)); var accountHolder = document.createElement('div') accountHolder.setAttribute('class', 'linkSection'); eRC_Dialogs.addAccountButtons(makeableAccounts, accountHolder, dialogId); form.appendChild(accountHolder); } else { eRC_Dialogs.addAccountButtons(makeableAccounts, buttonHolder, dialogId); } var accountDialog = document.createElement('div'); accountDialog.setAttribute('id', dialogId); accountDialog.setAttribute('class', eRC_Dialogs.accountDialogClass+' ercDialog'); accountDialog.appendChild(errorDiv); accountDialog.appendChild(form); document.body.appendChild(accountDialog); if (!com_sirsi_ent_page.isMobile) { // UI/UX recommended having a default for the selector, so leaving this for nonmobile $J('#' + formId + ' select').each(function () { this.selectedIndex = -1 }); } $J('#' + eRC_Dialogs.accountErrorDiv + baseId).hide(); return accountDialog; }, buildAccountDiv:function(baseId, account) { if(!(account && account.key)) { return null; } // we're going to be using this, set it up com_sirsi_ent_strings.setStringFormatFunc_JavaStyle(); var accountId = eRC_Dialogs.makeId(baseId, account.key); var accountDiv = document.createElement('div'); accountDiv.setAttribute('id', eRC_Dialogs.accountDivClass+accountId); accountDiv.setAttribute('class', eRC_Dialogs.accountDivClass + ' fieldSection'); var heading = document.createElement('h3'); heading.setAttribute('class', 'ercAcctDialogHeading headerField'); heading.innerHTML = String.format('Enter %s Account', account.name); accountDiv.appendChild(heading); var inputId = eRC_Dialogs.accountInputClass + accountId; var comboDiv = document.createElement('div'); var comboInput = document.createElement('input'); comboInput.setAttribute('id', inputId); comboInput.setAttribute('type', 'text'); comboInput.setAttribute('name', account.type); comboInput.setAttribute('autocomplete', 'off'); if (com_sirsi_ent_page.isMobile) { comboDiv.setAttribute('class', 'fieldSection'); var labelText = 'Username:'; if (labelText.indexOf(':') > 0) { labelText = labelText.substr(0, labelText.indexOf(':')) } comboDiv.appendChild(eRC_Dialogs.buildLabel(labelText, inputId)); comboInput.setAttribute('class', 'ercAccountSelectInput textbox fullwidth'); } else { accountDiv.appendChild(eRC_Dialogs.buildLabel('Username:', inputId)); comboInput.setAttribute('class', 'ercAccountSelectInput ' + eRC_Dialogs.getSpecificAccountInputsClass(baseId)); var selectId = eRC_Dialogs.accountSelectClass + accountId; var comboSelect = document.createElement('select'); comboSelect.setAttribute('id', selectId); comboSelect.setAttribute('tabindex', -1); comboSelect.setAttribute('class', eRC_Dialogs.accountSelectClass); comboSelect.setAttribute('onchange', 'javascript:document.getElementById(\'' + inputId + '\').value=document.getElementById(\'' + selectId + '\').value;'); $J(comboInput).keyup(function(e){ if(e && e.keyCode == 40) { $J(comboSelect).focus().click(); } comboSelect.selectedIndex = -1; }); comboDiv.appendChild(comboSelect); } comboDiv.appendChild(comboInput); accountDiv.appendChild(comboDiv); // provide a required password field, but only if actually required if (true === account.passwordRequired) { var passwordFieldId = 'ercAccountPasswordField' + accountId; var fieldHolder; var inputClass; if (com_sirsi_ent_page.isMobile) { fieldHolder = document.createElement('div'); fieldHolder.setAttribute('class', 'fieldSection'); accountDiv.appendChild(fieldHolder); } else { fieldHolder = accountDiv; } fieldHolder.appendChild(eRC_Dialogs.buildLabel('Password:', passwordFieldId)); var passwordField = document.createElement('input'); passwordField.setAttribute('type', 'password'); passwordField.setAttribute('id', passwordFieldId); passwordField.setAttribute('class', eRC_Dialogs.accountInputClass + ' textbox fullwidth ' + eRC_Dialogs.getSpecificAccountInputsClass(baseId)); passwordField.setAttribute('name', account.type + 'Pw'); fieldHolder.appendChild(passwordField); } // we're done using this, revert com_sirsi_ent_strings.resetString_dot_format(); return accountDiv; }, buildDurationSelector:function(baseId, duration) { if(!(duration && duration.maxCheckout)) { return null; } var defaultDays = duration.defaultCheckout ? duration.defaultCheckout : duration.maxCheckout; var durationId = eRC_Dialogs.makeId(eRC_Dialogs.durationId, baseId); var label = document.createElement('div'); var checkoutClass = 'ercCheckoutDiv'; if (com_sirsi_ent_page.isMobile) { checkoutClass += ' fieldSection'; if(duration.maxCheckout === duration.minCheckout) { label.setAttribute('class', 'label text-h5'); checkoutClass += ' field'; } else { label.setAttribute('class', 'label text-p'); } var labelText = 'Checkout duration:'; if (labelText.indexOf(':') > 0) { labelText = labelText.substr(0, labelText.indexOf(':')) } labelText += ' (day(s))'; label.innerHTML = labelText; } else { label.setAttribute('class', 'ercCheckoutLabel'); label.innerHTML = 'Checkout duration:'; } var checkout = document.createElement('div'); checkout.setAttribute('id', 'ercCheckout_' + baseId); checkout.setAttribute('class', checkoutClass); checkout.appendChild(label); var currentDays = document.createElement('span'); currentDays.setAttribute('id', durationId); currentDays.innerHTML = defaultDays; var selection = document.createElement('div'); if (com_sirsi_ent_page.isMobile) { selection.setAttribute('class', 'fieldValue text-p'); } else { selection.setAttribute('class', 'ercCheckoutSelection'); } selection.innerHTML = ' day(s)'; selection.insertBefore(currentDays, selection.childNodes[0]); if(duration.maxCheckout === duration.minCheckout) { checkout.appendChild(selection); } else { if (com_sirsi_ent_page.isMobile) { // non mobile slider is not mobile friendly, make a dropdown var min = duration.minCheckout ? duration.minCheckout : 1; var selectorId = 'ercSelector_' + baseId; var selector = document.createElement('select'); selector.setAttribute('id', selectorId); selector.setAttribute('blankOption', 'NEVER'); selector.setAttribute('class', 'checkoutTimeSelector dropDown fullwidth'); for (var i = duration.minCheckout; i <= duration.maxCheckout; i++) { var option = document.createElement('option'); option.setAttribute('value', i); if (i == duration.minCheckout) { option.setAttribute('selected', 'true'); option.selected } option.innerHTML = i; selector.appendChild(option); } selector.setAttribute('value', duration.minCheckout); checkout.appendChild(selector); var iArrow = document.createElement('i'); iArrow.setAttribute('class', 'fa fa-caret-down select-arrow'); iArrow.setAttribute('aria-hidden', 'true'); checkout.appendChild(iArrow); } else { // original non mobile slider var min = duration.minCheckout ? duration.minCheckout : 1; var minSpan = document.createElement('span'); minSpan.setAttribute('class', 'ercMinDays'); minSpan.innerHTML = min; var maxSpan = document.createElement('span'); maxSpan.setAttribute('class', 'ercMaxDays'); maxSpan.innerHTML = duration.maxCheckout; var selectorId = 'ercSelector_' + baseId; var selector = document.createElement('div'); selector.setAttribute('id', selectorId); selector.setAttribute('class', 'checkoutTimeSelector'); var slider = document.createElement('div'); slider.setAttribute('class', 'ercCheckoutSlider'); slider.appendChild(minSpan); slider.appendChild(maxSpan); slider.appendChild(selector); slider.appendChild(selection); checkout.appendChild(slider); $J(selector).slider({ min:min, max:duration.maxCheckout, value:defaultDays, slide: function( event, ui ) { document.getElementById(durationId).innerHTML = ui.value; } }); } } return checkout; }, buildPrimaryButton: function(inputType, buttonLabel, buttonId, buttonClick) { var primaryButton = document.createElement('input'); primaryButton.setAttribute('type', inputType); primaryButton.setAttribute('value', buttonLabel); if (com_sirsi_ent_page.isMobile) { primaryButton.setAttribute('class', 'button fullwidth'); } else { primaryButton.setAttribute('class', eRC_Dialogs.primaryButtonClass + ' ' + eRC_Dialogs.dialogButtonClass); } if(buttonId) { primaryButton.setAttribute('id', buttonId); } if(buttonClick) { primaryButton.setAttribute('onclick', buttonClick); } return primaryButton; }, buildCancelButton: function(dialogId) { var cancelButton = document.createElement('input'); cancelButton.setAttribute('type', 'button'); cancelButton.setAttribute('id', dialogId + '_cancelButton'); cancelButton.setAttribute('onclick', 'javascript:closeModal($J(\'#' + dialogId + '\'));$J(".errorSection").remove();'); cancelButton.setAttribute('value', 'Cancel'); if (com_sirsi_ent_page.isMobile) { cancelButton.setAttribute('class', 'button fullwidth cancel'); } else { cancelButton.setAttribute('class', eRC_Dialogs.secondaryButtonClass + ' ' + eRC_Dialogs.dialogButtonClass); } return cancelButton; }, buildLabel: function(labelText, labelFor) { var labelElement = document.createElement('label'); labelElement.innerHTML = labelText; if(labelFor) { labelElement.setAttribute('for', labelFor); } if (com_sirsi_ent_page.isMobile) { var labelHolder = document.createElement('div'); labelHolder.setAttribute('class', 'label text-p'); labelHolder.appendChild(labelElement); return labelHolder; } else { labelElement.setAttribute('class', eRC_Dialogs.accountLabelClass); return labelElement; } }, buildRadioButton: function(dialogId, radioValue, labelText, isDisabled, radioIndex) { var radioId = eRC_Dialogs.makeId(eRC_Dialogs.radioClass, eRC_Dialogs.makeId(dialogId, radioIndex)); var radio = document.createElement('input'); radio.setAttribute('type', 'radio'); radio.setAttribute('name', eRC_Dialogs.makeId(eRC_Dialogs.radioName, dialogId)); radio.setAttribute('id', radioId); radio.setAttribute('class', eRC_Dialogs.radioClass + ' v-middle radio'); radio.setAttribute('value', radioValue); if(radioIndex === 0) { radio.setAttribute('checked', 'checked'); } if(isDisabled) { radio.setAttribute('disabled', 'disabled'); } var label = document.createElement('label'); label.setAttribute('for', radioId); label.innerHTML = labelText; var radioRowClass = eRC_Dialogs.formatDivClass + ' ' + eRC_Dialogs.makeId(dialogId, eRC_Dialogs.formatDivClass); if(radioIndex >= eRC_Dialogs.shownFormatCount) { radioRowClass += ' hidden'; } var radioHolder; if (com_sirsi_ent_page.isMobile) { label.setAttribute('class', 'text-p label checkbox-align'); radioRowClass += ' radioRow table fullwidth'; radioHolder = document.createElement('div'); radioHolder.setAttribute('class', 'checkbox-align'); radioHolder.appendChild(radio); } else { var labelClass = 'ercRadioLabel'; if(isDisabled) { labelClass += ' disabledLabel'; } label.setAttribute('class', labelClass); radioHolder = radio; } var radioRow = document.createElement('div'); radioRow.setAttribute('id', eRC_Dialogs.makeId(eRC_Dialogs.formatRadioId, eRC_Dialogs.makeId(dialogId, radioIndex))); radioRow.setAttribute('class', radioRowClass); radioRow.appendChild(radioHolder); radioRow.appendChild(label); return radioRow; }, //this function builds buttons (and a link) and add to the div based on the accounts passed in addAccountButtons:function(accounts, parentElement, dialogId) { // we're going to be using this, set it up com_sirsi_ent_strings.setStringFormatFunc_JavaStyle(); if (com_sirsi_ent_page.isMobile) { for (var i = 0; i < accounts.length; i++) { var linkDiv = document.createElement('div'); linkDiv.setAttribute('class', 'linkWrapper'); var onClickText = 'javascript: safeWindowOpen("' + accounts[i].externalAccountUrl + '", "_blank"); return false;'; var accountLink = document.createElement('a'); accountLink.setAttribute('href', "#"); accountLink.setAttribute('onclick', onClickText); accountLink.innerHTML = String.format('Create %s Account', accounts[i].name); linkDiv.appendChild(accountLink); parentElement.appendChild(linkDiv); } } else { // leave non mobile as is for (var i = 0; i < accounts.length; i++) { var onClickText = 'javascript: safeWindowOpen("' + accounts[i].externalAccountUrl + '", "_blank"); return false;'; var newButton = document.createElement('button'); newButton.setAttribute('class', eRC_Dialogs.secondaryButtonClass + ' ' + eRC_Dialogs.dialogButtonClass); newButton.setAttribute('onclick', onClickText); newButton.innerHTML = String.format('Create %s Account', accounts[i].name); parentElement.appendChild(newButton); } } // we're done using this, revert com_sirsi_ent_strings.resetString_dot_format(); }, fillAccountSelectionOptions:function(baseId, account) { var accountId = eRC_Dialogs.makeId(baseId, account.key); var comboSelect = document.getElementById(eRC_Dialogs.accountSelectClass+accountId); while (comboSelect.hasChildNodes()) { comboSelect.removeChild(comboSelect.lastChild); } for (var i = 0; i < account.account.length; i++) { var acct = account.account[i]; var option = document.createElement('option'); option.setAttribute('value', acct.id); if(acct.isDefault) { document.getElementById(eRC_Dialogs.accountInputClass+accountId).value = acct.id; } option.innerHTML = acct.id; comboSelect.appendChild(option); } comboSelect.selectedIndex = -1; $J('#'+eRC_Dialogs.accountDivClass+accountId+' input').first().select(); }, handleAccountFormSubmit:function(baseId, formatUrl) { var data = formatUrl + '?'; var proceed = true; // looking for input that starts with input class because tapestry puts random junk on the end. $J('input[id^="'+eRC_Dialogs.accountInputClass+'"]').each(function() { var value = this.value; if(value){ data += this.getAttribute('name') + '=' + value + '&'; } else { $J('#' + eRC_Dialogs.accountErrorDiv + baseId).show(); proceed = false; } }); if(proceed) { var duration = document.getElementById(eRC_Dialogs.makeId(eRC_Dialogs.durationId, baseId)); if(duration && duration.innerHTML) { data += 'duration=' + duration.innerHTML + '&'; } document.getElementById(eRC_Dialogs.accountDialogClass+baseId).setAttribute('value',data.substring(0, data.length - 1)); closeModal($J('#' + eRC_Dialogs.accountDialogClass + baseId)); } }, //API functions openFormatDialog:function(callback, resultId, isPreview) { if(!(resultId && 'function' === typeof callback)) { eRC_Dialogs.openErrorMessageDialog(callback, eRC_Dialogs.makeError('Error! Function call made with one or more invalid parameters: "callback", "resultId"')); return; } if(eRC_DownloadButton.reloadNeeded) { closeModal($J('#loginModal')); } var ercChildInfo = eRC_Dialogs.getErcChildInfo(resultId); if (ercChildInfo) { eRC_Dialogs.findFormatDialog(callback, resultId, ercChildInfo, isPreview); } else { eRC_Base.getTitleData(function(ercItem) { if (ercItem) { eRC_Dialogs.findFormatDialog(callback, resultId, ercItem, isPreview); } }, resultId); } }, getErcChildInfo:function(hitlistOrDetailResultId) { var resultId = hitlistOrDetailResultId.replace('detail', ''); // Don't replace hitlist, because we only want to use child info for detail actions. if (typeof ErcChildRecordRiver != 'undefined' && ErcChildRecordRiver.titleChildInfo && ErcChildRecordRiver.titleChildInfo[resultId]) { // Get active child index from the appropriate carousel for this result. var activeChildId = $J('#jsChildCarousel_' + resultId).find('.erc_child_image_div.active').attr('id'); if (activeChildId) { var childIndex = activeChildId.substring(activeChildId.lastIndexOf('_') + 1); var childData = ErcChildRecordRiver.titleChildInfo[resultId]; if(typeof childData != 'undefined' && childData) { return childData.children[childIndex]; } } } return null; }, openHoldDialog:function(callback, resultId) { if(!(resultId && 'function' === typeof callback)) { eRC_Dialogs.openErrorMessageDialog(callback, eRC_Dialogs.makeError('Error! Function call made with one or more invalid parameters: "callback", "resultId"')); return; } eRC_Dialogs.showLoad(); eRC_Base.getTitleData(function(ercItem) { eRC_Dialogs.openEmailDialog(callback, resultId, ercItem); }, resultId); }, openEmailDialog:function(callback, resultId, ercItem) { if(!(resultId && 'function' === typeof callback)) { eRC_Dialogs.openErrorMessageDialog(callback, eRC_Dialogs.makeError('Error! Function call made with one or more invalid parameters: "callback", "resultId"')); return; } // TODO Replace these when eRC adds in a flag to the availability response to tell us when the vendor needs an email address. eRC_Dialogs.holdNeedsEmail = ercItem.id.indexOf("OVERDRIVE") === 0 || ercItem.id.indexOf("BAKER_TAYLOR") === 0 || ercItem.id.indexOf("CANTOOKSTATION") === 0; if (eRC_Dialogs.holdNeedsEmail) { eRC_Base.getHoldEmail(function(responseJson) { eRC_Dialogs.findHoldDialog(callback, resultId, ercItem, responseJson); }, resultId); } else { var auth = ercItem.formats[0].authentication; //I'm using the first format here, as there's no format selection for holds if(auth.accountsUrl) { eRC_Base.getAccountsResponse(function(responseJson) { eRC_Dialogs.findHoldDialog(callback, resultId, ercItem, responseJson); }, auth.accountsUrl); } else { eRC_Dialogs.findHoldDialog(callback, resultId, ercItem, {}); } } }, openAccountDialog:function(callback, resultId, format, duration) { // the patron MUST be logged in for this function to work var isValidFormat = format && format.key && format.url && format.authentication; if(!(resultId && isValidFormat && 'function' === typeof callback)) { eRC_Dialogs.openErrorMessageDialog(callback, eRC_Dialogs.makeError('Error! Function call made with one or more invalid parameters: "callback", "resultId", "format"')); return; } var auth = format.authentication; if(!(auth.partnerAccount || auth.ereaderAccount)) { // No more authentication needed, make it happen! callback(format.url); return; } if(!(auth.accountsUrl)) { eRC_Dialogs.openErrorMessageDialog(callback, eRC_Dialogs.makeError('Error! Missing eResource Central getAccounts URL')); return; } eRC_Dialogs.showLoad(); eRC_Base.getAccountsResponse(function(responseJson) { eRC_Dialogs.findAccountsDialog(callback, resultId, format, responseJson, duration); }, auth.accountsUrl); }, openMessageDialog: function(callback, resultId, messageInfo, showEReadersLink) { if(!(resultId && messageInfo && messageInfo.message)) { eRC_Dialogs.openErrorMessageDialog(callback, eRC_Dialogs.makeError('Error! Function call made with one or more invalid parameters: "resultId", "messageInfo"')); return; } eRC_Dialogs.closeMessageDialog(resultId); eRC_Dialogs.showLoad(); var dialogId = eRC_Dialogs.makeId(eRC_Dialogs.messageClass, resultId); var msgDialog = document.getElementById(dialogId); if(!msgDialog) { msgDialog = document.createElement('div'); msgDialog.setAttribute('id', dialogId); var closeButton = document.createElement('a'); closeButton.setAttribute('class',eRC_Dialogs.primaryButtonClass+' '+eRC_Dialogs.dialogButtonClass); closeButton.setAttribute('href', '#'); closeButton.setAttribute('onclick','javascript:eRC_Dialogs.closeMessageDialog(\'' + resultId + '\');'); closeButton.innerHTML = 'Close'; msgDialog.appendChild(closeButton); document.body.appendChild(msgDialog); } var messageId = eRC_Dialogs.makeId(eRC_Dialogs.messageClass, resultId); var message = document.getElementById(messageId); if(!message) { message = document.createElement('div'); message.setAttribute('id', messageId); message.setAttribute('class', eRC_Dialogs.messageClass); msgDialog.insertBefore(message, msgDialog.childNodes[0]); } message.innerHTML = messageInfo.message; eRC_Dialogs.hideLoad(); var title = messageInfo.title ? messageInfo.title : ''; var dialogOptions = { dialogClass:eRC_Dialogs.formatDialogClass, resizable: false, close: callback, appendTo: null, allowAutofocus: true }; openModal($J('#'+dialogId), title, dialogOptions, false); }, closeMessageDialog:function(resultId) { if(resultId) { var dialogId = '#'+eRC_Dialogs.makeId(eRC_Dialogs.messageClass, resultId); // check if initialized before trying to close if ($J(dialogId).hasClass("ui-dialog-content") && $J(dialogId).dialog("isOpen")) { $J('#' + eRC_Dialogs.makeId(eRC_Dialogs.messageClass, resultId)).dialog('close'); } } }, // All parameters are required, and response MUST have a 'error' message object! // Also, you should likely never edit this function; you've been warned. openErrorMessageDialog:function(callback, response) { if(response.error) { $J('.'+eRC_Dialogs.messageClass).each(function() { $J(this).dialog('close'); }); if (com_sirsi_ent_page.isMobile) { showMessageModal('Error', [response.error], true, function() { if('function' === typeof callback) { callback(response); } }); } else { eRC_Dialogs.openMessageDialog(function() { if('function' === typeof callback) { callback(response); } }, 'ercErrorDialog', {title:'Error', message:response.error}); } } else { if('function' === typeof callback) { callback(response); } } }, closeErrorMessageDialog:function(resultId) { eRC_Dialogs.closeMessageDialog(resultId); }, };}/***UPDATED MAR 11, 2019, fixed errant caption when in accordion mode in Safari.UPDATED NOV 8, 2018. FIXES APPLIED FOR NON-ISBN CONTENT (where unbound somehow does a load on a title with no ISBN, thus bypassing the widget)***//*Note: if a customer is in AUS/NZ, there's a different URL they should use so that they're accessing Unbound's Australia server. In the 'startSyndeticsUnbound' function, change in the following URL for the script_src variable: src: 'https://ltflau.librarything.com/syndeticsunbound/connector/initiator.php?a_id='+syndeticsUnboundAccountNumber//*Fill in the customer's Syndetics Unbound Account Id */// example setting of syndeticsUnboundAccountNumber:// var syndeticsUnboundAccountNumber = '';//; var syndeticsUnboundAccountNumber = '601'; // set Syndetics Unbound Account Id herevar syndeticsUnboundInstanceId = '959'; // set Syndetics Unbound Instance Id if using a specific Instancevar syndeticsUnboundScriptSrc = 'https://unbound.syndetics.com/syndeticsunbound/connector/initiator.php?a_id=' + syndeticsUnboundAccountNumber+'&i_id='+syndeticsUnboundInstanceId;var syndeticsUnboundEnabled = true;var RETRY_TIME_MILLISECONDS = 500; // ms between tries loading the Syndetics Unbound javascriptvar MAX_UNBOUND_RETRIES = 10; // give up after this number of tries to load Syndetics Unbound javascriptvar currentUnboundAttempt = 0;var customIsbn;var weUseUnbound=true;var globalDetail='';unboundLoaded = function() { var numEnrichments = LibraryThingConnector.numberOfEnhancementsShown(); if( numEnrichments > 0 ) {/****ODD CASES WHERE UNBOUND ADDS CONTENT ON ITS OWN (basically by-passing this widget somehow), AND GETS THE CAPTION WRONG***/ if( $J('#detail_tabs'+globalDetail).find('a:contains("Syndetics Unbound")').length>0){$J('#detail_tabs'+globalDetail).find('a:contains("Syndetics Unbound")').text("Additional info & reading suggestions");} if( $J('#detail_accordion'+globalDetail).find('h3').find('a:contains("Syndetics Unbound")').length>0){$J('#detail_accordion'+globalDetail).find('h3').find('a:contains("Syndetics Unbound")').text("Additional info & reading suggestions");} }}function customSyndeticsUnbound(detail,customIsbn){var unboundContentDivId = 'syndeticsUnboundContent'+detail; if(document.getElementById('detail'+ detail+'_ISBN').hasChildNodes()) { //if an IOS device (which should have bypassed the tabs conversion), do traditional accordionsif (isIOS()){$('detail_accordion' + detail).insert({'bottom': '

'});}else{var newTabIndex=String(parseInt($J('#detail_tabs'+detail+' > div:last').attr('id').split('-')[1])+1);//hidden class on next two lines changed to bogus 'nothidden' for now, so we can at least see if Unbound will write to these tab-based divsvar tabLiHtml='

';var tabDivHtml='

';$J('#detail_tabs'+detail + ' ul').append(tabLiHtml); $J('#detail_tabs'+detail).append(tabDivHtml);var activeIndex=$J( '#detail_tabs'+detail ).tabs( "option", "selected" );//note: the 'selected' parameter is for older jQuery UI. May need to change to 'active' if Enterprise jQueryUI upgraded beyond 1.9var activeIndex=$J( '#detail_tabs'+detail ).tabs( "option", "selected" );$J('#detail_tabs'+detail).tabs("destroy").tabs({selected: activeIndex}); //setTimeout(function(){ removeSyndetics(detail);},500);//$J('#detail_tabs'+detail).find('.cust-nov-tab, .cust-nov-tab a').removeClass('hidden');//} }//end if tabs presentdoLibraryThingConnector(customIsbn, unboundContentDivId); } //end if valid ISBN}function doLibraryThingConnector(isbn, elementName){if (typeof(LibraryThingConnector) == 'undefined'){currentUnboundAttempt++;if (currentUnboundAttempt <= MAX_UNBOUND_RETRIES){setTimeout(function (){doLibraryThingConnector(isbn, elementName); }, RETRY_TIME_MILLISECONDS);}}else{LibraryThingConnector.backend.widgets.run(isbn, document.getElementById(elementName));//CALLBACK ATTEMPT HERE?}}function startSyndeticsUnbound(detail){customIsbn = jQuery('#detail' + detail+'_ISBN').find('.ISBN_value:first').text();if (syndeticsUnboundEnabled == true){if (typeof(LibraryThingConnector) == 'undefined'){syndeticsUnboundScript = new Element('script', {type: 'text/javascript',src: syndeticsUnboundScriptSrc,success: function (removeLoadImage){}});$$('head')[0].appendChild(syndeticsUnboundScript);}}customSyndeticsUnbound(detail,customIsbn);}function sdcallback(retVal){console.log('from sdcallback, retVal is ' + retVal);}function accToTabs(detail){var numAvail=$J('#detail_accordion'+detail).find('.totalAvailable').text();var availLabel=$J('#detail_accordion'+detail).find('.availableCountLabel').text().split(':')[0];var outerTabHtml='

    ';$J('#detail_accordion'+detail).before(outerTabHtml);var liHtml='';var divHtml='';var tabText='';var fullDivHtml='';var myIndex=0;var ltflIndex=0;$J('#detail_accordion'+ detail+' h3.ui-accordion-header').each(function(index){/*some accordions seem to render empty content, like those Syndetics or On Order accordions that show a header, but no info. This attempts to prevent those from rendering at all during the switch-over to tabs*/if ($J(this).next().text().length > 0){myIndex++;tabText=$J(this).text();var divContent = $J(this).next().text();var divLength=divContent.length;liHtml='

  • ' + tabText + '
  • ';divHtml=$J(this).next().html();fullDivHtml='

    ' + divHtml + '

    ';var idString = 'tabs-'+ (index+1);$J('#detail_tabs'+ detail + ' ul').append(liHtml);$J('#detail_tabs'+ detail).append(fullDivHtml);}//end if acc length >0});//end eachif(jQuery('#detail_tabs'+ detail).text().length >0){$J('#detail_tabs' + detail).tabs();$J('#detail_accordion'+ detail).remove();/***correcting for cases where Availability gets lost due to timing. kludge alert: need to tidy this up so that 'Available' isn't assumed as the string***/$J('#detail_tabs'+detail).find('a:contains(":*")').text(availLabel+ ':'+numAvail);/*the process of copying the item table to the tabs kills the sorting capabilities of the table. The next 3 commands re-invoke the sorttable.js plug-in on the table, and prevent redundant sorting arrows from appearing*/$J('.sorttable_sortAnyInd').remove();var itemTable = document.getElementById('detailItemTable'+ detail);/*****CHECK THIS. IS THIS AN ADEQUATE CHECK FOR CASES WHERE AN AVAILABLE TAB MAY NOT BE PRESENT?***/if(itemTable){sorttable.makeSortable(itemTable);}if (weUseUnbound){ setTimeout(function(){startSyndeticsUnbound(detail)},500);}}else{$J('#detail_tabs'+ detail).remove();}}function initSynTabs(detail){var metaTag='

    ';$J('head').append(metaTag);window.go_go_gadget_sorttable();if (!isIOS()){setTimeout(function(){accToTabs(detail)},300);}else{startSyndeticsUnbound(detail);}}function isIOS(){var iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);return iOS;}function removeSyndetics(rId) { globalDetail=rId;var hitnum = rId;var detailSelector=$J('#detail_accordion' +hitnum);var summarySelector=$J(detailSelector).find('a:contains("Summary")').attr('href');$J(detailSelector).find('a:contains("Summary")').closest('h3').next().remove();$J(detailSelector).find('a:contains("Excerpts")').closest('h3').next().remove();$J(detailSelector).find('a:contains("Reviews")').closest('h3').next().remove();$J(detailSelector).find('a:contains("Table of Contents")').closest('h3').next().remove();$J(detailSelector).find('a:contains("Summary")').closest('h3').remove(); $J(detailSelector).find('a:contains("Excerpts")').closest('h3').remove(); $J(detailSelector).find('a:contains("Reviews")').closest('h3').remove(); $J(detailSelector).find('a:contains("Table of Contents")').closest('h3').remove(); initSynTabs(rId);}function startRemoveSyndetics(rId){$J(document).ready(function(){setTimeout(function(){removeSyndetics(rId);},100);});}// Important: Modifications to this file may be overwritten during an upgrade.// If you want to customize this widget and have those modifications persist through upgrades,// make a copy of this widget and make modifications to the copied widget.// You can then assign the copied widget to the detail or search result displays you want.if('undefined' === typeof eRC_PreviewButton) { eRC_PreviewButton = { ercPreviewButtonClass:'ercPreviewButton', addPreviewButtonToResult:function(resultId) { eRC_Base.getTitleData(function(data){ var hitlistOrDetail = 'detail'; if (resultId.match(/hitlist/)) { hitlistOrDetail = 'hitlist'; } var resultIndex = resultId.replace(hitlistOrDetail, ''); if(data && data.previews && data.previews.length > 0) { if (com_sirsi_ent_page.isMobile) { var ercPreviewActions = ResultActions.asyncResultActions['ERC_PREVIEW']; if (!ercPreviewActions) { ResultActions.asyncResultActions['ERC_PREVIEW'] = {}; ercPreviewActions = ResultActions.asyncResultActions['ERC_PREVIEW']; } ercPreviewActions['result' + resultIndex] = {'action': eRC_PreviewButton.getErcPreviewFormats}; // Show the preview button. ResultActions.updateResultAction('ERC_PREVIEW', 'result' + resultIndex, hitlistOrDetail, true, 'Preview'); } else { var resultNumber = resultId.match(/\d+/)[0]; if (hitlistOrDetail.match(/hitlist/)) { // add button to button column $J('#results_right' + resultId).append('

    '); } else { // add button to button column $J('#detailActions' + resultId).append('

    '); } } } else { ResultActions.updateResultAction('ERC_PREVIEW', 'result' + resultIndex, hitlistOrDetail, false); } }, resultId); }, getErcPreviewFormats:function(resultIndex, hitlistOrDetail) { var resultId = hitlistOrDetail + resultIndex; eRC_Dialogs.openFormatDialog(function(selectedFormat) { if(!selectedFormat || selectedFormat.error) { return; } var message; if('DOWNLOAD' === selectedFormat.action) { message = 'Your download will start shortly.'; window.location.assign(selectedFormat.url); } else if('REDIRECT' === selectedFormat.action) { message = 'You will be redirected to your content.'; safeWindowOpen(selectedFormat.url, '_blank'); } if(message) { if (com_sirsi_ent_page.isMobile) { showMessageModal('Preview', [message], false); } else { eRC_Dialogs.openMessageDialog(null, resultId, {message:message, title:'Preview'}); } } }, resultId, true); } };}var ercTitleCode = "INITIAL_TITLE_SRCH";var ercAuthorCode = "INITIAL_AUTHOR_SRCH";var itemsToSort = "300";var frbrFormats = { "Books": { "id": "frbr-book", "title": "Book", "code": "BOOK" }, "Audio disc": { "id": "frbr-audio-disc", "title": "Audio Disc", "code": "SOUNDREC" }, "Continuing Resources": { "id": "frbr-continuing-resources", "title": "Continuing Resources", "code": "CR" }, "Video cassette": { "id": "frbr-video-cassette", "title": "Video Cassette", "code": "VIDEOCASS" }, "Microform": { "id": "frbr-microform", "title": "Microform", "code": "MICROFORM" }, "Audio cassette": { "id": "frbr-audio-cassette", "title": "Audio Cassette", "code": "SOUNDCASS" }, "Video disc": { "id": "frbr-video-disc", "title": "Video Disc", "code": "VIDEODISC" }, "Maps": { "id": "frbr-maps", "title": "Maps", "code": "MAP" }, "Visual Materials": { "id": "frbr-visual-materials", "title": "Visual Materials", "code": "VISUAL" }, "Computer file": { "id": "frbr-computer-file", "title": "Computer File", "code": "COMPFILE" }, "Sound recording": { "id": "frbr-sound-recording", "title": "Sound Recording", "code": "SOUNDREC" }, "Music Sound Recording": { "id": "frbr-music-sound-recording", "title": "Music Sound Recording", "code": "MUSICSNDREC" }, "Music": { "id": "frbr-music", "title": "Music", "code": "NOTATEDMUSIC" }, "Manuscript": { "id": "frbr-manuscript", "title": "Manuscript", "code": "MS" }, "Regular print": { "id": "frbr-regular-print", "title": "Regular Print", "code": "UNKNOWN" }, "Atlas": { "id": "frbr-atlas", "title": "Atlas", "code": "ATLAS" }, "Filmstrip": { "id": "frbr-filmstrip", "title": "Filmstrip", "code": "FILMSTRIP" }, "Section": { "id": "frbr-section", "title": "Section", "code": "SECTION" }, "Motion picture": { "id": "frbr-motion-picture", "title": "Motion Picture", "code": "MOTIONPICT" }, "Kit": { "id": "frbr-kit", "title": "Kit", "code": "KIT" }, "Mixed materials": { "id": "frbr-mixed-materials", "title": "Mixed Materials", "code": "MIXED" }, "Remote sensing image": { "id": "frbr-remote-sensing-image", "title": "Remote Sensing Image", "code": "REMOTESEN" }, "Picture": { "id": "frbr-picture", "title": "Picture", "code": "PICTURE" }, "3-D Object": { "id": "frbr-3d-object", "title": "3-D Object", "code": "OBJECT" }, "Video Cartridge": { "id": "frbr-video-cartridge", "title": "Video Cartridge", "code": "VIDEOCART" }, "Large Print": { "id": "frbr-large-print", "title": "Large Print", "code": "LARGEPRINT" }, "Non projected graphic": { "id": "frbr-non-projected-graphic", "title": "Non Projected Graphic", "code": "NONPROJGRAPH" }, "Video recording": { "id": "frbr-video-recording", "title": "Video Recording", "code": "VIDEOREC" }, "Chart": { "id": "frbr-chart", "title": "Chart", "code": "CHART" }, "Diagram": { "id": "frbr-diagram", "title": "Diagram", "code": "DIAGRAM" }, "Slide": { "id": "frbr-slide", "title": "Slide", "code": "SLIDE" }, "Print": { "id": "frbr-print", "title": "Print", "code": "PRINT" }, "Tactile": { "id": "frbr-tactile", "title": "Tactile", "code": "TACTILE" }, "Drawing": { "id": "frbr-drawing", "title": "Drawing", "code": "DRAWING" }, "Flashcard": { "id": "frbr-flash-card", "title": "Flash Card", "code": "FLASHCARD" }, "Globe": { "id": "frbr-globe", "title": "Globe", "code": "GLOBE" }, "View": { "id": "frbr-view", "title": "View", "code": "VIEW" }, "Photo": { "id": "frbr-photo", "title": "Photo", "code": "PHOTO" }, "Projected graphic": { "id": "frbr-projected-graphic", "title": "Projected Graphic", "code": "UNKNOWN" }, "Technical drawing": { "id": "frbr-technical-drawing", "title": "Technical Drawing", "code": "TECHDRAWING" }, "eBook": { "id": "frbr-ebook", "title": "eBook", "code": "E_BOOK" }, "Online Resource": { "id": "frbr-online-resource", "title": "Online Resource", "code": "ER" }, "eAudiobook": { "id": "frbr-eaudiobook", "title": "eAudiobook", "code": "E_AUDIOBOOK" }, "eVideo": { "id": "frbr-evideo", "title": "eVideo", "code": "E_VIDEO" }, "Cassette": { "id": "frbr-cassette", "title": "Cassette", "code": "SOUNDCASS" }, "Other": { "id": "frbr-other", "title": "Other", "code": "UNKNOWN" }}//console.log('frbrFormatBOOK:'+frbrFormats['Books']['code']);//console.log('frbrFormatE_BOOK:'+frbrFormats['eBook']['code']);//console.log('frbrFormatBOOK:'+frbrFormats['BOOK']['code']);function removeDetailGmd(titleData) {//console.log("tD:"+titleData); titleData = titleData.replace(/ *\[sound recording *(\([A-Za-z0-9_-]*\))* *\]/i,""); titleData = titleData.replace(/ *\[videorecording *(\([A-Za-z0-9_-]*\))* *\]/i,""); titleData = titleData.replace(/ *\[text .large print.\]/i,""); titleData = titleData.replace(/ *\[microform\]/i,""); titleData = titleData.replace(/ *\[computer file\]/i,""); titleData = titleData.replace(/ *\[electronic resource\]/i,""); titleData = titleData.replace(/ *\[filmstrip\]/i,""); titleData = titleData.replace(/ *\[braille\]/i,""); titleData = titleData.replace(/ *\[kit\]/i,""); titleData = titleData.replace(/ *\[motion picture\]/i,""); titleData = titleData.replace(/ *\[slide\]/i,""); titleData = titleData.replace(/ *\[transparency\]/i,""); titleData = titleData.replace(/ *\[realia\]/i,"");//console.log("nT:"+titleData); return titleData;}function frbrDetails(rId) { var myProfile = com_sirsi_ent_page.friendlyUrl; var hitDocId = $J('#'+rId+'_DOC_ID').text(); if (hitDocId == ""){ hitDocId = $J('#'+rId+'_ERC_ID').text(); } //console.log('Checking Hit ' + rId + ' Doc ID ' +hitDocId); var isIlsHit = 0; if (hitDocId.indexOf("SD_ILS") > -1) { isIlsHit = 1; } var baseRssURL = "/client/rss/hitlist/" + myProfile + "/"; var baseSearchURL = "/client/" + myProfile + "/search/results?";//console.log("baseRssURL "+baseRssURL); var curTitle = $J('#'+rId+'_FRBR_AUTHORIZED_TITLE').text(); var curMainTitle = $J('#'+rId+'_FRBR_TITLE').text(); if ((curTitle.match(/^Selections$/) != null) || (curTitle.match(/^Selections\./) != null) || (curTitle.indexOf(". Selections") > -1)) { curTitle = ""; } // if the authorized title does not contain Vol., Volume, or Part, but the main title does, then do not use the authorized title for searching else if ((curTitle.match(/\. Vol\. [0-9]/) == null) && (curTitle.match(/\. Volume [0-9]/) == null) && (curTitle.match(/\. Part [0-9]/) == null)) { if ((curMainTitle.match(/\. Vol\. [0-9]/) != null) || (curMainTitle.match(/\. Volume [0-9]/) != null) || (curMainTitle.match(/\. Part [0-9]/) != null)) { curTitle = ""; } } var curAuthor = $J('#'+rId+'_FRBR_AUTHOR').text(); var authorizedTitle = 1; if (curTitle == "") { // will have issues if no author & uniform title is made up of common words curTitle = $J('#'+rId+'_FRBR_TITLE').text(); if (curTitle == "") { // will have issues if no author & uniform title is made up of common words curTitle = $J('#'+rId+'_'+ercTitleCode).text(); } authorizedTitle = 0; } if (curAuthor == "" && isIlsHit == 0) { curAuthor = $J('#'+rId+'_'+ercAuthorCode).text(); }//console.log("curTitle: "+curTitle); // require both Title and Author to attempt collapse; allow Title only if it is a Uniform Title if ( ((curTitle !="") && (curAuthor !="")) || ((authorizedTitle == 1) && (curTitle !="")) ) { curTitle = removeDetailGmd(curTitle); var frbrSearchString = 'qu=TITLE:\"'+ curTitle.replace(/ /g, '+')+'\"' ; var rssSearchString = 'qu=TITLE:\"' + curTitle.replace(/ /g, '+').replace(/[?&;¿¡]/g,'+')+'\"'; if (curAuthor !="") { frbrSearchString += '&qu=AUTHOR:\"'+ curAuthor.replace(/ /g, '+')+'\"'; rssSearchString += '&qu=AUTHOR:\"'+ curAuthor.replace(/ /g, '+').replace(/[&?;¿¡]/g, '+')+'\"'; } //console.log('frbr search string ' + frbrSearchString); //console.log('rss search string ' + rssSearchString); var frbrRssSearchURL = baseRssURL +rssSearchString; var frbrHitSearchURL = baseSearchURL + frbrSearchString + '&FRBR=1';/* var searchTarget = getSearchParam('te'); var searchFacets = getSearchParam('qf'); if (searchFacets !== '') { frbrRssSearchURL += '&qf=' + searchFacets; frbrHitSearchURL += '&qf=' + searchFacets; } if (searchTarget !== '') { frbrRssSearchURL += '&te=' + searchTarget; frbrHitSearchURL += '&te=' + searchTarget; }*/ //console.log('frbr search string URL ' + frbrHitSearchURL); //console.log('rss search string URL ' + frbrRssSearchURL); var numTitles = 0; $J.ajax({ type: 'GET', url: frbrRssSearchURL, dataType: 'xml', async:false, success: function (data) { var entries = $J(data).find('entry'); numTitles = $J(entries).length; if (numTitles >1) { console.log(' Search found '+ numTitles +' titles'); var expressions = []; var divSelector = '#' + rId.replace(/detail/,"detailActionsdetail");//console.log("authTitle: "+authorizedTitle); if (authorizedTitle == 0) { $J(entries).each(function () { var frbrHitTitle = $J(this).find('title').text().replace("Title ",""); frbrHitTitle = removeDetailGmd(frbrHitTitle); if (frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase()) > 5 || (authorizedTitle == 0 && frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase()) < 0)) { $J(this).remove(); numTitles--;//console.log("ctitle found in ftitle at(1): "+frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase())); }//console.log(' Revised search total: '+ numTitles +' titles'); }); }//console.log(' Final revised search total: '+ numTitles +' titles'); if (numTitles < 2) { return; }// var multipleTag = '

      • List all formats/editions

    '; var multipleTag = '

    ';//if ($J('.mobile').length > -1) { var accordion_selector = rId.replace("detail", "detail_accordion"); addToAccordion('#'+accordion_selector, $J('

    Other formats/editions

    '), $J('

    • List all formats/editions

    '), true); //$J('#'+accordion_selector+" .list-items").show();//}//else {// $J(divSelector).append(multipleTag); //} //$J(data).find('entry').each(function () { $J(entries).each(function () { var frbrHitTitle = $J(this).find('title').text().replace("Title ",""); if (frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase()) > 5 || (authorizedTitle == 0 && frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase()) < 0)) {//console.log("ctitle found in ftitle at: "+frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase())); $J(this).remove(); return; } var el =$J(this); var frbrHitId = $J(el).find('id').text().replace(/ent:\/\/.*\//,""); var frbrFullId = ""; if ($J(el).find('id').text().indexOf("ERC") > -1) { frbrFullId = $J(el).find('id').text(); //console.log('Hit id ' + frbrHitId+"|"); //console.log("frbrFullId " + frbrFullId+"|"); //frbrHitId = frbrFullId; } //console.log('Hit id ' + frbrHitId+"|"); //console.log('Hit doc id ' + hitDocId+"|"); if (frbrHitId != hitDocId && frbrFullId != hitDocId) { // skipIdList[frbrHitId]=true; // console.log(' Adding '+frbrHitId+' to list'); } else { return; } var frbrLinkURL= frbrHitSearchURL+'&DISP='+frbrHitId; //console.log('Link url ' +frbrLinkURL); var nonmodalLinkURL = $J(el).find('link').attr('href'); if (typeof nonmodalLinkURL !== "undefined") { nonmodalLinkURL = nonmodalLinkURL.replace("&ps="+itemsToSort,""); //console.log(nonmodalLinkURL); } else { nonmodalLinkURL = " "; } //console.log(nonmodalLinkURL); var content = $J(el).find('content').text(); var tags = content.split('
    '); var formatTag = -1; var editionTag = -1; var languageTag = -1; var pubdateTag = -1; var expressionFormat; var vendorTag = -1; for (var term = 0; term < tags.length; term++) { var alltags = tags[term].split(''); tags[term] = tags[term].split(''); var termName = alltags.shift(); var termValue = alltags.join(' & '); if (! (termName == "" && termValue == "") ) { //console.log('termName:'+termName+'|termValue:'+termValue+'|');/* if (tags[term][0] == "FRBR Format"){ alltags.sort(); termValue = alltags.join(' & '); formatTag = term; tags[term][1] = termValue; } else if (tags[term][0] == "Format" && formatTag == -1){*/ if ((tags[term][0] == "Format" || tags[term][0] == "Format:" || tags[term][0] == "Format:") && formatTag == -1) { //console.log('termName:'+termName+'|termValue:'+termValue+'|'); if (termValue.indexOf(" & ") == -1) { // single format term in tag//console.log("jQiEO:"+jQuery.isEmptyObject(frbrFormats[termValue])+"|"); if (jQuery.isEmptyObject(frbrFormats[termValue])) {//console.log('frbrFormatBOOK:'+frbrFormats['Book']['code']); frbrFormats[termValue] = []; frbrFormats[termValue]['id'] = "frbr-other"; frbrFormats[termValue]['title'] = termValue; //"Other"; frbrFormats[termValue]['code'] = "UNKNOWN"; } formatTag = term; tags[term][1] = termValue; expressionFormat = frbrFormats[termValue]['code']; //termValue; } else { // multiple format terms in tag var allforms = termValue.split(' & '); allforms.sort(); var tmpexpression = []; for(var checktag = 0; checktag < allforms.length; checktag++) { if(tmpexpression.indexOf(frbrFormats[alltags[checktag]]['code']) == -1) { tmpexpression.push(frbrFormats[allforms[checktag]]['code']); } else { allforms.splice(checktag, 1); checktag--; } } if (frbrFormats[allforms[0]]['code'].length < 1) { frbrFormats[allforms[0]]['id'] = "frbr-other"; frbrFormats[allforms[0]]['title'] = "Other"; frbrFormats[allforms[0]]['code'] = "UNKNOWN"; } termValue = allforms.join(' & '); formatTag = term; tags[term][1] = termValue; //console.log('termValue:'+termValue+'|'); expressionFormat = frbrFormats[allforms[0]]['code']; } } if (tags[term][0] == "Edition") { editionTag = term; tags[term][1] = termValue; } if (tags[term][0] == "Language") { languageTag = term; tags[term][1] = termValue; } if (tags[term][0].indexOf("Publication Date") > -1 && pubdateTag == -1) { termValue = alltags.join(' '); pubdateTag = term; tags[term][1] = termValue; } if (tags[term][0] == "Vendor") { vendorTag = term; tags[term][1] = termValue; } } //end if termname not null } //end for var consoleTmp = ""; if (formatTag > -1) {//console.log("tft:"+tags[formatTag][1]); if (tags[formatTag][1].indexOf(" & ") > -1) { //multi-format record consoleTmp = 'Format ' + tags[formatTag][1] + '|' + frbrFormats[ tags[formatTag][1].split(' & ')[0] ]['code']; //*** tags[formatTag][1] has an &!! var expressionText = ''; consoleTmp = 'Format ' + tags[formatTag][1] + '|' + frbrFormats[ tags[formatTag][1].split(' & ')[0]] ['code']; //var expressionText = '';//console.log("ftf: "+frbrFormats[tags[formatTag][1]]['code']);//console.log("made it 1");/* //### experimental for multi-format records, for treating subformats as subformats rather than additional formats if (tags[formatTag][1].indexOf("BOOK") > -1) {//console.log("made it 2"); if (tags[formatTag][1].indexOf("LARGEPRINT") > -1) {//console.log("made it 3a"); var tmptag = tags[formatTag][1]; tmptag = tmptag.replace("& LARGEPRINT",""); tmptag = tmptag.replace("BOOK", "BOOK (Large print)"); tags[formatTag][1] = tmptag; } else if (tags[formatTag][1].indexOf("COMICS") > -1) {//console.log("made it 3b"); tags[formatTag][1].replace("& COMICS",""); tags[formatTag][1].replace("BOOK", "Book (Comics/GN)"); } }*///console.log("tft(2):"+tags[formatTag][1]); var fmts = tags[formatTag][1].split(" & "); fmts.each(function(fmt){ if (expressionText.slice(-1) != ">") { expressionText += " & "; } expressionText += ' ' + frbrFormats[fmt]['title']; }); }/* else if (tags[formatTag][1].substr(0, 1) != "e") { expressionText = ' ' + tags[formatTag][1]; } else { expressionText = ' ' + tags[formatTag][1]; }*/ else { expressionText = ' ' + frbrFormats[tags[formatTag][1]]['title']; } } else { //no format tag found var expressionText = ' ' + frbrFormats['Other']['title']; expressionFormat = 'UNKNOWN'; expressions[expressionFormat] = []; } if (languageTag > -1) { consoleTmp += ' & Language ' + tags[languageTag][1]; expressionText += ' - ' + tags[languageTag][1]; } if (editionTag > -1) { consoleTmp += ' & Edition ' + tags[editionTag][1]; expressionText += ' - ' + tags[editionTag][1]; } if (pubdateTag > -1) { consoleTmp += ' & PubDate |' + tags[pubdateTag][1] + '|'; expressionText += ' - ' + tags[pubdateTag][1]; } if (vendorTag > -1) { consoleTmp += ' & Vendor ' + tags[vendorTag][1]; expressionText += ' - ' + tags[vendorTag][1]; } consoleTmp += ' & nonmodalLinkURL ' + nonmodalLinkURL; //console.log(consoleTmp); if (formatTag != -1) { //$J('#'+ rId + '_frbrLinks').append('['+tags[formatTag][1]+']'); }//console.log(expressionText); expressions.push(expressionText + "\t" + nonmodalLinkURL); }); //sessionStorage.skipIds = JSON.stringify(skipIdList); //console.log( " Updated list: " + sessionStorage.skipIds); expressions.sort(); for (var instance = 0; instance < expressions.length; instance++) { expressions[instance] = expressions[instance].split('\t'); $J('#'+ rId + '_frbrDetailLinks ul.list-items').append('

  • ' + expressions[instance][0] + '
  • '); }//$J('ul.list-items').hide(); $J('button#' + rId + 'FRBRBUTTON').click(function() { // var currentMenu = $J(this).siblings('ul.list-items'); // //$J('ul.list-items').not(currentMenu).hide(); // currentMenu.slideToggle(300); if ($J('button#' + rId + 'FRBRBUTTON').attr("value") == "Hide other formats/editions") { $J('button#' + rId + 'FRBRBUTTON').attr("value", "Other formats/editions"); $J('button#' + rId + 'FRBRBUTTON').attr("title", "Other formats/editions"); $J('button#' + rId + 'FRBRBUTTON').text("Other formats/editions"); } else { $J('button#' + rId + 'FRBRBUTTON').attr("value", "Hide other formats/editions"); $J('button#' + rId + 'FRBRBUTTON').attr("title", "Hide other formats/editions"); $J('button#' + rId + 'FRBRBUTTON').text("Hide other formats/editions"); } $J('ul.list-items').slideToggle(300); return false; }); //console.log("=-=-=-=-=-=-=-="); } else { //console.log('skipping because only 1 hit found'); } } }); } else { //console.log ('skipping because hit does hot have both TI & AU'); } //}}function startItemDetailsMonitor(rId){var hitNum=rId.split('detail')[1]; var titleLookupEvent='detailavailabilityaccordions:lookuptitleinfo';var itemLibraryEvent='webservicefieldsajax:lookuptitleinfo/detailItemsDiv'+hitNum;var holdingsEvent='webservicefieldsajax:lookupavailability/detailHoldingsDiv'+hitNum;var itemAvailEvent='webservicefieldsajax:lookupavailability/detailItemsDiv'+hitNum;var itemCollectionEvent='webservicefieldsajax:lookupcollection/detailItemsDiv'+hitNum;$J(document).ajaxComplete(function(e, xhr, detailCall) { var curEvent=detailCall.url; if(curEvent.indexOf(titleLookupEvent)!==-1){ moveStatus(hitNum) } else if(curEvent.indexOf(itemAvailEvent)!==-1){ moveStatus(hitNum) }});}function moveStatus(hitNum) {var selector = "#detail_wrapper" + hitNum;if (jQuery('#nm_detail_wrapper').length > 0) { selector = "#nm_detail_wrapper"; }//console.log(selector);var detailAvailCount = 0;var detailChargeCount = 0;//console.log(jQuery('.nonmobile').length);if (jQuery('.nonmobile').length > 0) {//console.log(jQuery(selector + ' .detailItemsTable_SD_ITEM_STATUS').length); jQuery(selector + ' .detailItemsTable_SD_ITEM_STATUS').each(function() { console.log(jQuery(this).find(':not(.hidden)').text().replace(/\n/g,'')); console.log(jQuery(this).parent().find('.detailItemsTable_LOCATION').text().replace(/\n/g,'')) var locationText = jQuery(this).find(':not(.hidden)').text().replace(/\n/g,''); switch (locationText) { case "Available soon": case "Material being cataloged": case "Being cataloged": jQuery(this).find(':not(.hidden)').html('Coming soon'); break; case "Display - Not for loan. Please place hold.": jQuery(this).find(':not(.hidden)').html('Display - Not for loan'); break; case "Being acquired by the library": // no change, but also do not change to "Available on shelf" break; default: if (jQuery(this).find(':not(.hidden)').text().replace(/\n/g,'') == jQuery(this).parent().find('.detailItemsTable_LOCATION').text().replace(/\n/g,'')) { jQuery(this).find(':not(.hidden)').html('Available on shelf'); detailAvailCount++; } else if (jQuery(this).find(':not(.hidden)').text().replace(/\n/g,'').indexOf('Due ') > -1 ) { jQuery(this).find(':not(.hidden)').html(''+ jQuery(this).find(':not(.hidden)').html() +''); detailChargeCount++; } } jQuery(this).insertBefore(jQuery(this).parent().find('.detailItemsTable_LIBRARY')); }); availSummary(hitNum, detailAvailCount, detailChargeCount);}else {//console.log(jQuery(selector + ' .detailItemsTable_SD_ITEM_STATUS').length); jQuery(selector + ' .detailItemsTable_SD_ITEM_STATUS').each(function() { console.log(jQuery(this).find(':not(.hidden)').text().replace(/\n/g,''));console.log(jQuery(this).parent().parent().find('.detailItemsTable_LOCATION.fieldValue').text().replace(/\n/g,'')); var locationText = jQuery(this).find(':not(.hidden)').text().replace(/\n/g,''); switch (locationText) { case "Available soon": case "Material being cataloged": case "Being cataloged": jQuery(this).find(':not(.hidden)').html('Coming soon'); break; case "Display - Not for loan. Please place hold.": jQuery(this).find(':not(.hidden)').html('Display - Not for loan'); break; case "Being acquired by the library": // no change, but also do not change to "Available on shelf" break; default: if (jQuery(this).find(':not(.hidden)').text().replace(/\n/g,'') == jQuery(this).parent().parent().find('.detailItemsTable_LOCATION.fieldValue').text().replace(/\n/g,'')) { jQuery(this).find(':not(.hidden)').html('Available on shelf'); detailAvailCount++; } else if (jQuery(this).find(':not(.hidden)').text().replace(/\n/g,'').indexOf('Due ') > -1 ) { jQuery(this).find(':not(.hidden)').html(''+ jQuery(this).find(':not(.hidden)').html() +''); detailChargeCount++; } } jQuery(this).parent().insertBefore(jQuery(this).parent().parent().find('.detailItemsTable_LIBRARY').parent()); }); availSummary(hitNum, detailAvailCount, detailChargeCount);}}function availSummary(hitNum, detailAvailCount, detailChargeCount) { var cellSelector; cellSelector = "#detailActionsdetail" + hitNum;var availSumHtml = '

    ';if (detailAvailCount > 0) { availSumHtml += '

    On the shelf and available in OneCard Network (' + detailAvailCount+ ' '; if (detailAvailCount == 1) { availSumHtml += "copy"; } else { availSumHtml += "copies"; } availSumHtml += ')

    ';}if (detailChargeCount > 0) { availSumHtml += '

    On loan but you can place a hold (' + detailChargeCount+ ' '; if (detailChargeCount == 1) { availSumHtml += "copy"; } else { availSumHtml += "copies"; } availSumHtml += ')

    ';} availSumHtml += '

    '; if (jQuery('.nonmobile').length > 0) { //jQuery(cellSelector).prepend('

    Access this title

    ');// jQuery(cellSelector).append(availSumHtml) jQuery(cellSelector).prepend(availSumHtml) jQuery(cellSelector).siblings('.detail_buttons').find('.customDropdownText').text('More actions'); jQuery(cellSelector).siblings('.detail_buttons').css('clear','right'); jQuery(cellSelector).after(jQuery(cellSelector).siblings('.detail_buttons')); } else { cellSelector = "#detail_biblio" + hitNum; jQuery(cellSelector).append(availSumHtml); }}// Important: Modifications to this file may be overwritten during an upgrade.// If you want to customize this widget and have those modifications persist through upgrades,// make a copy of this widget and make modifications to the copied widget.// You can then assign the copied widget to the detail or search result displays you want.if('undefined' === typeof eRC_Availability) { eRC_Availability = { addAvailabilityToResult:function(resultId) { var idDiv = document.getElementById(resultId+'_ERC_ID'); if(!idDiv || !idDiv.innerHTML) { return; } eRC_Availability.makeIfNeeded(resultId); if(eRC_Base) { eRC_Base.getTitleData(function(data){ eRC_Availability.fill(resultId, data); }, resultId); } else { eRC_Availability.fill(resultId); } }, fill:function(resultId, data) { var aDiv = document.getElementById('availableNumber_'+resultId); if(aDiv) { var avail = 'Unavailable'; if (data && data.status && 'OK' === data.status && data.formats && data.formats.length > 0) { if (data.availability && data.availability.available) { if (data.availability.availableCopies) { // show copies available avail = data.availability.availableCopies; } else { // unlimited duration avail = 'Unlimited'; } } else { // no copies available avail = 0; } } aDiv.innerHTML = avail; $J(aDiv).removeAttr('name'); } }, makeIfNeeded:function(resultId) { if(document.getElementById('availableNumber_'+resultId)) { return; } var matches = resultId.match(/^(detail|hitlist)(\d+)$/); if(matches) { if (com_sirsi_ent_page.isMobile) { var label = document.createElement('span'); label.setAttribute('class','availableLabel ercAvailableCountLabel text-h5'); if ($J('*[class^="detail_"]').length) { label.innerHTML = 'Available:'; } else { label.innerHTML = 'Available'; } number = document.createElement('span'); number.setAttribute('id','availableNumber_'+resultId); number.setAttribute('class','availableNumber ercAvailableCountNumber text-p'); number.setAttribute('name','smallSearchingGif'); number.setAttribute('style','display:inline-block;'); var div = document.createElement('div'); div.setAttribute('id','ercAvailableDiv_'+resultId); div.setAttribute('class','availableDiv ercAvailableCountSection'); div.appendChild(label); div.appendChild(number); if('detail' === matches[1]) { $J('.detailFieldsAlign').append(div); } else { document.getElementById('results_bio' + matches[2]).appendChild(div); } } else { var label = document.createElement('span'); label.setAttribute('class','availableLabel ercAvailableCountLabel '); label.innerHTML = 'Available:'; number = document.createElement('span'); number.setAttribute('id','availableNumber_'+resultId); number.setAttribute('class','availableNumber ercAvailableCountNumber'); number.setAttribute('name','smallSearchingGif'); number.setAttribute('style','display:inline-block;'); var div = document.createElement('div'); div.setAttribute('id','ercAvailableDiv_'+resultId); div.setAttribute('class','availableDiv ercAvailableCountSection'); div.appendChild(label); div.appendChild(number); var idStr = ('detail' === matches[1] ? 'detail_biblio' : 'results_bio') + matches[2]; document.getElementById(idStr).appendChild(div); } createSpinnersForSelector($J('#availableNumber_' + resultId), smallSpinnerOptions); } }, }}function startDetailsTagSlider(rId){var hitNum=rId;var totalTags=$J('#detail_biblio'+hitNum).find('.documentSummaries').length;var curDetailObj=$J('#detail_biblio'+hitNum);var visibleTags=['TITLE','PERSONAL_AUTHOR','FORMAT','PUBDATE'];var lastVisibleTag='';for (i=0;i

    0){ $J(curDetailObj).find('.displayElementLabel.'+visibleTags[i]).closest('.documentSummaries').addClass('visible'); lastVisibleTag=visibleTags[i]; }}var lastVisible=$J(curDetailObj).find('.visible:last');var lastVisibleTagIndex=$J(curDetailObj).find('.documentSummaries').index(lastVisible);$J(curDetailObj).find('.documentSummaries:lt('+lastVisibleTagIndex+')').addClass('visible');$J(curDetailObj).find('.documentSummaries:gt('+lastVisibleTagIndex+')').addClass('hidden');var visibleTagCount=$J(curDetailObj).find('.documentSummaries.visible').length;if (visibleTagCountShow more...');/***do something here. Add a slider to the bottom of detail_biblioX with a toggle. Animation sliding would be cool, but you have to wrap a separate div into the tags to make that happen, and wrapAll() does not seem to like the highly nested tags in Enterprise***/$J(curDetailObj).find('.detailSlider').click(function(){ if($J(this).text()=='Show more...'){ // $J(curDetailObj).slideDown("slow",function(){ $J(curDetailObj).find('.documentSummaries.hidden').removeClass('hidden'); $J(this).text('Show less...'); //}); } else{ // $J(curDetailObj).slideUp("slow",function(){ $J(curDetailObj).find('.documentSummaries').not('.visible').addClass('hidden'); $J(this).text('Show more...');// }); }});}}function startThumbNail(){ if($J('#river-content').length==0){var isKidcat = $J('html').attr('id');var isAssetSearch=__QueryParameters.te=='ASSET';/****MODDED SEPT 16 2019, STORES LIST/THUMB PREFERENCE ACROSS PAGESPRODUCTION NOTE: THEY DON'T WANT PORTFOLIO ASSETS IN THUMB MODE. MAKE SURE1) TO NOT ATTACH THIS TO THE ASSET DISPLAY, AND2) IN THE ASSET SR DISPLAY, MAKE SURE THE 'ASSET THUMBNAIL' ADDITIONAL FIELD IS NOT SELECTED****/$J('a').has('.list_img,.thumb_img').click(function(){$J(this).find('img').attr('class')=='thumb_img'?sessionStorage.setItem('displayView','thumb'):sessionStorage.setItem('displayView','list');});var curDisplayPref=sessionStorage.getItem('displayView');var mq = window.matchMedia("(max-width: 736px)");console.log('mq value is ' + mq);if (!mq.matches && isKidcat !== 'kidcat' && ! isAssetSearch){ //if not small device, kids cat, or portfolio... if(curDisplayPref!=='list'){ clickThumb(); }}}//end if rivers not present}// Important: Modifications to this file may be overwritten during an upgrade.// If you want to customize this widget and have those modifications persist through upgrades,// make a copy of this widget and make modifications to the copied widget.// You can then assign the copied widget to the detail or search result displays you want.if('undefined' === typeof eRC_Base) { eRC_Base = { //variables ercIds:[], ercTitleData:{}, titleWaitingCallbacks:[], titlesReady:false, titleAjaxCallsOut:0, //initialization addErcId:function(rId) { var ercId = eRC_Base.getErcIdFromDom(rId); if(ercId) { eRC_Base.ercIds.push({'ercId':ercId,'resultId':rId}); } }, getErcIdFromDom:function (rId) { return $J('#'+rId+'_ERC_ID > .ERC_ID_value').text(); }, //loading the data loadTheData:function() { var idString = ''; for(var i = 0; i < eRC_Base.ercIds.length; i++) { var idVal = eRC_Base.ercIds[i]; if(idString.indexOf(idVal) === -1) { idString += ','+idVal.ercId; } } if(idString.length > 0) { idString = idString.substr(1); } if(idString) { var titlesUrl = addPathParams(com_sirsi_ent_widgets.URLS.eRC.titleInfoUrl, encodeAsTapestry(idString)); eRC_Base.titleAjaxCallsOut++; new AjaxHandler(null, titlesUrl, null, eRC_Base.handleTitlesResponse, null, true).invokeAjax(); } else { eRC_Base.titlesReady = true; } }, handleTitlesResponse:function(response) { eRC_Base.titleAjaxCallsOut--; if((typeof eRC_Base.ercTitleData !== 'undefined') && eRC_Base.ercTitleData.eResourceList) { if ((typeof response.responseJSON !== 'undefined')) { // could the response be undefined? What should we do in that scenario? response.responseJSON.eResourceList.forEach(function (er) { eRC_Base.ercTitleData.eResourceList.push(er); }); } } else { eRC_Base.ercTitleData = response.responseJSON; } eRC_Base.titlesReady = true; var unCalled = []; for(var i = 0; i < eRC_Base.titleWaitingCallbacks.length; i++) { var callback = eRC_Base.titleWaitingCallbacks[i]; var data = eRC_Base.getData(callback.ercId); if(data || eRC_Base.titleAjaxCallsOut == 0) { callback.callback(data); } else { unCalled.push(callback); } } eRC_Base.titleWaitingCallbacks = unCalled; }, getSingleTitle:function(eResourceId) { var titlesUrl = addPathParams(com_sirsi_ent_widgets.URLS.eRC.titleInfoUrl, encodeAsTapestry(eResourceId)); eRC_Base.titleAjaxCallsOut++; new AjaxHandler(null, titlesUrl, null, eRC_Base.handleTitlesResponse, null, true).invokeAjax(); }, //functions getData:function(ercDocumentId) { if (!ercDocumentId) { return; } if (eRC_Base.ercTitleData && eRC_Base.ercTitleData.eResourceList) { var eResourceList = eRC_Base.ercTitleData.eResourceList; for (var i = 0; i < eResourceList.length; i++) { if (eResourceList[i].id == ercDocumentId) { return eResourceList[i]; } } } //we didn't find it, so request it. // but don't request it if we've already got too many callouts still pending if (eRC_Base.titleAjaxCallsOut < 50) { eRC_Base.getSingleTitle(ercDocumentId); } }, getErcId:function(resultId, isRetry) { if(!resultId) { return; } for(var i = 0; i < eRC_Base.ercIds.length; i++) { var ercId = eRC_Base.ercIds[i]; if(ercId.resultId == resultId) { return ercId.ercId; } } //we might have never seen this result id before. //so, add it to the list (which should pull the ercId from the dom) //and then try again. if(!isRetry) { eRC_Base.addErcId(resultId); return eRC_Base.getErcId(resultId, true); } }, //'API' functions getTitleData:function(callbackFunction, resultId) { var data; // we need to limit the call outs to a reasonable number so that we don't overwhelm the system resources. if(eRC_Base.titlesReady && eRC_Base.titleAjaxCallsOut < 200) { data = eRC_Base.getData(eRC_Base.getErcId(resultId)); } if(data) { callbackFunction(data); } else { eRC_Base.titleWaitingCallbacks.push({'callback':callbackFunction,'ercId':eRC_Base.getErcId(resultId)}); } }, getAccountsResponse:function(callbackFunction, ercAccountsUrl) { var getAccountsUrl = addPathParams(com_sirsi_ent_widgets.URLS.eRC.accountsUrl, encodeAsTapestry(ercAccountsUrl)); new AjaxHandler(null, getAccountsUrl, null, function(response) { callbackFunction(response.responseJSON) }, null, true).invokeAjax(); }, getDownloadResponse:function(callbackFunction, ercResourceUrl, needPin) { var downloadUrl = addPathParams(com_sirsi_ent_widgets.URLS.eRC.getEResourceUrl, encodeAsTapestry(ercResourceUrl)+'/'+!!needPin); new Ajax.Request(downloadUrl, { onSuccess:function(response) { callbackFunction(response.responseJSON) }, onException: Tapestry.ajaxFailureHandler, onFailure: Tapestry.ajaxFailureHandler, asynchronous: true }); }, getPlaceHoldResponse:function(callbackFunction, resultId, emailHold, autoCheckout) { if(typeof autoCheckout !== 'boolean') { autoCheckout = false; } var array = emailHold.split("@"); // tapestry doesn't want us to pass @ characters, so let's split the email address // tapestry doesn't like empty params, so we need to use encodeAsTapestry to pass special values (like empty strings) var getHoldUrl = addPathParams(com_sirsi_ent_widgets.URLS.eRC.placeHoldUrl, encodeAsTapestry(eRC_Base.getErcId(resultId)) + '/' + encodeAsTapestry(array[0]) + '/' + encodeAsTapestry(array[1]) + '/' + autoCheckout); new AjaxHandler(null, getHoldUrl, null, function(response) { callbackFunction(response.responseJSON) }, null, true).invokeAjax(); }, getHoldEmail:function(callbackFunction, resultId) { var getHoldEmail = addPathParams(com_sirsi_ent_widgets.URLS.eRC.emailHoldUrl, encodeAsTapestry(eRC_Base.getErcId(resultId))); new AjaxHandler(null, getHoldEmail, null, function(response) { callbackFunction(response.responseJSON) }, null, true).invokeAjax(); }, fixErcIds:function(sortedDocIds) { // we want to maintain the new sort order var newErcIds = []; if (eRC_Base.ercIds && eRC_Base.ercIds.length > 0) { var ercIdIndex = 0; if (sortedDocIds) { for (var idIndex = 0; idIndex < sortedDocIds.length; idIndex++) { var docId = sortedDocIds[idIndex]; for (var ercIdIndex = 0; ercIdIndex < eRC_Base.ercIds.length; ercIdIndex++) { var currentErcIdObject = eRC_Base.ercIds[ercIdIndex]; var containsErcId = docId.indexOf(currentErcIdObject.ercId); if (containsErcId !== -1) { var currentErcId = currentErcIdObject.ercId; newErcIds.push({'ercId': currentErcId, 'resultId': 'hitlist' + idIndex}); break; } } } } else { var processedResultIdSet = []; var resultIdMap = new Map(); for (var i = 0; i < eRC_Base.ercIds.length; i++) { var ercIdObject = eRC_Base.ercIds[i]; if (!processedResultIdSet.contains(ercIdObject.resultId)) { var resultId = ercIdObject.resultId; var ercId = $J('#' + resultId + '_ERC_ID > .ERC_ID_value').text(); resultIdMap.set(ercId, resultId); processedResultIdSet.push(currentResultId); } } var keys = resultIdMap.keys; for (var j = 0; j < keys.length; j++) { var currentResultId = resultIdMap.get(keys[j]); newErcIds.push({'ercId': j, 'resultId': currentResultId}); } } } eRC_Base.ercIds = newErcIds; }, reorderErcIds:function(docId, destinationIndex, keepItem) { if (eRC_Base.ercIds) { var ercIdFound = false; var ercId, currentIndex; var processedResultIdSet = []; var destination = keepItem ? destinationIndex : eRC_Base.ercIds.length; //check if it's even in the list, otherwise don't worry about it for (var ercIndex = 0; ercIndex < eRC_Base.ercIds.length; ercIndex++) { var currentErcIdObject = eRC_Base.ercIds[ercIndex]; var containsErcId = docId.indexOf(currentErcIdObject.ercId); if (containsErcId !== -1) { ercIdFound = true; ercId = currentErcIdObject.ercId; // remove 'hitlist' to get list index currentIndex = currentErcIdObject.resultId.toString().substring(7); } if (!processedResultIdSet.contains(currentErcIdObject.resultId)) { processedResultIdSet.push(currentErcIdObject.resultId); } } if ('undefined' !== typeof currentIndex) { eRC_Base.adjustResultIds(currentIndex, destination, ercIdFound, ercId, processedResultIdSet.length, keepItem); } else { eRC_Base.fixErcIds(null); } } }, // keepItem - boolean - whether or not we're keeping the item (delete, then no; move, then no; reorder, then yes) adjustResultIds:function(currentResultId, destinationResultId, ercIdInList, ercId, hitlistSize, keepItem) { var newErcIds = []; var processedResultIdSet = []; var currentPosition = currentResultId; var destinationPosition = destinationResultId; var smallerIndex = currentPosition < destinationPosition ? currentPosition : destinationPosition; var upperIndex = currentPosition < destinationPosition ? destinationPosition : currentPosition; // set values before moved items for (var index = 0; index < smallerIndex; index++) { var loopResultId = eRC_Base.getResultIdFromPosition(index); if (eRC_Base.getErcId(loopResultId) && !(eRC_Base.getErcId(loopResultId) === ercId)) { newErcIds.push({'ercId': eRC_Base.getErcId(loopResultId), 'resultId': loopResultId}); } } // put item in list where it goes if it was in the list if (ercIdInList && keepItem) { newErcIds.push({'ercId': ercId, 'resultId': eRC_Base.getResultIdFromPosition(destinationResultId)}); } // set values of moved items if ((currentPosition < destinationPosition) || !keepItem) { var nextPosition = currentResultId; // pull everyone up one while (nextPosition < destinationPosition) { var resultId = nextPosition; var nextErcId = eRC_Base.getNextErcId(resultId); if (nextErcId) { newErcIds.push({'ercId': nextErcId, 'resultId': eRC_Base.getResultIdFromPosition(resultId)}); } nextPosition++; } } else { // push everyone down one var nextPosition = destinationPosition; while (nextPosition < currentPosition) { var nextResultId = eRC_Base.getResultIdFromPosition(nextPosition); var nextErcId = eRC_Base.getErcId(nextResultId, false); if (nextErcId) { newErcIds.push({'ercId': nextErcId, 'resultId': eRC_Base.getResultIdFromPosition(nextPosition + 1)}); } nextPosition++; } } // set values after moved items for (var index = upperIndex + 1; index < hitlistSize; index++) { var loopResultId = eRC_Base.getResultIdFromPosition(index); if (eRC_Base.getErcId(loopResultId)) { newErcIds.push({'ercId': eRC_Base.getErcId(loopResultId, false), 'resultId': loopResultId}); } } eRC_Base.ercIds = newErcIds; }, getResultIdFromPosition:function(position) { return 'hitlist' + position; }, getNextErcId:function(resultId) { var position = parseInt(resultId) + 1; var newResultId = eRC_Base.getResultIdFromPosition(position); return eRC_Base.getErcId(newResultId, false); } }; $J(function() { eRC_Base.loadTheData(); });}function addGoodReads (rId) {var thisISBN = jQuery('#'+rId+'_ISBN .ISBN_value:first-child').text();var goodReadsButton = '';if(document.getElementById('detailActions'+rId) != undefined){jQuery('#detailActions'+rId).prepend(goodReadsButton);}else{var displayType='hitlist';var hitnum=rId.split(displayType)[1];jQuery('#results_bio'+hitnum).closest('.results_cell').find('.results_right').prepend(goodReadsButton);}jQuery('.goodreadsbutton').css('background-image', 'url(https://saplntest.ent.sirsidynix.net.au/custom/web/PLS/goodreads-badge-add-plus-71eae69ca0307d077df66a58ec068898.png)');jQuery('.goodreadsbutton').css('background-repeat', 'no-repeat');jQuery('.goodreadsbutton').css('width', '130px');jQuery('.goodreadsbutton').css('height', '41px');jQuery('.goodreadsbutton').css('background-color', 'none');jQuery('.goodreadsbutton').css('border', 'none');jQuery('.goodreadsbutton').text('');}// On Inital Page Load// Text definitionsvar returnToSearchLinkText = "Return to Search Results";var multipleFormatsText = "Multiple Formats";var ercTitleCode = "INITIAL_TITLE_SRCH";var ercAuthorCode = "INITIAL_AUTHOR_SRCH";var wsBaseUrl = "https://sapln.sirsidynix.net.au/sapln_ilsws/";var clientId = "DS_CLIENT";var verboseMode = true;var frbrishAnalysis = {};var ilsType = "Symphony"; //"Horizon";var qualifiedErcUrls = false;var collapseFormats = true;var hideFacets = false;var displayAvailable = true;var displayPlaceHold = false;var multiFormatRecords = false;var formatLinks = false;var facetFormatField = "FORMAT";var frbrUseFields = ['language', 'edition', 'pubdate', 'vendor']; //format is always presentvar frbrExpressionFields = { "format": { "label": "Format", "code": "FORMAT", "show": true, "ils": true, "erc": true }, "language": { "label": "Language", "code": "LANGUAGE", "show": false, "ils": true, "erc": true }, "edition": { "label": "Edition", "code": "EDITION", "show": true, "ils": true, "erc": true }, "pubdate": { "label": "Publication Date", "code": "PUBDATE_RANGE", "show": true, "ils": true, "erc": true }, "vendor": { "label": "Vendor", "code": "ERC_VENDOR", "show": false, "ils": false, "erc": true }, "isbn": { "label": "${ISBN}", "code": "ISBN", "show": false, "ils": true, "erc": false }};jQuery(document).ready(function() { var bodyHeight = jQuery('body').height(); var resultsHeight = jQuery('#searchResultsColumn').height(); jQuery.each(frbrExpressionFields, function(i, fld) { if (!fld.show) { jQuery('.displayElementWrapper .' + fld.code).hide(); } });});//*******************************************************************************************************************//if (!$J("#content.bentoContent").length > 0) { //only execute if Bento is not in play var searchPath = location.pathname; var currentSearch = (location.search); var searchTarget = frbrGetSearchParam('te'); var searchFacets = frbrGetSearchParam('qf'); var searchLimit = frbrGetSearchParam('lm'); var numClusters = 0; // console.log('Current Search '+ currentSearch); if (frbrGetSearchParam('FRBR') != '1') { var testSearch = frbrRemoveParameter(currentSearch, 'rw'); testSearch = frbrRemoveParameter(testSearch, 'dt'); testSearch = frbrRemoveParameter(testSearch, 'isd'); testSearch = frbrRemoveParameter(testSearch, 'te'); // console.log('Test Search '+ testSearch); //console.log(sessionStorage.lastSearch); //console.log(window.location.search.indexOf("rw=")); if (sessionStorage.lastSearch || window.location.search.indexOf("rw=") == -1) { if ((testSearch != sessionStorage.lastSearch) || (searchTarget != sessionStorage.searchTarget) || window.location.search.indexOf("rw=") == -1) { sessionStorage.removeItem("skipIds"); sessionStorage.removeItem("unclusterIds"); //console.log("New search clearing list"); } } sessionStorage.lastSearch = testSearch; sessionStorage.searchTarget = searchTarget; } else { //console.log ('FRBR linked titles search'); } var skipIdList = new Object(); if (sessionStorage.skipIds) { skipIdList = JSON.parse(sessionStorage.skipIds); } var unclusterIdList = new Object(); if (sessionStorage.unclusterIds) { unclusterIdList = JSON.parse(sessionStorage.unclusterIds); } //console.log( "saved list: " + sessionStorage.skipIds); if (currentSearch.indexOf("FRBR=1") == -1) { sessionStorage.mySearch = currentSearch; } else { if (sessionStorage.mySearch) { var returnToSearchURL = sessionStorage.mySearch; var returnToSearchLink = '' + returnToSearchLinkText + ''; var linkTabHTML = '

    ' + returnToSearchLink + '

    '; setTimeout(function(){ if (hideFacets) { jQuery("#limitcolumn_title").hide(); jQuery("#limitcolumn_availability").hide(); setTimeout(function() { jQuery(".facet").hide(); }, 150); jQuery(".navigatorCheckBox").hide(); jQuery(".limitcolumn_button").hide(); } jQuery(".navigatorName a").each(function() { curHref = jQuery(this).attr('href'); curHref = curHref.replace(".limitcolumn.navigatorclick?", "?FRBR=1&"); jQuery(this).attr('href', curHref); }); //jQuery(".navigatorName a").contents().unwrap(); if (hideFacets) { jQuery("#facetFormFORMAT").parent().show(); jQuery("#facetFormFRBR_FORMAT").parent().show(); jQuery("#facetFormERC_FORMAT").parent().show(); } jQuery("#limitcolumn_title").before(linkTabHTML); }, 300); jQuery(document).ready(function() { setTimeout(function() { jQuery('#sortSelect option[value!=""][value]').each(function() { var sortCode = jQuery(this).attr('value'); jQuery(this).removeAttr('onchange'); //jQuery(this).attr('onclick', 'window.location="'+window.location.href+'&st='+sortCode+'"'); jQuery(this).click(function() { window.location = window.location.href + '&st=' + sortCode; }); }); jQuery(".nonmobile .pagination .resultsToolbar_paginationNumbers a, .nonmobile .pagination .navigationImage a").each(function() { var curHref = jQuery(this).attr('href'); var pageLink = curHref.match(/handlepagingviasearchsession\/[0-9]*/); pageLink = pageLink[0].replace("handlepagingviasearchsession/", ""); pageHit = pageLink * 12; curHref = curHref.replace(/search\/results.*\?/, "search/results?FRBR=1&"); if (curHref.search("rw=") > 0) { curHref = curHref.replace(/rw=[0-9]*/, "rw=" + pageHit); } else { curHref += "&rw=" + pageHit; } jQuery(this).attr('href', curHref); }); if (jQuery('.mobile').length > 0) { jQuery(".mobile .paginationSingles .pageLink").each(function() { var curHref = jQuery(this).attr('href'); var pageLink = curHref.match(/handlepagingviasearchsession\/[0-9]*/); pageLink = pageLink[0].replace("handlepagingviasearchsession/", ""); pageHit = (pageLink - 1) * 12; curHref = curHref.replace(/search\/results.*\?/, "search/results?FRBR=1&"); if (curHref.search("rw=") > 0) { curHref = curHref.replace(/rw=[0-9]*/, "rw=" + pageHit); } else { curHref += "&rw=" + pageHit; } jQuery(this).attr('href', curHref); }); jQuery(".mobile #paginationForm #paginationInput").keyup(function() { var pageOnclick = '' + jQuery(".mobile #paginationForm #paginationButton").attr('onclick'); var pageHit = jQuery('.mobile #paginationForm #paginationInput').val(); if (pageHit == 0) { pageHit = 1; } pageHit = (pageHit - 1) * 12; pageOnclick = pageOnclick.replace(/[&]rw=[0-9]*/g, ""); pageOnclick = pageOnclick.replace(/[&]t:ac=[0-9]*/g, ""); pageOnclick = pageOnclick.replace(/search\/results.*\?/, "search/results?FRBR=1&rw=" + pageHit + "&"); jQuery(".mobile #paginationForm #paginationButton").attr('onclick', pageOnclick); }); } }, 300); }); jQuery('#q').attr('value', ""); //setTimeout("jQuery('#sortSelect').hide()",500); if (frbrGetSearchParam('DISP') != "") { var dispDocId = unescape(frbrGetSearchParam('DISP')); var linkToClick = "a[onclick*='" + dispDocId + "'][id*=detailLink]"; if (linkToClick == "") { //nonmodal display linkToClick = "a[href*='" + dispDocId + "'][id*=detailLink]"; } //console.log("click link "+ linkToClick); setTimeout(function() { $J(linkToClick).click() }, 500); // $(document).ready(function(){jQuery(linkToClick).click()}); } } } jQuery(document).ready(function() { jQuery("div.resultsToolbar_num_results").append('

    (Some may be grouped)

    '); });} //end of section to only execute if Bento is not in play//*******************************************************************************************************************//function setupFormats() { var frbrFormats = { "Books": { "id": "frbr-book", "title": "Book", "code": "BOOK", "facetCode": " ", "ils": true, "erc": true }, "Audio disc": { "id": "frbr-audio-disc", "title": "Audio disc", "code": "SOUNDDISC", "facetCode": " ", "ils": true, "erc": true }, "Continuing Resources": { "id": "frbr-continuing-resources", "title": "Continuing Resources", "code": "CR", "facetCode": " ", "ils": true, "erc": true }, "Video cassette": { "id": "frbr-video-cassette", "title": "Video cassette", "code": "VIDEOCASS", "facetCode": " ", "ils": true, "erc": true }, "Microform": { "id": "frbr-microform", "title": "Microform", "code": "MICROFORM", "facetCode": " ", "ils": true, "erc": true }, "Audio cassette": { "id": "frbr-audio-cassette", "title": "Audio cassette", "code": "SOUNDCASS", "facetCode": " ", "ils": true, "erc": true }, "Video disc": { "id": "frbr-video-disc", "title": "Video disc", "code": "VIDEODISC", "facetCode": " ", "ils": true, "erc": true }, "Maps": { "id": "frbr-maps", "title": "Maps", "code": "MAP", "facetCode": " ", "ils": true, "erc": true }, "Visual Materials": { "id": "frbr-visual-materials", "title": "Visual Materials", "code": "VISUAL", "facetCode": " ", "ils": true, "erc": true }, "Computer file": { "id": "frbr-computer-file", "title": "Computer file", "code": "COMPFILE", "facetCode": " ", "ils": true, "erc": true }, "Sound recording": { "id": "frbr-sound-recording", "title": "Sound recording", "code": "SOUNDREC", "facetCode": " ", "ils": true, "erc": true }, "Music Sound Recording": { "id": "frbr-music-sound-recording", "title": "Music Sound Recording", "code": "MUSICSNDREC", "facetCode": " ", "ils": true, "erc": true }, "Music": { "id": "frbr-music", "title": "Music", "code": "NOTATEDMUSIC", "facetCode": " ", "ils": true, "erc": true }, "Manuscript": { "id": "frbr-manuscript", "title": "Manuscript", "code": "MS", "facetCode": " ", "ils": true, "erc": true }, "Regular print": { "id": "frbr-regular-print", "title": "Regular Print", "code": "UNKNOWN", "facetCode": " ", "ils": true, "erc": true }, "Atlas": { "id": "frbr-atlas", "title": "Atlas", "code": "ATLAS", "facetCode": " ", "ils": true, "erc": true }, "Filmstrip": { "id": "frbr-filmstrip", "title": "Filmstrip", "code": "FILMSTRIP", "facetCode": " ", "ils": true, "erc": true }, "Section": { "id": "frbr-section", "title": "Section", "code": "SECTION", "facetCode": " ", "ils": true, "erc": true }, "Motion picture": { "id": "frbr-motion-picture", "title": "Motion picture", "code": "MOTIONPICT", "facetCode": " ", "ils": true, "erc": true }, "Kit": { "id": "frbr-kit", "title": "Kit", "code": "KIT", "facetCode": " ", "ils": true, "erc": true }, "Mixed materials": { "id": "frbr-mixed-materials", "title": "Mixed materials", "code": "MIXED", "facetCode": " ", "ils": true, "erc": true }, "Remote sensing image": { "id": "frbr-remote-sensing-image", "title": "Remote sensing image", "code": "REMOTESEN", "facetCode": " ", "ils": true, "erc": true }, "Picture": { "id": "frbr-picture", "title": "Picture", "code": "PICTURE", "facetCode": " ", "ils": true, "erc": true }, "3-D Object": { "id": "frbr-3d-object", "title": "3-D Object", "code": "OBJECT", "facetCode": " ", "ils": true, "erc": true }, "Video Cartridge": { "id": "frbr-video-cartridge", "title": "Video cartridge", "code": "VIDEOCART", "facetCode": " ", "ils": true, "erc": true }, "Large Print": { "id": "frbr-large-print", "title": "Large print", "code": "LARGEPRINT", "facetCode": " ", "ils": true, "erc": true }, "Non projected graphic": { "id": "frbr-non-projected-graphic", "title": "Non projected graphic", "code": "NONPROJGRAPH", "facetCode": " ", "ils": true, "erc": true }, "Video recording": { "id": "frbr-video-recording", "title": "Video recording", "code": "VIDEOREC", "facetCode": " ", "ils": true, "erc": true }, "Chart": { "id": "frbr-chart", "title": "Chart", "code": "CHART", "facetCode": " ", "ils": true, "erc": true }, "Diagram": { "id": "frbr-diagram", "title": "Diagram", "code": "DIAGRAM", "facetCode": " ", "ils": true, "erc": true }, "Slide": { "id": "frbr-slide", "title": "Slide", "code": "SLIDE", "facetCode": " ", "ils": true, "erc": true }, "Print": { "id": "frbr-print", "title": "Print", "code": "PRINT", "facetCode": " ", "ils": true, "erc": true }, "Tactile": { "id": "frbr-tactile", "title": "Tactile", "code": "TACTILE", "facetCode": " ", "ils": true, "erc": true }, "Drawing": { "id": "frbr-drawing", "title": "Drawing", "code": "DRAWING", "facetCode": " ", "ils": true, "erc": true }, "Flashcard": { "id": "frbr-flash-card", "title": "Flashcard", "code": "FLASHCARD", "facetCode": " ", "ils": true, "erc": true }, "Globe": { "id": "frbr-globe", "title": "Globe", "code": "GLOBE", "facetCode": " ", "ils": true, "erc": true }, "View": { "id": "frbr-view", "title": "View", "code": "VIEW", "facetCode": " ", "ils": true, "erc": true }, "Photo": { "id": "frbr-photo", "title": "Photo", "code": "PHOTO", "facetCode": " ", "ils": true, "erc": true }, "Projected graphic": { "id": "frbr-projected-graphic", "title": "Projected graphic", "code": "UNKNOWN", "facetCode": " ", "ils": true, "erc": true }, "Technical drawing": { "id": "frbr-technical-drawing", "title": "Technical drawing", "code": "TECHDRAWING", "facetCode": " ", "ils": true, "erc": true }, "eBook": { "id": "frbr-ebook", "title": "eBook", "code": "E_BOOK", "facetCode": " ", "ils": false, "erc": true }, "Online Resource": { "id": "frbr-online-resource", "title": "Online Resource", "code": "ER", "facetCode": " ", "ils": true, "erc": true }, "eAudiobook": { "id": "frbr-eaudiobook", "title": "eAudiobook", "code": "E_SOUNDREC", "facetCode": " ", "ils": false, "erc": true }, "eVideo": { "id": "frbr-evideo", "title": "eVideo", "code": "E_VIDEO", "facetCode": " ", "ils": false, "erc": true }, "Cassette": { "id": "frbr-cassette", "title": "Audio cassette", "code": "SOUNDCASS", "facetCode": " ", "ils": true, "erc": true }, "Other": { "id": "frbr-other", "title": "Other", "code": "UNKNOWN", "facetCode": " ", "ils": true, "erc": true },/* Begin CUSTOM */ "Magazines": { "id": "frbr-continuing-resources", "title": "Magazines", "code": "CR", "facetCode": " ", "ils": true, "erc": true }, "DVD": { "id": "frbr-video-disc", "title": "DVD", "code": "VIDEODISC", "facetCode": " ", "ils": true, "erc": true }, "Braille": { "id": "frbr-book", "title": "Braille", "code": "BRAILLE", "facetCode": " ", "ils": true, "erc": true }, "Electronic Resources": { "id": "frbr-online-resource", "title": "Electronic Resources", "code": "ER", "facetCode": " ", "ils": true, "erc": true }, "Looseleaf": { "id": "frbr-continuing-resources", "title": "Looseleaf", "code": "CR", "facetCode": " ", "ils": true, "erc": true }, "Notated music": { "id": "frbr-music", "title": "Music", "code": "NOTATEDMUSIC", "facetCode": " ", "ils": true, "erc": true }, "Unspecified": { "id": "frbr-other", "title": "Other", "code": "UNKNOWN", "facetCode": " ", "ils": true, "erc": true }, "Blu-ray": { "id": "frbr-bluray", "title": "Blu-ray", "code": "BLURAY", "facetCode": " ", "ils": true, "erc": true }, "Newspapers": { "id": "frbr-newspaper", "title": "Newspapers", "code": "NEWSPAPER", "facetCode": " ", "ils": true, "erc": true }, "Jpeg Images": { "id": "frbr-asset", "title": "e-Magazine", "code": "jpg", "facetCode": " ", "ils": true, "erc": true }, "Pdf Documents": { "id": "frbr-asset", "title": "PDF", "code": "pdf", "facetCode": " ", "ils": true, "erc": true }/* End CUSTOM */ } //console.log('frbrFormatBOOK:'+frbrFormats['Books']['code']); //console.log('frbrFormatE_BOOK:'+frbrFormats['eBook']['code']); //console.log('frbrFormatBOOK:'+frbrFormats['BOOK']['code']); return frbrFormats;}//*******************************************************************************************************************//function removeGmd(titleData) { //console.log("tD:"+titleData); titleData = titleData.replace(/ *\[sound recording *(\([A-Za-z0-9_-]*\))* *\]/i, ""); titleData = titleData.replace(/ *\[videorecording *(\([A-Za-z0-9_-]*\))* *\]/i, ""); titleData = titleData.replace(/ *\[text .large print.\]/i, ""); titleData = titleData.replace(/ *\[microform\]/i, ""); titleData = titleData.replace(/ *\[computer file\]/i, ""); titleData = titleData.replace(/ *\[electronic resource\]/i, ""); titleData = titleData.replace(/ *\[filmstrip\]/i, ""); titleData = titleData.replace(/ *\[braille\]/i, ""); titleData = titleData.replace(/ *\[kit\]/i, ""); titleData = titleData.replace(/ *\[motion picture\]/i, ""); titleData = titleData.replace(/ *\[slide\]/i, ""); titleData = titleData.replace(/ *\[transparency\]/i, ""); titleData = titleData.replace(/ *\[realia\]/i, "");/* Begin CUSTOM */ titleData = titleData.replace(/ *\[4K ultra HD blu-ray\]/i,""); titleData = titleData.replace(/ *\[audio book CD\]/i,""); titleData = titleData.replace(/ *\[audio book MP3\]/i,""); titleData = titleData.replace(/ *\[audio book playaway\]/i,""); titleData = titleData.replace(/ *\[audio enabled book\]/i,""); titleData = titleData.replace(/ *\[big book\]/i,""); titleData = titleData.replace(/ *\[blu-ray\]/i,""); titleData = titleData.replace(/ *\[3D blu-ray\]/i,""); titleData = titleData.replace(/ *\[board book\]/i,""); titleData = titleData.replace(/ *\[book discussion group\]/i,""); titleData = titleData.replace(/ *\[box set\]/i,""); titleData = titleData.replace(/ *\[CD-ROM\]/i,""); titleData = titleData.replace(/ *\[chart\]/i,""); titleData = titleData.replace(/ *\[children’s edition\]/i,""); titleData = titleData.replace(/ *\[DS game\]/i,""); titleData = titleData.replace(/ *\[3DS game\]/i,""); titleData = titleData.replace(/ *\[DVD\]/i,""); titleData = titleData.replace(/ *\[DVD-ROM\]/i,""); titleData = titleData.replace(/ *\[equipment\]/i,""); titleData = titleData.replace(/ *\[game\]/i,""); titleData = titleData.replace(/ *\[Go-CHIP Beam\]/i,""); titleData = titleData.replace(/ *\[graphic novel\]/i,""); titleData = titleData.replace(/ *\[jigsaw\]/i,""); titleData = titleData.replace(/ *\[large print\]/i,""); titleData = titleData.replace(/ *\[local history\]/i,""); titleData = titleData.replace(/ *\[magazine\]/i,""); titleData = titleData.replace(/ *\[map\]/i,""); titleData = titleData.replace(/ *\[music CD\]/i,""); titleData = titleData.replace(/ *\[music MP3\]/i,""); titleData = titleData.replace(/ *\[music blu-ray\]/i,""); titleData = titleData.replace(/ *\[music score\]/i,""); titleData = titleData.replace(/ *\[music vinyl\]/i,""); titleData = titleData.replace(/ *\[nintendo switch\]/i,""); titleData = titleData.replace(/ *\[picture\]/i,""); titleData = titleData.replace(/ *\[playstation 2 game\]/i,""); titleData = titleData.replace(/ *\[playstation 3 game\]/i,""); titleData = titleData.replace(/ *\[playstation 4 game\]/i,""); titleData = titleData.replace(/ *\[poster\]/i,""); titleData = titleData.replace(/ *\[text\]/i,""); titleData = titleData.replace(/ *\[toy\]/i,""); titleData = titleData.replace(/ *\[wii game\]/i,""); titleData = titleData.replace(/ *\[wii u game\]/i,""); titleData = titleData.replace(/ *\[x-box game\]/i,""); titleData = titleData.replace(/ *\[x-box one game\]/i,""); titleData = titleData.replace(/ *\[x-box 360 game\]/i,""); titleData = titleData.replace(/ *\[young reader's edition\]/i,""); titleData = titleData.replace(/ *\[e-magazine\]/i,"");/* End CUSTOM */ return titleData;}/* Begin CUSTOM */function removeLibrary(titleData) { titleData = titleData.replace(/ *(\([A-Za-z0-9 _-]*\))$/i,""); return titleData;}/* End CUSTOM *///*******************************************************************************************************************//function removeSubtitle(titleData) { titleData = titleData.replace(/: a novel *.*/i,""); return titleData}//*******************************************************************************************************************//// On Each Hit Loadedfunction frbrSearch(rId) { frbrFormats = setupFormats();if (verboseMode == true) { frbrishAnalysis = {}; frbrishAnalysis.resultId = rId;} if (currentSearch.indexOf("FRBR=1") == -1) { var myProfile = com_sirsi_ent_page.friendlyUrl; //'frbr'; var myLocale = com_sirsi_ent_page.localeCode; if (jQuery('.frbrNote').length == 0) { // jQuery("div.resultsToolbar_num_results").append('

    (Some may be grouped)

    '); } var hitSelector = '#' + rId.replace(/hitlist/, "results_bio"); //console.log('hitSelector: '+hitSelector); $J('.hitNumber').hide(); isErcHit = 0; var hitDocId = $J('#' + rId + '_DOC_ID').text(); if (hitDocId == "") { isErcHit = 1; hitDocId = $J('#' + rId + '_ERC_ID').text(); hitFullId = $J(hitSelector + ' .displayDetailLink > a').attr('onclick'); //console.log('hitFullId: ' +hitFullId); if (hitFullId == null) { hitFullId = $J(hitSelector + ' .displayDetailLink > a').attr('href'); hitFullId = hitFullId.replace(/^.*detailnonmodal./, ""); hitFullId = hitFullId.replace(/\/.*$/, ""); hitFullId = hitFullId.replace(/\$002f/g, "/"); } else { hitFullId = hitFullId.toString(); hitFullId = hitFullId.match(/ent:.*\?/); hitFullId = String(hitFullId); hitFullId = hitFullId.replace(/\/.*$/, ""); // hitFullId = hitFullId.replace("\/[0-9]+\/[0-9]+\/[0-9]+\\?", ""); hitFullId = hitFullId.replace(/\$002f/g, "/"); } //console.log('hitFullId ' + hitFullId); hitDocId = hitFullId; } var isIlsHit = 0;/* Begin CUSTOM */ var isAssetHit = 0; var isMag = 0;/* End CUSTOM */ if (hitDocId.indexOf("SD_ILS") > -1) { isIlsHit = 1;/* Begin CUSTOM */ if (jQuery(hitSelector+' .displayElementText.FORMAT .formatTypeIcon-CR').length) { //console.log("is magazine"); isMag = 1; }/* End CUSTOM */ }/* Begin CUSTOM */ else if (hitDocId.indexOf("SD_ASSET") > -1) { isAssetHit = 1; }/* End CUSTOM */ //console.log('Checking Hit ' + rId + ' Doc ID ' +hitDocId);if (verboseMode == true) { frbrishAnalysis.hitDocId = hitDocId; frbrishAnalysis.skipIdList = skipIdList; frbrishAnalysis.skipIdTest = skipIdList[hitDocId];} if (skipIdList[hitDocId]) { $J(hitSelector).parent().parent().hide(); //console.log(' Hit found in save list so not displayed');if (verboseMode == true) { frbrishAnalysis.isSkip = true; console.log(frbrishAnalysis);} } else { //console.log(' Hit not found in save list now searching for multiple titles');if (verboseMode == true) { frbrishAnalysis.isSkip = false;} var baseRssURL = "/client/rss/hitlist/" + myProfile + "/"; var baseSearchURL = "/client/" + myProfile + "/search/results?"; var curTitle = $J('#' + rId + '_FRBR_AUTHORIZED_TITLE').text(); var curMainTitle = $J('#' + rId + '_FRBR_TITLE').text(); if ((curTitle.match(/^Selections$/) != null) || (curTitle.match(/^Selections\./) != null) || (curTitle.indexOf(". Selections") > -1)) { curTitle = ""; } // if the authorized title does not contain Vol., Volume, or Part, but the main title does, then do not use the authorized title for searching else if ((curTitle.match(/\. Vol\. [0-9]/) == null) && (curTitle.match(/\. Volume [0-9]/) == null) && (curTitle.match(/\. Part [0-9]/) == null)) { if ((curMainTitle.match(/\. Vol\. [0-9]/) != null) || (curMainTitle.match(/\. Volume [0-9]/) != null) || (curMainTitle.match(/\. Part [0-9]/) != null)) { curTitle = ""; } } var curAuthor = $J('#' + rId + '_FRBR_AUTHOR').text(); var authorizedTitle = 1; if (curTitle == "") { // will have issues if no author & uniform title is made up of common words curTitle = $J('#' + rId + '_FRBR_TITLE').text();/* Begin CUSTOM */ curTitle = curTitle.replace(/\s*[:;=\/]$/, ""); if (curTitle == "" && isAssetHit == 0) { // will have issues if no author & uniform title is made up of common words/* End CUSTOM */ curTitle = $J('#' + rId + '_' + ercTitleCode).text(); curMainTitle = $J('#' + rId + '_' + ercTitleCode).text(); }/* Begin CUSTOM */ else if (curTitle == "" && isAssetHit == 1) { detailNum = rId.replace("hitlist", "detailLink"); curTitle = $J('#'+detailNum).text(); }/* End CUSTOM */ authorizedTitle = 0; }/* Begin CUSTOM */ if (curAuthor == "" && isIlsHit == 0 && isAssetHit == 0) {/* End CUSTOM */ curAuthor = $J('#' + rId + '_' + ercAuthorCode).text(); } //console.log(rId + " Author:|" + curAuthor + "|"); //console.log(rId + " Title:|" +curTitle + "|"); // require both Title and Author to attempt collapse; allow Title only if it is a Uniform Title curTitle = curTitle.replace(/ : *$/,'');/* Begin CUSTOM */ if (((curTitle != "") && (curAuthor != "")) || ((authorizedTitle == 1) && (curTitle != "")) || ((isAssetHit == 1 || isMag == 1) && (curTitle != "")) ) {/* End CUSTOM */ //curTitle.replace(/;/g,""); curTitle = removeGmd(curTitle);/* Begin CUSTOM */ if (isMag == 1 || isAssetHit == 1) { curTitle = removeLibrary(curTitle); }/* End CUSTOM */if (verboseMode == true) { if (curAuthor != "") { frbrishAnalysis.curAuthor = curAuthor; } else { frbrishAnalysis.curAuthor = ""; } frbrishAnalysis.curTitle = curTitle; frbrishAnalysis.curMainTitle = curMainTitle;} var frbrSearchString = 'qu=TITLE:\"' + curTitle.replace(/ /g, '+') + '\"'; var rssSearchString = 'qu=TITLE:\"' + curTitle.replace(/ /g, '+').replace(/[?&;¿¡]/g, '') + '\"'; if (curAuthor != "") { frbrSearchString += '&qu=AUTHOR:\"' + curAuthor.replace(/ /g, '+') + '\"'; rssSearchString += '&qu=AUTHOR:\"' + curAuthor.replace(/ /g, '+').replace(/[?&;¿¡]/g, '') + '\"'; } // console.log('frbr search string ' + frbrSearchString); // console.log('rss search string ' + rssSearchString); var frbrRssSearchURL = baseRssURL + rssSearchString; var frbrHitSearchURL = baseSearchURL + frbrSearchString + '&FRBR=1'; if (searchFacets !== '') { frbrRssSearchURL += '&qf=' + searchFacets; frbrHitSearchURL += '&qf=' + searchFacets; } if (searchLimit !== '') { frbrRssSearchURL += '&lm=' + searchLimit; frbrHitSearchURL += '&lm=' + searchLimit; } if (searchTarget !== '') { frbrRssSearchURL += '&te=' + searchTarget; frbrHitSearchURL += '&te=' + searchTarget; } frbrRssSearchURL += '&ln=' + myLocale; //console.log('rss search string ' + frbrRssSearchURL);if (!unclusterIdList.hasOwnProperty(frbrSearchString)) { unclusterIdList[frbrSearchString] = {};}if (verboseMode == true) { frbrishAnalysis.rss = window.location.origin + frbrRssSearchURL; frbrishAnalysis.url = window.location.origin + frbrHitSearchURL; frbrishAnalysis.hits = []; frbrishAnalysis.frbrSearchString = frbrSearchString;} var numTitles = 0; $J.ajax({ type: 'GET', url: frbrRssSearchURL, dataType: 'xml', async: false, success: function(data) { var entries = $J(data).find('entry'); numTitles = $J(entries).length; if (numTitles > 1) { //console.log(' Search found '+ numTitles +' titles'); var expressions = []; //console.log("authTitle: "+authorizedTitle); if (authorizedTitle == 0) {if (verboseMode == true) { frbrishAnalysis.isAuthTitle = false;} //console.log("curTitle:"+curTitle); //console.log("curMainTitle:"+curMainTitle); var seriesPattern = new RegExp("^" + curMainTitle.toUpperCase() + " AND |^" + curMainTitle.toUpperCase() + "\.{0,1} VOLUME |^" + curMainTitle.toUpperCase() + "\.{0,1} VOL\. |^" + curMainTitle.toUpperCase() + "\.{0,1} PART |^" + curMainTitle.toUpperCase() + "\.{0,1} [0-9]{1,} |^" + curMainTitle.toUpperCase() + " Y |" + curMainTitle.toUpperCase() + "\. [A-Z ]{3,} "); //console.log("seriesPattern:"+seriesPattern); var frbrEntries = $J.map($J(entries), function(frbrEntry) { var frbrHitTitle = $J(frbrEntry).find('title').text().replace("Title ", ""); frbrHitTitle = removeGmd(frbrHitTitle); frbrHitTitle = removeSubtitle(frbrHitTitle); //console.log("authTitle=0: "+frbrHitTitle.toUpperCase()+"|curTitle:"+curTitle.toUpperCase()); //console.log($J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//,"")); //console.log("frbrHitTitle:"+frbrHitTitle);/* Begin CUSTOM */ frbrHitTitle = frbrHitTitle.replace(/\s*[:;=\/]$/, ""); frbrHitTitle = frbrHitTitle.replace(/\s\/\s.*$/, ""); if ((isMag == 1 || isAssetHit == 1) && isMag == 1 && frbrHitFormat.indexOf('Jpeg Image') < 0 && frbrHitFormat.indexOf('Magazines') < 0) { frbrHitTitle = removeLibrary(frbrHitTitle); } var frbrHitFormat = $J(this).find('content').text().replace(/^.*Format..160;/,""); frbrHitFormat = frbrHitFormat.replace(/[<]br\/[>].*$/,"");/* End CUSTOM */var frbrHit = {};if (verboseMode == true) { frbrHit.entry = $J(frbrEntry); frbrHit.frbrHitTitle = frbrHitTitle; frbrHit.id = $J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//,"");} if ($J(frbrEntry).find('id').text().indexOf(hitDocId) !== -1) { //don't eliminate the title we started from!if (verboseMode == true) { frbrHit.result = "Starting record: Retain for cluster"; frbrishAnalysis.hits.push(frbrHit);} return frbrEntry; } else if (frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase()) > 5 || (authorizedTitle == 0 && frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase()) < 0)) { //console.log("ctitle found in ftitle at(1): "+frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase()));if (verboseMode == true) { frbrHit.result = "curTitle not found in first 5 characters of frbrHitTitle: Don't include in cluster"; frbrishAnalysis.hits.push(frbrHit);} unclusterIdList[frbrSearchString][$J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//, "")] = true; //removedIds.push($J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//,"") ); //$J(this).remove(); numTitles--; return null; } else if (seriesPattern.test(frbrHitTitle.toUpperCase())) { //console.log("volume pattern match:"+$J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//,"") );if (verboseMode == true) { frbrHit.result = "Series/Volume pattern match: Don't include in cluster"; frbrishAnalysis.hits.push(frbrHit);} unclusterIdList[frbrSearchString][$J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//, "")] = true; //removedIds.push($J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//,"") ); //$J(this).remove(); numTitles--; return null; } else if (frbrHitTitle.length > curTitle.length + 6 || curTitle.length > frbrHitTitle.length + 6 ) {if (verboseMode == true) { frbrHit.result = "frbrHitTitle is more than 6 characters longer than curTitle, or curTitle is more than 6 characters longer than frbrHitTitle"; frbrishAnalysis.hits.push(frbrHit);} numTitles--; return null; } else if ((isMag == 1 || isAssetHit == 1) && frbrHitFormat.indexOf('Jpeg Image') < 0 && frbrHitFormat.indexOf('Magazines') < 0) {if (verboseMode == true) { frbrHit.result = "Is an Asset or Magazine hit with a format other than Jpeg or Magazine: Don't include in cluster"; frbrishAnalysis.hits.push(frbrHit);} unclusterIdList[ $J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//,"") ]=true; //removedIds.push($J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//,"") ); //$J(this).remove(); numTitles--; return null; } else {if (verboseMode == true) { frbrHit.result = "Matching record: Retain for cluster"; frbrishAnalysis.hits.push(frbrHit);} return frbrEntry; } //console.log(' Revised search total: '+ numTitles +' titles'); }); } // authorizedTitle = 0 else { //process hits from authorized title searches //console.log("curTitle:"+curTitle); //console.log("curMainTitle:"+curMainTitle); var seriesPattern = new RegExp("^" + curMainTitle.toUpperCase() + " AND |^" + curMainTitle.toUpperCase() + "\.{0,1} VOLUME |^" + curMainTitle.toUpperCase() + "\.{0,1} VOL\. |^" + curMainTitle.toUpperCase() + "\.{0,1} PART |^" + curMainTitle.toUpperCase() + "\.{0,1} [0-9]{1,} |^" + curMainTitle.toUpperCase() + "\.{0,1} I[IVX]{1,} |" + curMainTitle.toUpperCase() + " IN |" + curMainTitle.toUpperCase() + " Y |" + curMainTitle.toUpperCase() + "\. [A-Z ]{3,} "); //console.log("seriesPattern:"+seriesPattern); var frbrEntries = $J.map($J(entries), function(frbrEntry) { var frbrHitTitle = $J(frbrEntry).find('title').text().replace("Title ", ""); frbrHitTitle = removeGmd(frbrHitTitle); //console.log($J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//,"")); //console.log("frbrHitTitle:"+frbrHitTitle);/* Begin CUSTOM */ frbrHitTitle = frbrHitTitle.replace(/\s*[:;=\/]$/, ""); frbrHitTitle = frbrHitTitle.replace(/\s\/\s.*$/, ""); if ((isMag == 1 || isAssetHit == 1) && isMag == 1 && frbrHitFormat.indexOf('Jpeg Image') < 0 && frbrHitFormat.indexOf('Magazines') < 0) { frbrHitTitle = removeLibrary(frbrHitTitle); } var frbrHitFormat = $J(this).find('content').text().replace(/^.*Format..160;/,""); frbrHitFormat = frbrHitFormat.replace(/[<]br\/[>].*$/,"");/* End CUSTOM */var frbrHit = {};if (verboseMode == true) { frbrHit.entry = $J(frbrEntry); frbrHit.frbrHitTitle = frbrHitTitle; frbrHit.id = $J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//, "");} // Check if FRBR search hit is the same as the current main title followed by certain words that indicate a later volume in a series if ($J(frbrEntry).find('id').text().indexOf(hitDocId) !== -1) { //don't eliminate the title we started from!if (verboseMode == true) { frbrHit.result = "Starting record: Retain for cluster"; frbrishAnalysis.hits.push(frbrHit);} if (unclusterIdList[frbrSearchString][$J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//, "")]) { unclusterIdList[frbrSearchString][$J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//, "")] = false; } return frbrEntry; } else if (seriesPattern.test(frbrHitTitle.toUpperCase())) { //console.log("volume pattern match:"+$J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//,"") );if (verboseMode == true) { frbrHit.result = "Series/Volume pattern match: Don't include in cluster"; frbrishAnalysis.hits.push(frbrHit);} unclusterIdList[frbrSearchString][$J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//, "")] = true; //removedIds.push($J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//,"") ); //$J(this).remove(); numTitles--; return null;/* Begin CUSTOM */ } else if ((isMag == 1 || isAssetHit == 1) && frbrHitFormat.indexOf('Jpeg Image') < 0 && frbrHitFormat.indexOf('Magazines') < 0) {if (verboseMode == true) { frbrHit.result = "Is an Asset or Magazine hit with a format other than Jpeg or Magazine: Don't include in cluster"; frbrishAnalysis.hits.push(frbrHit);} unclusterIdList[frbrSearchString][ $J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//,"") ]=true; //removedIds.push($J(frbrEntry).find('id').text().replace(/ent:\/\/.*\//,"") ); //$J(this).remove(); numTitles--; return null;/* End CUSTOM */ } else if ((frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase()) < 5 && frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase()) >= 0) && (frbrHitTitle.length > curTitle.length + 6 || curTitle.length > frbrHitTitle.length + 6 )) {if (verboseMode == true) { frbrHit.result = "curTitle found in first 5 characters of frbrHitTitle, or title lengths differ by more than 6 characters: Don't include in cluster"; frbrishAnalysis.hits.push(frbrHit);} numTitles--; return null; } else {if (verboseMode == true) { frbrHit.result = "Matching record: Retain for cluster"; frbrishAnalysis.hits.push(frbrHit);} return frbrEntry; } }); }if (verboseMode == true) { frbrishAnalysis.numHits = numTitles; frbrishAnalysis.unclusterIds = unclusterIdList; console.log(frbrishAnalysis);} //console.log(' Final revised search total: '+ numTitles +' titles'); if (numTitles < 2) { return; } //console.log(removedIds); //console.log(frbrEntries); sessionStorage.unclusterIds = JSON.stringify(unclusterIdList); //console.log(JSON.stringify(unclusterIdList)); var divSelector = '#' + rId.replace(/hitlist/, "results_bio"); if ($J('body').hasClass('mobile')) { divSelector = '#' + rId.replace(/hitlist/, "results_cell"); } $J(divSelector).parent().children('.results_top_half').children('.results_chkbox').hide(); $J(divSelector).parent().children('.results_right').hide(); $J(divSelector).children('.thumb_hidden').hide(); $J(divSelector).parents('.cell_wrapper').addClass("frbrClusterDisplay");/* Begin CUSTOM */ $J('.frbrClusterDisplay .displayElementText.BIBSUMMARY').parent().hide(); $J('.frbrClusterDisplay .displayElementText.DESCRIPTION').parent().hide(); $J('.frbrClusterDisplay .displayElementText.EDITION').parent().hide(); $J('.frbrClusterDisplay .displayElementText.ELECTRONIC_ACCESS').parent().hide(); //$J('.frbrClusterDisplay .displayElementText.ERC_FORMAT').parent().hide(); $J('.frbrClusterDisplay .displayElementText.ERC_FORMAT').closest('.thumb_hidden').show().css('visibility','hidden'); //$J('.frbrClusterDisplay .displayElementText.FORMAT').parent().hide(); $J('.frbrClusterDisplay .displayElementText.FORMAT').closest('.thumb_hidden').show().css('visibility','hidden'); $J('.frbrClusterDisplay .displayElementText.LOCALURL').parent().hide(); $J('.frbrClusterDisplay .displayElementText.MEDIA_TYPE').parent().hide(); $J('.frbrClusterDisplay .displayElementText.PUBDATE_RANGE').parent().hide(); $J('.frbrClusterDisplay .displayElementText.TOPIC').parent().hide();/* End CUSTOM */ //var multipleTag = ''; //var multipleTag = '
    • ${LIST_EDITIONS}
    '; //var multipleTag = '

    ' + multipleFormatsText + '

      • Search all editions

    '; var multipleTag = '

    ' + multipleFormatsText + '

    '; $J(divSelector).append(multipleTag); var frbrThumbButton = ''; $J(divSelector).parents('.results_cell').append(frbrThumbButton); //console.log($J(divSelector).parents('.results_cell').attr('id')); divSelector = '#' + rId.replace(/hitlist/, "results_bio") + " .availableDiv"; //, "availableDiv"); $J(divSelector).hide(); $J(divSelector).next('br').hide(); divSelector = '#' + 'ercAvailableDiv_' + rId; setTimeout(function() { $J(divSelector).hide() }, 500); var divSelector2 = '#' + rId.replace(/hitlist/, "results_bio"); setTimeout(function() { $J(divSelector2).parent().parent().children('button[class^=availability-button]').hide() }, 5000); setTimeout(function() { $J(divSelector2).parent().parent().children('.availability-table-div').hide() }, 5000); //var imgLinkToClick = "a[onclick*='" + dispDocId + "'][id*=detailClick]"; var imgLinkSelector = '.' + rId.replace(/hitlist/, "detailClick"); $J(imgLinkSelector).attr('href', frbrHitSearchURL); $J(imgLinkSelector).attr('onclick', null); linkSelector = '#' + rId.replace(/hitlist/, "detailLink"); $J(linkSelector).attr('href', frbrHitSearchURL); $J(linkSelector).attr('onclick', null); var frbrTitle = removeGmd($J(linkSelector).text());/* Begin CUSTOM */ if (isMag == 1 || isAssetHit == 1) { frbrTitle = removeLibrary(frbrTitle); }/* End CUSTOM */ frbrTitle = frbrTitle.replace(/^\n/, ""); frbrTitle = frbrTitle.replace(/\n$/, ""); testFrbrTitle = frbrTitle.toUpperCase().replace(/^The |^An |^A /, ""); testFrbrTitle = testFrbrTitle.replace(/\.|,|:|=/g, ""); var frbrDialogTitle = frbrTitle; if (typeof $J('#' + rId + '_FRBR_AUTHORIZED_TITLE .FRBR_AUTHORIZED_TITLE_value') !== 'undefined') { testAuthTitle = $J('#' + rId + '_FRBR_AUTHORIZED_TITLE').text().toUpperCase(); if ((testFrbrTitle.toUpperCase().indexOf(testAuthTitle) < 0 && testAuthTitle.indexOf(testFrbrTitle.toUpperCase()) < 0)) { //If the authorized title has a qualifier, display it in parentheses after the current record's main title //Otherwise, display the authorized title followed by the current record's main title var qualPattern = new RegExp(/ [(][^)]*[)]$/); if (qualPattern.test($J('#' + rId + '_FRBR_AUTHORIZED_TITLE').text())) { frbrTitle = frbrTitle + ' (' + $J('#' + rId + '_FRBR_AUTHORIZED_TITLE').text() + ')'; frbrDialogTitle = frbrDialogTitle + ' (' + $J('#' + rId + '_FRBR_AUTHORIZED_TITLE').text() + ')'; } else { //Display the authorized title, then the "current" record's title frbrTitle = $J('#' + rId + '_FRBR_AUTHORIZED_TITLE').text() + ' (' + frbrTitle + ')'; frbrDialogTitle = $J('#' + rId + '_FRBR_AUTHORIZED_TITLE').text() + ' (' + frbrDialogTitle + ')'; } } } $J(linkSelector).html(frbrTitle); $J(frbrEntries).each(function() { var frbrHitTitle = $J(this).find('title').text().replace("Title ", "");/* Begin CUSTOM */ frbrHitTitle = removeGmd(frbrHitTitle); frbrHitTitle = frbrHitTitle.replace(/\s*[:;=\/]$/, ""); if ((isMag == 1 || isAssetHit == 1) && isMag == 1 && frbrHitFormat.indexOf('Jpeg Image') < 0 && frbrHitFormat.indexOf('Magazines') < 0) { frbrHitTitle = removeLibrary(frbrHitTitle); } var frbrHitFormat = $J(this).find('content').text().replace(/^.*Format..160;/,""); frbrHitFormat = frbrHitFormat.replace(/[<]br\/[>].*$/,"");/* End CUSTOM */ /*if (frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase()) > 5 || (authorizedTitle == 0 && frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase()) < 0)) { //console.log("ctitle found in ftitle at(2): "+frbrHitTitle.toUpperCase().indexOf(curTitle.toUpperCase())); $J(this).remove(); return; }*//* Begin CUSTOM */ if (isMag == 1 && frbrHitFormat.indexOf('Jpeg Image') < 0 && frbrHitFormat.indexOf('Magazines') < 0) { $J(this).remove(); return; }/* End CUSTOM */ var el = $J(this); var frbrHitId = $J(el).find('id').text().replace(/ent:\/\/.*\//, ""); //if (removedIds[frbrHitId]) { //######## //if (unclusterIdList[frbrSearchString][frbrHitId]) { //console.log("is removed hit:"+frbrHitId); // next; //######## //} //######## isErcFrbrHit = 0;/* Begin CUSTOM */ isAssetFrbrHit = 0;/* End CUSTOM */ if ($J(el).find('id').text().indexOf("ERC") > -1) { isErcFrbrHit = 1; frbrFullId = $J(el).find('id').text(); //console.log('Hit id ' + frbrHitId); //console.log("frbrFullId " + frbrFullId); frbrHitId = frbrFullId; }/* Begin CUSTOM */ else if ($J(el).find('id').text().indexOf("ASSET") > -1) { isAssetFrbrHit = 1; frbrFullId = $J(el).find('id').text(); //console.log('Hit id ' + frbrHitId); //console.log("frbrFullId " + frbrFullId); //frbrHitId = frbrFullId; idParts = frbrFullId.split('/'); assetNum = idParts[idParts.length - 2]; assetId = idParts[idParts.length - 1]; frbrHitId = "SD_ASSET:"+assetId; }/* End CUSTOM */ var docInfo = frbrHitId.split(':'); var numAvail = 0; //console.log('docInfo0:'+docInfo[0]); if (displayAvailable) { var availableString = "";/* Begin CUSTOM */ if (docInfo[0] == "SD_ILS" && /^[0-9]*$/.test(docInfo[1])) {/* End CUSTOM */ var titleID = docInfo[1]; //console.log('docInfo1:'+docInfo[1]); if (wsBaseUrl.substr(-1, 1) != "/") { wsBaseUrl += "/"; } if (ilsType == "Horizon") { var ilsURL = wsBaseUrl + 'rest/standard/lookupTitleInfo?clientID=' + clientId + '&includeItemInfo=true&json=true&titleKey=' + titleID + '&callback=?'; } else { var ilsURL = wsBaseUrl + 'rest/standard/lookupTitleInfo?clientID=' + clientId + '&includeAvailabilityInfo=true&json=true&titleID=' + titleID + '&callback=?'; } //console.log(ilsURL); $J.getJSON(ilsURL, function(data) { //console.log(data); if (ilsType == "Horizon") { if (data.titleInfo[0].available) { numAvail = data.titleInfo[0].available; } else { numAvail = 0; } } else { numAvail = data.TitleInfo[0].TitleAvailabilityInfo.totalCopiesAvailable; } availableString = '' + numAvail + ''; //console.log('availableString:'+availableString) jQuery('.frbrAvail_' + titleID).text(availableString); jQuery('#frbrAvailLabel_' + titleID).show(); //add total to count on format line var formatLabel = jQuery('#'+rId+'_frbrLinks .frbrAvail_' + titleID).closest('.frbr-expressions').find('.frbr-menu-labels');/*console.log("expression summary");console.log(formatLabel);var tmpcnt;tempcnt = formatLabel.find('.frbr-number-of-items').text();console.log("|"+tempcnt+"|");console.log("|"+numAvail+"|");console.log(formatLabel.html());*/ if (formatLabel.find('.frbr-number-of-items').length > 0) { formatLabel.find('.frbr-number-of-items').text(parseInt(formatLabel.find('.frbr-number-of-items').text()) + numAvail) } else { if (displayAvailable) { formatLabel.html(formatLabel.html() + ' (' + availableString + ' Available)'); } }//console.log(formatLabel.html()); if (displayAvailable) { //(collapseFormats && displayAvailable) //add total to count on collapsed summary line var frbrSummaryLabel = jQuery('#'+rId+'_frbrLinks .frbrAvail_' + titleID).closest('.results_cell').find('.frbr-sum-of-available'); if (frbrSummaryLabel.html() == "") { frbrSummaryLabel.html(' (0 Available)'); } frbrSummaryLabel.find('.frbr-number-of-items').text(parseInt(frbrSummaryLabel.find('.frbr-number-of-items').text()) + numAvail); } }); } else { /* Query eRC availability */ titleID = frbrHitId.replace(/^ent:\/\/[^\/]+\/[^\/]+\/[^\/:]+:/,""); var numAvail = ""; if (qualifiedErcUrls == true) { var titlesUrl = addPathParams(com_sirsi_ent_widgets.URLS.eRC.titleInfoUrl, encodeAsTapestry(frbrHitId)); //console.log(titlesUrl); jQuery.getJSON(titlesUrl, function(response) { var data = response.eResourceList[0]; if (data && data.status && 'OK' === data.status && data.formats && data.formats.length > 0) { if (data.availability && data.availability.available) { if (data.availability.availableCopies) { // show copies available numAvail = data.availability.availableCopies; } else { // unlimited duration numAvail = '${ERC_UNLIMITED_MESSAGE}'; } } else { // no copies available numAvail = 0; } } availableString = '' + numAvail + ''; //jQuery('.frbrAvail_'+frbrHitId).text(availableString); jQuery('.frbrAvail_' + titleID.replace(/:/g,"_")).text(availableString); jQuery('#frbrAvailLabel_' + titleID.replace(/:/g,"_")).show(); //add total to count on format line var formatLabel = jQuery('#'+rId+'_frbrLinks .frbrAvail_' + titleID.replace(/:/g,"_")).closest('.frbr-expressions').find('.frbr-menu-labels'); if (formatLabel.find('.frbr-number-of-items').length > 0) { formatLabel.find('.frbr-number-of-items').text(parseInt(formatLabel.find('.frbr-number-of-items').text()) + numAvail) } else { if (displayAvailable) { formatLabel.html(formatLabel.html() + ' (' + availableString + ' Available)'); } } if (displayAvailable) { //(collapseFormats && displayAvailable) //add total to count on collapsed summary line var frbrSummaryLabel = jQuery('#'+rId+'_frbrLinks .frbrAvail_' + titleID.replace(/:/g,"_")).closest('.results_cell').find('.frbr-sum-of-available'); if (frbrSummaryLabel.html() == "") { frbrSummaryLabel.html(' (0 Available)'); } if (numAvail == '${ERC_UNLIMITED_MESSAGE}') { frbrSummaryLabel.find('.frbr-number-of-items').text(parseInt(frbrSummaryLabel.find('.frbr-number-of-items').text()) + 1); } else { frbrSummaryLabel.find('.frbr-number-of-items').text(parseInt(frbrSummaryLabel.find('.frbr-number-of-items').text()) + numAvail); } } }); } else { titleID = frbrHitId.replace(/^ent:\/\/[^\/]+\/[^\/]+\/[^\/:]+:/,"") var titlesUrl = addPathParams(com_sirsi_ent_widgets.URLS.eRC.titleInfoUrl, encodeAsTapestry(titleID)); //console.log(titlesUrl); jQuery.getJSON(titlesUrl, function(response) { var data = response.eResourceList[0]; if (data && data.status && 'OK' === data.status && data.formats && data.formats.length > 0) { if (data.availability && data.availability.available) { if (data.availability.availableCopies) { // show copies available numAvail = data.availability.availableCopies; } else { // unlimited duration numAvail = '${ERC_UNLIMITED_MESSAGE}'; } } else { // no copies available numAvail = 0; } } availableString = '' + numAvail + ''; //jQuery('.frbrAvail_'+frbrHitId).text(availableString); jQuery('.frbrAvail_' + titleID.replace(/:/g,"_")).text(availableString); jQuery('#frbrAvailLabel_' + titleID.replace(/:/g,"_")).show(); //add total to count on format line var formatLabel = jQuery('#'+rId+'_frbrLinks .frbrAvail_' + titleID.replace(/:/g,"_")).closest('.frbr-expressions').find('.frbr-menu-labels'); if (formatLabel.find('.frbr-number-of-items').length > 0) { if (numAvail == '${ERC_UNLIMITED_MESSAGE}') { formatLabel.find('.frbr-number-of-items').text(parseInt(formatLabel.find('.frbr-number-of-items').text()) + 1) } else { formatLabel.find('.frbr-number-of-items').text(parseInt(formatLabel.find('.frbr-number-of-items').text()) + numAvail) } } else { if (displayAvailable) { formatLabel.html(formatLabel.html() + ' (' + availableString + ' Available)'); } } if (displayAvailable) { //(collapseFormats && displayAvailable) //add total to count on collapsed summary line var frbrSummaryLabel = jQuery('#'+rId+'_frbrLinks .frbrAvail_' + titleID.replace(/:/g,"_")).closest('.results_cell').find('.frbr-sum-of-available'); if (frbrSummaryLabel.html() == "") { frbrSummaryLabel.html(' (0 Available)'); } if (numAvail == '${ERC_UNLIMITED_MESSAGE}') { frbrSummaryLabel.find('.frbr-number-of-items').text(parseInt(frbrSummaryLabel.find('.frbr-number-of-items').text()) + 1); } else { frbrSummaryLabel.find('.frbr-number-of-items').text(parseInt(frbrSummaryLabel.find('.frbr-number-of-items').text()) + numAvail); } } }); } } } //console.log("frbrHitId: "+frbrHitId); //console.log("hitDocId: "+hitDocId); if (frbrHitId != hitDocId) { skipIdList[frbrHitId] = true; //console.log(' Adding '+frbrHitId+' to list'); } var frbrLinkURL = frbrHitSearchURL + '&DISP=' + frbrHitId; //console.log('Link url ' +frbrLinkURL); var nonmodalLinkURL = $J(el).find('link').attr('href'); if (typeof nonmodalLinkURL !== "undefined") { nonmodalLinkURL = frbrRemoveParameter(nonmodalLinkURL, "ps"); } else { nonmodalLinkURL = " "; } var content = $J(el).find('content').text(); var tags = content.split('
    '); var hasTag = []; jQuery.each(frbrUseFields, function(i, fld) { hasTag[fld] = -1; }); var formatTag = -1; var expressionFormat; //console.log('frbrFormatBOOK:'+frbrFormats['BOOK']['code']); for (var term = 0; term < tags.length; term++) { //console.log('tt:'+tags[term]); var alltags = tags[term].split(''); tags[term] = tags[term].split(''); var termName = alltags.shift(); //translate HTML entities to proper characters var parser = new DOMParser; var dom = parser.parseFromString('' + termName, 'text/html'); termName = dom.body.textContent; tags[term][0] = termName; var termValue = alltags.join(' & '); //console.log('termName(1):'+termName+'|termValue:'+termValue+'|'); if (!(termName == "" && termValue == "")) { // console.log('tt0:'+tags[term][0]); // console.log('isErc:'+isErcFrbrHit); // console.log('formatTag:'+formatTag); if ((tags[term][0] == "Format" || tags[term][0] == "Format:" || (isErcFrbrHit == 1 && (tags[term][0] == "Format" || tags[term][0] == "Format:"))) && formatTag == -1) { // console.log('termName(2):'+termName+'|termValue:'+termValue+'|'); if (termValue.indexOf(" & ") == -1) { // single format term in tag //translate HTML entities to proper characters parser = new DOMParser; dom = parser.parseFromString('' + termValue, 'text/html'); termValue = dom.body.textContent; // console.log('termValue(1):'+termValue+'|'); //formats:'+ frbrFormats[termValue]['code'] +'|'); //console.log("jQiEO:"+jQuery.isEmptyObject(frbrFormats[termValue])+"|"); if (jQuery.isEmptyObject(frbrFormats[termValue])) { //if (typeof frbrFormats[termValue]['code'] === "undefined" || frbrFormats[termValue]['code'].length < 1) { //console.log('frbrFormatBOOK:'+frbrFormats['Book']['code']); frbrFormats[termValue] = []; frbrFormats[termValue]['id'] = "frbr-other"; frbrFormats[termValue]['title'] = termValue; //"Other"; frbrFormats[termValue]['code'] = "UNKNOWN"; } //console.log("fFtcode:"+frbrFormats[termValue]['code']); formatTag = term; tags[term][1] = termValue; expressionFormat = frbrFormats[termValue]['code']; //termValue; if (typeof expressionFormat !== "undefined" && (typeof expressions[expressionFormat] == "undefined" || expressions[expressionFormat].length < 1)) { expressions[expressionFormat] = []; } //console.log('expFormat: ' + expressionFormat); } else { // multiple format terms in tag //console.log('termValue(2):'+termValue+'|'); //console.log('frbrFormatBOOK:'+frbrFormats['BOOK']['code']); var allforms = termValue.split(' & '); allforms.sort(); //console.log("af0:"+allforms[0]+"|"); var tmpexpression = []; for (var checktag = 0; checktag < allforms.length; checktag++) { //console.log("afct:"+allforms[checktag]+"|"); //translate HTML entities to proper characters parser = new DOMParser; dom = parser.parseFromString('' + allforms[checktag], 'text/html'); allforms[checktag] = dom.body.textContent; if (tmpexpression.indexOf(frbrFormats[allforms[checktag]]['code']) == -1) { tmpexpression.push(frbrFormats[allforms[checktag]]['code']); //console.log("tmpexp0:"+tmpexpression[0]); } else { //console.log("checktag(before):"+checktag+"|af[checktag]:"+allforms[checktag]); allforms.splice(checktag, 1); checktag--; //console.log("checktag(after):"+checktag+"|af[checktag]:"+allforms[checktag]); } } //console.log('frbrFormatBOOK:'+frbrFormats['BOOK']['code']); //console.log("af0(2):"+allforms[0]+"|"); if (frbrFormats[allforms[0]]['code'].length < 1) { frbrFormats[allforms[0]]['id'] = "frbr-other"; frbrFormats[allforms[0]]['title'] = "Other"; frbrFormats[allforms[0]]['code'] = "UNKNOWN"; } termValue = allforms.join(' & '); //console.log('termValue(3):'+termValue+'|'); formatTag = term; tags[term][1] = termValue; //console.log("fFtcode:"+frbrFormats[allforms[0]]['code']); expressionFormat = frbrFormats[allforms[0]]['code']; if (typeof expressionFormat != "undefined" && (typeof expressions[expressionFormat] == "undefined" || expressions[expressionFormat].length < 1)) { expressions[expressionFormat] = []; } } } jQuery.each(frbrUseFields, function(i, fld) { if (tags[term][0] == frbrExpressionFields[fld]['label'] || tags[term][0] == frbrExpressionFields[fld]['label'] + ":" || (hasTag[fld] == -1 && tags[term][0].indexOf(frbrExpressionFields[fld]['label']) > -1)) { hasTag[fld] = term; tags[term][1] = termValue; } }); } //end if termname not null } //end for var consoleTmp = ""; if (formatTag > -1) { //console.log("tft:"+tags[formatTag][1]); if (tags[formatTag][1].indexOf(" & ") > -1) { //multi-format record //console.log("made it tft 1"); //console.log("multi-tag tft:"+tags[formatTag][1]); consoleTmp = 'Format ' + tags[formatTag][1] + '|' + frbrFormats[tags[formatTag][1].split(' & ')[0]]['code']; //*** tags[formatTag][1] has an &!! var expressionText = ''; //''; if ($J('body').hasClass('mobile')) { expressionText = '

    '; } //var expressionFormat = tags[formatTag][1] //expressionFormat = expressionFormat.replace(/ \& .*$/, ""); //console.log("made it 1a"); /* //### experimental for multi-format records, for treating subformats as subformats rather than additional formats if (tags[formatTag][1].indexOf("BOOK") > -1) { //console.log("made it 2"); if (tags[formatTag][1].indexOf("LARGEPRINT") > -1) { //console.log("made it 3a"); var tmptag = tags[formatTag][1]; tmptag = tmptag.replace("& LARGEPRINT",""); tmptag = tmptag.replace("BOOK", "BOOK (Large print)"); tags[formatTag][1] = tmptag; } else if (tags[formatTag][1].indexOf("COMICS") > -1) { //console.log("made it 3b"); tags[formatTag][1].replace("& COMICS",""); tags[formatTag][1].replace("BOOK", "Book (Comics/GN)"); } } */ var fmts = tags[formatTag][1].split(" & "); fmts.each(function(fmt) { if (expressionText.slice(-1) != ">") { expressionText += " & "; } expressionText += ' ' + frbrFormats[fmt]['title']; }); if (jQuery('body').hasClass('mobile')) { expressionText += "

    "; } else { expressionText += ""; } } else { //single-format record //console.log("made it tft 1b"); //console.log("ftf: "+frbrFormats[tags[formatTag][1]]['code']); consoleTmp = 'Format ' + tags[formatTag][1] + '|' + frbrFormats[tags[formatTag][1]]['code']; //var expressionText = ' ' + frbrFormats[tags[formatTag][1]]['title']; var expressionText; if (jQuery('body').hasClass('mobile')) { expressionText = frbrFormats[tags[formatTag][1]]['title'] + '

    '; } else { expressionText = frbrFormats[tags[formatTag][1]]['title'] + ''; } } //console.log("expText: "+expressionText); } else { //no format tag found //var expressionText = ' ' + frbrFormats['Other']['title']; var expressionText; if (jQuery('body').hasClass('mobile')) { expressionText = frbrFormats['Other']['title'] + '

    '; } else { expressionText = frbrFormats['Other']['title'] + ''; } expressionFormat = 'UNKNOWN'; expressions[expressionFormat] = []; } jQuery.each(frbrUseFields, function(i, fld) { if ($J('body').hasClass('mobile')) { if (hasTag[fld] > -1) { consoleTmp += ' & ' + frbrExpressionFields[fld]['label'] + ' ' + tags[hasTag[fld]][1]; expressionText += '

    '; } else { expressionText += ''; } } //end if mobile else { //if nonmobile if (hasTag[fld] > -1) { consoleTmp += ' & ' + frbrExpressionFields[fld]['label'] + ' ' + tags[hasTag[fld]][1]; expressionText += '

    '; } } }); if (displayAvailable) { //console.log("availableString(2):"+availableString); if (availableString != "") { if ($J('body').hasClass('mobile')) { expressionText += '

    '; } } } if (displayPlaceHold && isErcFrbrHit == 0) { if (docInfo[0] == "SD_ILS") { //expressionText += '

    '; } } consoleTmp += ' & nonmodalLinkURL ' + nonmodalLinkURL; //console.log(consoleTmp); if ($J('body').hasClass('mobile')) { expressionText += '

    You might also like

    Latest Posts

    Article information

    Author: Arielle Torp

    Last Updated: 11/13/2022

    Views: 6281

    Rating: 4 / 5 (41 voted)

    Reviews: 80% of readers found this page helpful

    Author information

    Name: Arielle Torp

    Birthday: 1997-09-20

    Address: 87313 Erdman Vista, North Dustinborough, WA 37563

    Phone: +97216742823598

    Job: Central Technology Officer

    Hobby: Taekwondo, Macrame, Foreign language learning, Kite flying, Cooking, Skiing, Computer programming

    Introduction: My name is Arielle Torp, I am a comfortable, kind, zealous, lovely, jolly, colorful, adventurous person who loves writing and wants to share my knowledge and understanding with you.