'; } else if('REDIRECT' === responseJson.action) { title = 'Redirecting'; message = 'You will be redirected to your content, or you may click the button below.'; action = function() { open(responseJson.url, '_blank'); }; message += '
'; } else { error = true; com_sirsi_ent_strings.setStringFormatFunc_JavaStyle(); message = String.format('Error! Unrecognized checkout type: %s', responseJson.action); com_sirsi_ent_strings.resetString_dot_format(); } eRC_Dialogs.hideLoad(); eRC_Dialogs.openMessageDialog(function() { if(eRC_DownloadButton.reloadNeeded) { window.location.reload(); } }, resultId, {message:message, title:title}, responseJson && 'SYNC' === responseJson.action); } if(!error && eRC_Dialogs.messageDialogTimeoutMS) { setTimeout(function() { eRC_Dialogs.closeMessageDialog(resultId); }, eRC_Dialogs.messageDialogTimeoutMS); } action(); }, //helper funcs addValidButton:function(resultId, ercItem) { if(!resultId) { return; } var hitlistOrDetail = 'detail'; if(resultId.match(/hitlist/)) { hitlistOrDetail = 'hitlist'; } var resultIndex = resultId.replace(hitlistOrDetail, ''); if($J('#content.mobile').length) { var actionResultId = 'result' + resultIndex; if(!ercItem) { ResultActions.updateResultAction('ERC_FULL', actionResultId, hitlistOrDetail, false); return; } if(ercItem.status && 'OK' === ercItem.status && ercItem.formats && ercItem.formats.length > 0) { var ercDownloadOrHoldActions = ResultActions.asyncResultActions['ERC_FULL']; if(!ercDownloadOrHoldActions) { ResultActions.asyncResultActions['ERC_FULL'] = {}; ercDownloadOrHoldActions = ResultActions.asyncResultActions['ERC_FULL']; } var buttonLabel; if(ercItem.availability && ercItem.availability.available) { buttonLabel = 'Download'; var params = {}; for(var i = 0; i < ercItem.formats.length; i++) { var auth = ercItem.formats[i].authentication; if(auth && (auth.patronId || (auth.accountsUrl && (auth.ereaderAccount || auth.partnerAccount)))) { params['needLogin'] = true; if(auth.patronPin) { params['needPin'] = true; } break; } } ercDownloadOrHoldActions[actionResultId] = {'action': eRC_DownloadButton.handleDownloadButtonClick, 'params': params}; } else if (ercItem.holdable) { buttonLabel = 'Place Hold'; ercDownloadOrHoldActions[actionResultId] = {'action': eRC_DownloadButton.handleHoldButtonClick}; } else { ResultActions.updateResultAction('ERC_FULL', actionResultId, hitlistOrDetail, false); return; } // Show the button. ResultActions.updateResultAction('ERC_FULL', actionResultId, hitlistOrDetail, true, buttonLabel); } else { ResultActions.updateResultAction('ERC_FULL', actionResultId, hitlistOrDetail, false); } } else if(!ercItem) { return; } else if(ercItem.status && 'OK' === ercItem.status && ercItem.formats && ercItem.formats.length > 0) { var buttonLabel = 'Place Hold'; var onClickText = 'javascript: '; if(ercItem.availability && ercItem.availability.available) { buttonLabel = 'Download'; onClickText += "$(this).focus();eRC_DownloadButton.handleDownloadButtonClick('" + resultIndex + "','" + hitlistOrDetail + "',"; var params = {}; for(var i = 0; i < ercItem.formats.length; i++) { var auth = ercItem.formats[i].authentication; if(auth && (auth.patronId || (auth.accountsUrl && (auth.ereaderAccount || auth.partnerAccount)))) { params['needLogin'] = true; if(auth.patronPin) { params['needPin'] = true; } break; } } onClickText += JSON.stringify(params) + ");"; } else if (ercItem.holdable) { onClickText += "$(this).focus();eRC_DownloadButton.handleHoldButtonClick('" + resultIndex + "','" + hitlistOrDetail + "');"; } if(onClickText.substr(12)) { // if there's no onClick text besides 'javascript: ', don't bother with a button eRC_DownloadButton.showButton(resultId, buttonLabel, onClickText); } } }, showButton:function(resultId, displayText, onClickText) { var matches = resultId.match(/^(detail|hitlist)(\d+)$/); if (matches) { var buttonId = resultId+eRC_DownloadButton.ercDownloadButtonClass; var button = document.getElementById(buttonId); if(!button) { button = document.createElement('button'); button.setAttribute('id', buttonId); button.setAttribute('class', eRC_DownloadButton.ercDownloadButtonClass+' button'); var parentJsId; if('detail' === matches[1]) { parentJsId = '#detailActions' + matches[0]; } else { parentJsId = '#results_cell' + matches[2] + ' .results_right'; } $J(parentJsId).append(button); } button.innerHTML = displayText; button.setAttribute('onClick',onClickText); $J(button).show(); } }, };}/****THIS IS A SINGLE WIDGET TO ALLOW FOR TABS/NOVELIST/UNBOUND.***//**If NoveList: set the weUseNovelist variable below to true or false (no quotes). The widget takes differing pathways depending on this. If you do use Novelist, don't forget the novelistUrl, novelistProfile, and novelistPassword variables a few lines below here**/var is451up=true;var useAccordions=false;/************IF USING NOVELIST, set weUseNovelist=true, and fill in account info**********/var weUseNovelist=true;var novelistUrl = "https://imageserver.ebscohost.com/novelistselect/ns2init.js";//The location of the NoveList js//var novelistUrl = "https://hcpl2.ent.sirsi.net/custom/web/HCPL/ns2init.js";//The location of the NoveList jsvar novelistProfile = "s9206921.main.novsel3"; //This is your profile as provided by Novelistvar novelistPassword = "dGJyMOPY8UmwqQAA"; //This is your password as provided by Novelistvar currentNovSelectAttempt = 1;var detail='';var hitnumber='';/*****************************END NOVELIST VARIABLES**********************/var globalAvail;/*********************IF USING UNBOUND, set syndeticsUnboundEnabled=true, and fill in account info***/var syndeticsUnboundEnabled = false;var syndeticsUnboundAccountNumber = '68';//; // set Syndetics Unbound Account Id herevar syndeticsUnboundInstanceId = ''; //; // set Syndetics Unbound Instance Id if using a specific Instance/*****************************END UNBOUND VARIABLES************************//***for spinner purposes, defining a small version for inside the tabs***/var xsmallSpinnerOptions = { lines: 11, length: 2, width: 1, radius: 3, corners: 1, rotate: 90, color: "#000", speed: 1, trail: 60, shadow: false, hwaccel: false, className: "verySmallSpinner", zIndex: "auto", top: 3, left: 0};var syndeticsUnboundScriptSrc = 'https://unbound.syndetics.com/syndeticsunbound/connector/initiator.php?a_id=' + syndeticsUnboundAccountNumber+'&i_id='+syndeticsUnboundInstanceId;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 globalDetail;/****checking for rogue launches of Unbound***/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'+detail).find('a:contains("Syndetics Unbound")').length>0){$J('#detail_tabs'+detail).find('a:contains("Syndetics Unbound")').text("Unbound Content");} if( $J('#detail_accordion'+detail).find('h3').find('a:contains("Syndetics Unbound")').length>0){$J('#detail_accordion'+detail).find('h3').find('a:contains("Syndetics Unbound")').text("Unbound Content");} }}function startTabsMonitor(rId){var documentId = $J('#'+rId+'_DOC_ID .DOC_ID_value').text(); var sourceType=documentId.split(':')[0];var hitnum = rId.split('detail')[1];globalDetail=hitnum;var catKey=documentId.split(':')[1]; var itemLibraryEvent='detail.detailavailabilityaccordions:lookuptitleinfo/ent:$002f$002f'+sourceType+'$002f0$002f'+documentId+'/ILS/'+hitnum;var itemAvailEvent='detail.detailavailabilityaccordions.boundwithzone:lookupavailability/ent:$002f$002f'+sourceType+'$002f0$002f'+documentId; var noItemAvailEvent='testing';var availParam='detailboundWithDiv'+hitnum;var availData={"t:zoneid": availParam};var availUrl='/client/' + com_sirsi_ent_page.localeCode+'/'+com_sirsi_ent_page.friendlyUrl+'/search/results.displaypanel.displaycell_0.detail.detailavailabilityaccordions.boundwithzone:lookupavailability/ent:$002f$002fSD_ILS$002f0$002fSD_ILS:'+catKey+ '/ILS/' + hitnum+'/true/LIBRARY$002cCALLNUMBER?&d=ent%3A%2F%2FSD_ILS%2F0%2FSD_ILS%3A'+catKey+'%7EILS%7E'+hitnum+'&h=8';/***tried moving this here, but causes problems if the available event runs before the titlelookup event (this is my best guess why sometimes the detail table WS fields get stuck in searching... mode, and the avail# doesn't get there. Possibly slower too? In any case, if we move this back to the ajaxComplete function, it will have to go back within the title event. In that case, we have no response for item-less bibsvar availAjax= $J.ajax({ "url":availUrl, "type":"POST", "dataType":"JSON", "data":"availData" });****/$J(document).ajaxComplete(function(e, xhr, detailCall) {var curEvent=detailCall.url; if(curEvent.indexOf(itemLibraryEvent)!==-1){ var availAjax= $J.ajax({ "url":availUrl, "type":"POST", "dataType":"JSON", "data":"availData" });} //end itemlibraryeventelse if(curEvent.indexOf(itemAvailEvent)!==-1 && $J('#detail_tabs'+hitnum).length==0){ var stringEvalJson=xhr.responseJSON.inits[0].evalScript[0]; var stringEvalScript=JSON.stringify(stringEvalJson).split('availableCount')[1];if(stringEvalScript){var availRegEx=/([0-9]+)/;globalAvail= stringEvalScript.match(availRegEx); console.log('globalAvail from tabs widget is ' + globalAvail); if($J('#detail_tabs'+ hitnum).length==0){ setTimeout(function(){accToTabs(rId);},200); }}} //end availeventelse if (curEvent.indexOf(noItemAvailEvent)!==-1){accToTabs(rId);}});}function accToTabs(rId){ detail=rId.split("detail")[1];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){if ($J(this).next().text().length > 0){myIndex++;tabText=$J(this).text();var divContent = $J(this).next().text();var divLength=divContent.length;liHtml='
';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($J('#detail_tabs'+detail).text().length >0){$J('#detail_tabs' + detail).tabs();$J('#detail_accordion'+detail).remove();$J('#detail_tabs'+detail).find('a:contains(":*")').text(availLabel+ ':'+numAvail); $J('#detail_tabs' + detail).find('.sorttable_sortAnyInd').remove();$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 (weUseNovelist){ setTimeout("goNovelist(detail);",50);}/***should this be an else-if, or should we allow both nov/syn to run?****/if(syndeticsUnboundEnabled){ startSyndeticsUnbound(detail)} }else{$J('#detail_tabs'+detail).remove();} checkAvailCount();}function goNovelist(detail){var isbn=document.getElementById('detail'+detail +'_ISBN').childNodes[0].innerHTML;// if(document.getElementById('detail'+detail+'_ISBN').hasChildNodes())if(document.getElementById('detail'+detail+'_ISBN').hasChildNodes() && isbn.length==13){var regEx=/^[0-9]*$/;isbn=isbn.match(regEx); if(regEx.match(isbn)){if (typeof(novSelect) == 'undefined' ){novelistScript = new Element('script', {type: 'text/javascript',id: 'EIT',src: ''+novelistUrl+''});jQuery('body').append(novelistScript);}var detailAccObj=$J('#detail_accordion' + detail);var detailTabObj=$J('#detail_tabs'+detail);//if an IOS device (which should have bypassed the tabs conversion), do traditional accordionsif (useAccordions){$J(detailAccObj).append('
Content from NoveList
');NoveListSelectEnrichment(document.getElementById('detail'+detail+'_ISBN').childNodes[0].innerHTML);}else{if($J('#cust-nov-tab-'+detail).length==0){var newTabIndex=String(parseInt($J('#detail_tabs'+detail +' > div:last').attr('id').split('-')[1])+1);var tabLiHtml='
';var tabDivHtml='
';$J(detailTabObj).find('ul').append(tabLiHtml); $J(detailTabObj).append(tabDivHtml);createSpinnersForSelector($J(detailTabObj).find('.spinnerspan'),xsmallSpinnerOptions);$J('#cust-nov-tab-'+detail).find('.verySmallSpinner')[0].style.cssText='top:0px !important;margin-left:50% !important';$J('#cust-nov-tab-'+detail).find('.verySmallSpinner div').css('top','2px');NoveListSelectEnrichment(isbn); }//end existing tab check}//end if/else for accordions or tabs } //end regex check} //end if valid ISBN}function isIOS(){var iOS = !!navigator.platform && /iPad|iPhone|iPod/.test(navigator.platform);return iOS;}function NoveListSelectEnrichment(isbn) { if (typeof(novSelect) == 'undefined') { currentNovSelectAttempt++; if(currentNovSelectAttempt<= 10) { // setTimeout("NoveListSelectEnrichment("+isbn+")", 250); setTimeout(function(){NoveListSelectEnrichment(isbn);},250); } } else { novSelect.loadContentForQuery({ClientIdentifier:isbn, ISBN:isbn, version: '2.1'} , novelistProfile, novelistPassword, sdCallback); }}function sdCallback(jsonResult){ var tabObj=$J('#detail_tabs' + globalDetail);var activeIndex=$J(tabObj).tabs( "option", "selected" );if(jsonResult.length!==0){//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(tabObj).tabs("destroy").tabs({selected: activeIndex});$J(tabObj).find('.cust-nov-tab, .cust-nov-tab a').removeClass('hidden');}else{$J(tabObj).find('.cust-nov-tab').remove();$J(tabObj).tabs("destroy").tabs({selected: activeIndex});}presentLoaded();}function customSyndeticsUnbound(){var unboundContentDivId = 'syndeticsUnboundContent'+detail;if($J('#syndeticsUnboundContent'+detail).length==0){ if(document.getElementById('detail'+ detail+'_ISBN').hasChildNodes()) {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);/***syn removal***/var detailSelector=$J('#detail_tabs' +detail);var summarySelector=$J(detailSelector).find('a:contains("Summary")').attr('href');//$J('#detail_tabs'+hitnum).find('a:contains("Summary")').closest('h3').next('div').hide(); $J(summarySelector).hide(); $J(detailSelector).find('a:contains("Summary")').closest('li').hide();var reviewSelector=$J(detailSelector).find('a:contains("Reviews")').attr('href');$J(reviewSelector).hide(); $J(detailSelector).find('a:contains("Reviews")').closest('li').hide(); var contentsSelector=$J(detailSelector).find('a:contains("Table of Contents")').attr('href');$J(contentsSelector).hide();$J(detailSelector).find('a:contains("Table of Contents")').closest('li').hide(); var excerptSelector=$J(detailSelector).find('a:contains("Excerpts")').attr('href');$J(excerptSelector).hide(); $J(detailSelector).find('a:contains("Excerpts")').closest('li').hide();/***syn removal***///$J('#detail_tabs'+detail).find('.cust-nov-tab, .cust-nov-tab a').removeClass('hidden');//}// }//end if tabs presentdoLibraryThingConnector(customIsbn, unboundContentDivId); } //end if valid ISBN } //end existing tab check}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),sdcallback);//CALLBACK ATTEMPT HERE?}}function startSyndeticsUnbound(detail){customIsbn = jQuery('#detail' + detail).find('.displayElementText.ISBN: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);}}function removeSyndetics(rId) { var hitnum = rId;var detailSelector=$J('#detail_tabs' +hitnum);var summarySelector=$J(detailSelector).find('a:contains("Summary")').attr('href');//$J('#detail_tabs'+hitnum).find('a:contains("Summary")').closest('h3').next('div').hide(); $J(detailSelector).find('div[id="'+summarySelector+'"])').hide(); $J(detailSelector).find('a:contains("Summary")').closest('li').hide();}function presentLoaded(){$J('#cust-nov-tab-'+globalDetail).find('.spinnerspan').remove();$J('#detail_tabs'+globalDetail).find('.cust-nov-tab a:first').text("Content from NoveList");} function checkAvailCount(){ var blankAvail=$J('#detail_tabs' +hitnumber).find('a:contains(":*"):first'); if (blankAvail.length==1){ var curText=$J(blankAvail).find('a').text(); var newText=curText.replace('*',globalAvail); $J(blankAvail).text(newText); }}function searchAuthorDetails(rId){var curAuthor=jQuery('#'+rId+'_INITIAL_AUTHOR_SRCH').text();var clickUrl='https://authoralerts.org/?siteid=7037&AuthorName='+curAuthor;window.location.href = clickUrl;}function moveMeAuthorDetails(rId){var curObj=jQuery('#'+rId+'_AUTHOR_BUTTON');var curAuthor=jQuery('#'+rId+'_INITIAL_AUTHOR_SRCH').text();if(curAuthor=='' || !curAuthor){jQuery(curObj).remove();}else{var hitNum=rId.split('detail')[1];var appendObj=jQuery('#detailActions'+ rId);console.log(appendObj);jQuery (curObj).appendTo(appendObj);}}function removeLane(){jQuery('.displayElementText.ADDED_AUTHOR').parent().find('br').hide();}function hcplEdsEdit(){jQuery('#tab_-1074629602').text("Magazine / Journal Articles");jQuery('div#federatedSearchTitle').text("Magazine / Journal Articles");}function bandedResults() { jQuery("div.cell_wrapper:odd").css("background-color","#efefef");}// 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: false }); }, 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 startHcplEdsh*tList(){jQuery(document).ready(function(){setTimeout("hcplEdsh*tList()",1500);});}function hcplEdsh*tList () {jQuery('a.button').each(function(){if(jQuery(this).html() == 'Full Text Log in'){jQuery(this).siblings('.externalLink').hide();}});}function waitForEDSButtons(){var curAttempt = 0;var maxAttempts = 40;if (jQuery('a.button:contains("Full Text Log in")').length == 0){curAttempt++;if(curAttempt<=maxAttempts){setTimeout(function() { waitForEDSButtons(); },500);}// if 1}// if 2else{hcplEdsh*tList();}// else}function editRecordedBooksh*tList(){jQuery('.displayElementLabel:contains("Source")').next('.displayElementText:contains("Recorded Books")').text('OneClickdigital');jQuery('.crumbFieldAndCaption:contains("Recorded Books")').text('OneClickdigital');jQuery('.crumbCaption:contains("Recorded Books")').text('OneClickdigital');jQuery("#facetERC_VENDOR .facetItem a:contains('Recorded Books')").text(function() {return jQuery(this).text().replace("Recorded Books","OneClickdigital");});}// 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.'; open(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'}); } } }, function(){}, resultId, true); }, };}// 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_Dialogs) { eRC_Dialogs = { //variables shownFormatCount:4, // edit this value to adjust when the format dialog expands holdNeedsEmail: false, dialogButtonClass:'ercDialogButton', primaryButtonClass:'ercPrimaryButton', secondaryButtonClass:'ercSecondaryButton', formatDialogClass:'ercFormatDialog', holdDialogClass:'ercHoldDialog', previewDialogClass:'ercPreviewDialog', durationId:'ercCurrentDays', formatDivId:'ercFormatDiv', holdDivId:'ercHoldDiv', formatDivClass:'ercFormatDiv', holdDivClass:'ercHoldDiv', formatRadioId:'ercFormatRadioDiv', radioName:'ercRadioGroup', radioClass:'ercRadio', msgDialogId:'ercMessageDialog', messageClass:'ercMessage', accountDialogClass:'ercAccountsDialog', accountErrorDiv:'ercAcctErrorDiv', accountFormClass:'ercAccountsForm', accountDivClass:'ercAccountDiv', accountLabelClass:'ercAccountLabel', accountSelectClass:'ercAccountSelect', accountInputClass:'ercAccountInput', //functions makeId:function(baseId, resultId) { return baseId + '_' + resultId; }, makeError:function(message) { return {status:'error', error:message}; }, showLoad:function() { var div = $J('.loadingDiv'); if(div.length < 1) { div = $J('
').addClass('loadingDiv'); $J('body').append(div); } var backdrop = $J('.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, cancelCallback, 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, cancelCallback); } 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, cancelCallback) { 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(); eRC_Dialogs.getFormat(callback, eRC_Dialogs.getRadioFormat(dialogId)); }); form.appendChild(formatDiv); dialog.appendChild(form); if(formats.length > eRC_Dialogs.shownFormatCount) { dialog.appendChild(eRC_Dialogs.buildExpanderHandle(dialogId)); } 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: cancelCallback }, 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 = 'More'; 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: window.open("' + 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: window.open("' + 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, cancelCallback, 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')); } eRC_Dialogs.showLoad(); eRC_Base.getTitleData(function(ercItem) { if (ercItem) { eRC_Dialogs.findFormatDialog(callback, cancelCallback, resultId, ercItem, isPreview); } }, resultId); }, 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 eRC_Base.getAccountsResponse(function(responseJson) { eRC_Dialogs.findHoldDialog(callback, resultId, ercItem, responseJson); }, auth.accountsUrl); } }, 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); if(showEReadersLink) { var linkToEReaders = document.createElement('a'); linkToEReaders.setAttribute('class',eRC_Dialogs.secondaryButtonClass+' '+eRC_Dialogs.dialogButtonClass); linkToEReaders.setAttribute('href', 'http://www.sirsidynix.com/eReader-Downloads'); linkToEReaders.innerHTML = 'Download readers'; msgDialog.appendChild(linkToEReaders); } 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); }, };}function hide_item_hold() { jQuery('.detailItemsTable_SD_ITEM_HOLD_LINK').each(function(){ jQuery(this).css("display","none"); });}function coverart(){jQuery('.no_image_text').each(function(index){var curFormat=jQuery(this).closest('.results_cell').find('.formatType').attr('title');var myImage=''; switch(curFormat){ /** case 'DVD':myImage='/custom/web/HCPL/format-DVD.jpg';break; case 'Blu-ray':myImage='/custom/web/HCPL/format-bluray.jpg';break; case 'AudioBook':myImage='/custom/web/HCPL/format-audiobook.png';break; case 'Audios':myImage='/custom/web/HCPL/format-audio.jpg';break; case 'Music CD':myImage='/custom/web/HCPL/format-musiccd.jpg';break; case 'VHS':myImage='/custom/web/HCPL/format-VHS.png';break; case 'Books on Tape':myImage='/custom/web/HCPL/format-cassette.jpg';break; case 'Music on Tape':myImage='/custom/web/HCPL/format-cassette.jpg';break; case 'Large Print':myImage='/custom/web/HCPL/format-largeprint.png';break; case 'Electronic Resource': myImage='/custom/web/HCPL/format-eresources.png';break; case 'Videos': myImage='/custom/web/HCPL/format-video.png';break; case 'Periodical': myImage='http://www.hcpl.net/images/social/apps.png';break; **/ default:myImage='/custom/web/HCPL/format-placeholder.png'; } jQuery(this).prev().attr('src',myImage);jQuery(this).css('color','white');});}function editRecordedBooksFullDisplay(){jQuery(".ERC_VENDOR:contains('Recorded Books')").text(function() {return jQuery(this).text().replace("Recorded Books","OneClickdigital");});}function hcplPopular(){jQuery("#facetHCPL_NEW .facetItem a:contains('HCPLNEW')").text(function() {return jQuery(this).text().replace("HCPLNEW,","New titles - ALL");});jQuery("#facetHCPL_NEW .facetItem a:contains('HCPLANF')").text(function() {return jQuery(this).text().replace("HCPLANF,","New Adult Non-Fiction");});jQuery("#facetHCPL_NEW .facetItem a:contains('HCPLDVD')").text(function() {return jQuery(this).text().replace("HCPLDVD,","New DVD & Blu-rays");});jQuery("#facetHCPL_NEW .facetItem a:contains('HCPLYA')").text(function() {return jQuery(this).text().replace("HCPLYA,","New YA Titles");});jQuery("#facetHCPL_NEW .facetItem a:contains('HCPLKIDS')").text(function() {return jQuery(this).text().replace("HCPLKIDS,","New Children's Titles");});jQuery("#facetHCPL_NEW .facetItem a:contains('HCPLAF')").text(function() {return jQuery(this).text().replace("HCPLAF,","New Adult Fiction");});jQuery("#facetHCPL_NEW .facetItem a:contains('POPULAR')").text(function() {return jQuery(this).text().replace("POPULAR,","Most Popular Titles");});jQuery("#facetHCPL_NEW .facetItem a:contains('BELJUV')").text(function() {return jQuery(this).text().replace("BELJUV,","New Kids Books");});jQuery("#facetHCPL_NEW .facetItem a:contains('BELDVD')").text(function() {return jQuery(this).text().replace("BELDVD,","New DVDs");});jQuery("#facetHCPL_NEW .facetItem a:contains('BELYA')").text(function() {return jQuery(this).text().replace("BELYA,","New Teens Books");});jQuery("#facetHCPL_NEW .facetItem a:contains('BELAUDIOBK')").text(function() {return jQuery(this).text().replace("BELAUDIOBK,","New Books on CD");});jQuery("#facetHCPL_NEW .facetItem a:contains('BELANF')").text(function() {return jQuery(this).text().replace("BELANF,","New Adult Non Fiction");});jQuery("#facetHCPL_NEW .facetItem a:contains('BELAF')").text(function() {return jQuery(this).text().replace("BELAF,","New Adult Fiction"); });jQuery("#facetHCPL_NEW .facetItem a:contains('BELMYS')").text(function() {return jQuery(this).text().replace("BELMYS,","New Adult Sci-Fi and Fantasy");});jQuery("#facetHCPL_NEW .facetItem a:contains('PASAF')").text(function() {return jQuery(this).text().replace("PASAF,","New Adult Fiction");});jQuery("#facetHCPL_NEW .facetItem a:contains('PASANF')").text(function() {return jQuery(this).text().replace("PASANF,","New Adult Nonfiction");});jQuery("#facetHCPL_NEW .facetItem a:contains('PASAUDIOBK')").text(function() {return jQuery(this).text().replace("PASAUDIOBK,","New Books on CD");});jQuery("#facetHCPL_NEW .facetItem a:contains('PASDVD')").text(function() {return jQuery(this).text().replace("PASDVD,","New Movies");});jQuery("#facetHCPL_NEW .facetItem a:contains('PASJUV')").text(function() {return jQuery(this).text().replace("PASJUV,","New Children's Books");});jQuery("#facetHCPL_NEW .facetItem a:contains('PASMYS')").text(function() {return jQuery(this).text().replace("PASMYS,","New Mysteries");});jQuery("#facetHCPL_NEW .facetItem a:contains('PASSF-FAN')").text(function() {return jQuery(this).text().replace("PASSF-FAN,","New SciFi");});jQuery("#facetHCPL_NEW .facetItem a:contains('PASYA')").text(function() {return jQuery(this).text().replace("PASYA,","New Teen Books");});}
- Place Hold(s)
- Text the Title Info to Me
747 Results Found
12345..63
000000000000HCPL_MAIN
Select a list
The following items were successfully added.
There was an error while adding the following items. Please try again.
One or more items could not be added because you are not logged in.
1.
Rick Riordan
by
Furgang, Adam
Pub Date 2013. Format: Book Language English ISBN 9781448869374 Your Search Term(s): Riordan, Rick -- Juvenile literature.
Furgang, Adam
2.
Rick Riordan
by
Leaf, Christina author.
Pub Date 2016. Format: Book Language English ISBN 9781626173422 9780531223499 Your Search Term(s): Rick Riordan / Leaf, Christina author.
Leaf, Christina author.
3.
Rick Riordan
by
Wheeler, Jill C., 1964-
Pub Date c2013. Format: Book Language English ISBN 9781617835780 Your Search Term(s): Rick Riordan / Wheeler, Jill C., 1964-
Wheeler, Jill C., 1964-
4.
Rick Riordan
by
Sparks, Barry, 1949-
Pub Date c2013. Format: Book Language English ISBN 9781599353500 Your Search Term(s): Riordan, Rick -- Juvenile literature.
Sparks, Barry, 1949-
5.
Demigods and monsters : your favorite authors on Rick Riordan's Percy Jackson and the Olympians series
by
Riordan, Rick
Pub Date [2013]. Format: Book Language English ISBN 9781937856366 Your Search Term(s): Riordan, Rick. Percy Jackson & the Olympians -- Criticism and interpretation -- Juvenile literature.
Riordan, Rick
6.
The throne of fire : the graphic novel
by
Riordan, Rick.
Format: Book Language English ISBN 9781484714935 Your Search Term(s): The throne of fire : the graphic novel / Riordan, Rick.
Riordan, Rick.
7.
The lost hero : the graphic novel
by
Riordan, Rick.
Pub Date 2014. Format: Book Language English ISBN 9781423162797 Your Search Term(s): The lost hero : the graphic novel / Riordan, Rick.
Riordan, Rick.
8.
The lost hero : the graphic novel
by
Riordan, Rick,
Pub Date [2014] Format: Book Language English ISBN 9781423163251 Your Search Term(s): The lost hero : the graphic novel / Riordan, Rick,
Riordan, Rick,
9.
El mar de los monstruos : novela gráfica
by
Riordan, Rick
Pub Date 2013. Format: Book Language Spanish ISBN 9788498385489 Your Search Term(s): El mar de los monstruos : novela gráfica / Riordan, Rick
Riordan, Rick
10.
The Titan's curse : the graphic novel
by
Riordan, Rick.
Pub Date 2013. Format: Book Language English ISBN 9781423145301 9781423145516 Your Search Term(s): The Titan's curse : the graphic novel / Riordan, Rick.
Riordan, Rick.
11.
Southtown
by
Riordan, Rick.
Pub Date [2005] Format: Book Language English ISBN 9780553583236 Your Search Term(s): Southtown / Riordan, Rick.
Riordan, Rick.
12.
Southtown
by
Riordan, Rick
Format: eAudiobook Electronic Format LIBBY AUDIOBOOK MP3 Language English Source: Libby Cover Image URL https://img1.od-cdn.com/ImageType-200/1694-1/{70A0F772-9B27-41E4-B1A3-C9FA5B3F9FCC}Img200.jpg https://img1.od-cdn.com/ImageType-100/1694-1/{70A0F772-9B27-41E4-B1A3-C9FA5B3F9FCC}Img100.jpg Your Search Term(s): Southtown Riordan, Rick
eAudiobook
OVERDRIVE:70a0f772-9b27-41e4-b1a3-c9fa5b3f9fcc
Southtown
Tres Navarre Mysteries Series, Book 5
- Place Hold(s)
- Text the Title Info to Me
12345..63