js snippets

  1. Search
  2. Advanced search
  3. External search
  4. Collection discovery
  5. Banner at the top of each page, including a link
  6. Look at others’ js

Show that there’s a pulldown menu for the search scope slots before starting a search

Atomatically start search after change of search scope slot

Add text to the Expand/collapse arrow. Relevant from February 2023 release. For details see mailing list.

External search with the search terms, as option in the facets column

No results page, with the option to directly start an external search with the search terms
Description by SUNY, code

Collection discovery

Add author name and date (example), via Laura Percival and Jens Weber.

See also CSS; all changes in collection discovery can take a while to show up.

/* Javascript: */
app.component(‘prmGalleryItemAfter’, {
bindings: {
parentCtrl: ‘<‘
controller: function () {
var $ctrl = this;
$ctrl.$onInit = function () {
try {
$ctrl.author = $ctrl.parentCtrl.item.pnx.addata.au[0];
} catch (e) {
$ctrl.author = ”;
try {
$ctrl.date = $ctrl.parentCtrl.item.pnx.display.creationdate[0];
} catch (e) {
$ctrl.date = ”;
$ctrl.hasDate = !!$ctrl.date;
$ctrl.hasAuthor = !!$ctrl.author;
template: `
<div ng-if=”$ctrl.hasDate”>{{$ctrl.date}}</div>
<div ng-if=”$ctrl.hasAuthor”>{{$ctrl.author}}</div>

[If you don’t need a link, see CSS snippets]

/* NYU-style status bar, via Cindy Bowen, Steve Fernie */

                <div class=”bar alert-bar” layout=”row” layout-align=”center center” style=”margin: 0;background-color: #862633;color: #fff;border: none;min-height: 60px;text-align:center;font-size: 90%;”>
                    <span class=”bar-text”>
Library services are currently operating in a reduced capacity and many services have shifted online. For more information see the&nbsp; <a style=”color:#fff1b5; text-decoration:underline;” target=”_blank” class=”arrow-link md-primoExplore-theme” href=”https://www…library.georgetown.edu/covid-19“><span>Georgetown Library COVID-19 Updates and Resources page</span></a>.
        </primo-explore-top-alert>`,controller:[“$element”,function(t){this.$postLink=function(){var e=t.parent().parent().parent(),n=t.query(“primo-explore-top-alert”).detach();e.prepend(n)}}]

Look at others’ js

See here