Skip to content

Instantly share code, notes, and snippets.

@phette23
Last active February 19, 2022 16:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phette23/f4595ae6b8bddcf8d55cd12cc378253a to your computer and use it in GitHub Desktop.
Save phette23/f4595ae6b8bddcf8d55cd12cc378253a to your computer and use it in GitHub Desktop.
hide 856$u PDFs in Koha if users aren't logged in
// run 1) on opac-detail pages & 2) if no user is signed in
if (!!location.pathname.match('/cgi-bin/koha/opac-detail.pl') && !$('.loggedinusername').length) {
// replace 856$u links with a link to login instead
// this would need to be tweaked if there are multiple URLs per record
$('.results_summary.online_resources a')
.replaceWith('<a href="/cgi-bin/koha/opac-user.pl">login to view PDF</a>')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment