Back to the Primo VE Customization Package: Shared CSS and JavaScript Solutions page
Posted: December 17, 2020 -- Revised: August 25, 2022
Objective: When available, insert a clickable link to freely-available, full-text HathiTrust electronic version of the resource that will display in results lists and on full record pages.
Before | After |
How to accomplish: Please review the steps for working with the customization package and its files on the main Shared CSS and JavaScript Solutions page. This is an advanced customization that requires custom JavaScript be added to the /VIEW_CODE/js/custom.js file and custom CSS be added to the /VIEW_CODE/css/custom1.css file.
var app = angular.module('viewCustom', ['angularLoad']);
to read:
var app = angular.module('viewCustom', ['angularLoad', 'hathiTrustAvailability']);
app.component('prmSearchResultAvailabilityLineAfter', { template: '<hathi-trust-availability hide-online="true" msg="Set this text to your preferred message"> </hathi-trust-availability>' });
7. Save the changes to the custom.js file. Here is an example of the custom.js file with complete HathiTrust Add-On code without any optional configurations added.
8. Zip the Customization Package back up and Upload it in Alma Configuration. For more details, see Working with the Customization Package.
There are some optional configurations for the Primo VE HathiTrust Add-On that may be set within the JavaScript code. The downloadable text files do not have these configuration options set but they are listed in the comments section as well as described below. To include any of these options, insert the attributes desired into the app.component prmSearchResultAvailabilityLineAfter template line between the "hathi-trust-availability" tags (see example in step 6 above).
Customizing the Availability Message - The default availability message that displays in the Brief Results list and the Full Record page is "Full Text Available at HathiTrust". You can override this by setting the msg attribute:
<hathi-trust-availability msg="Set this text to your preferred message"></hathi-trust-availability>
Selectively Suppress Full-text Links - By default, the component will display full-text links for any resource.
<hathi-trust-availability hide-online="true"></hathi-trust-availability>
<hathi-trust-availability hide-if-journal="true"></hathi-trust-availability>
Copyright Status - By default, the component will display only when the item is out of copyright and should therefore be accessible.
<hathi-trust-availability ignore-copyright="true"></hathi-trust-availability>
<hathi-trust-availability entity-id="https://shibboleth.inst.edu/idp/shibboleth"></hathi-trust-availability>
Download a text file with this custom JavaScript code for easy copying and pasting into your local custom.js file.
Download a text file with this custom CSS code for easy copying and pasting into your local custom1.css file.
This Primo VE HathiTrust Add-On and the documentation above was adapted for CARLI I-Share from the UMNLibraries/primo-explore-hathitrust-availability project available through GitHub.