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
orbiscascade.org/programs/systems/pcsg/primo-ve-toolkit/slot-dropdown

Atomatically start search after change of search scope slot
developers.exlibrisgroup.com/blog/automatically-activate-a-search-after-changing-search-scope

Add text to the Expand/collapse arrow. Relevant from February 2023 release. For details see mailing list.
orbiscascade.org/programs/systems/pcsg/primo-ve-toolkit/advanced-search-chevron

External search with the search terms, as option in the facets column
knowledge.exlibrisgroup.com/Primo/Community_Knowledge/How_to_-_Add_links_to_additional_search_platforms_in_Primo_Brief_Results,

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 */

app.component(“prmTopbarAfter”,{
    template:`
        <primo-explore-top-alert>
            <md-toolbar>
                <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>.
                    </span>
                </div>
            </md-toolbar>
        </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

3.2.2023