Skip to content

Instantly share code, notes, and snippets.

@mreidsma
Last active February 28, 2018 22:00
Show Gist options
  • Select an option

  • Save mreidsma/4033221 to your computer and use it in GitHub Desktop.

Select an option

Save mreidsma/4033221 to your computer and use it in GitHub Desktop.
Add link to MeLCat (consortial book-sharing service) in Summon results for books and videos
$(".thumbnail").find("a").each(function(){
availabilityText = $(this).find('div.format').attr("class");
var availability = availabilityText.split(" ");
if((availability[2]== "format_book_lg") || (availability[2] == "format_video_recording_lg")) {
var searchTitle = $(this).closest(".document").find(".title").find("h3").text();
searchTitle = encodeURIComponent(searchTitle);
$(this).closest("table").find(".metadata").find(".Availability").append('<br /><p>Not available? <a href="http://elibrary.mel.org/search/a?searchtype=t&searcharg=' + searchTitle + '&SORT=D" target="_blank">Find this at another Michigan library</a></p>');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment