Skip to content

Instantly share code, notes, and snippets.

@kalanchoej
Forked from mreidsma/journal-asrs.js
Last active July 5, 2016 20:21
Show Gist options
  • Save kalanchoej/7111746b697aa2623f3bc463ab9b031f to your computer and use it in GitHub Desktop.
Save kalanchoej/7111746b697aa2623f3bc463ab9b031f to your computer and use it in GitHub Desktop.
Give folks a prompt before requesting journals from the ASRS
function asrsModal() {
// Create modal dialog for requesting journals
if($("#bib_items td:contains('Periodical')").size() > 0 && $("#bib_items td:contains('RooBot')").size() > 0) {
// This is a periodical.
var journalTitle = encodeURIComponent($("td.bibInfoLabel:contains('Title')").first().next("td").text());
journalTitle = journalTitle.replace(/\s/g, '+');
console.log(journalTitle);
var journalIssn = $("td.bibInfoLabel:contains('ISSN')").first().next("td").text();
journalIssn = journalIssn.replace(/\-/g,"");
console.log(journalIssn);
// alert(link);
$("#bib_items").find("tr").find("td:first").find("a").click(function(e) {
e.preventDefault();
var link = $(this).attr("href"); // Get the URL of the ASRS request
// Insert a modal dialog box to direct users to Document Delivery
$("body").append('<div class="modal-box"><div class="close-button">[x]</div><p><strong>Are you looking for a specific article?</strong> <a href="http://library.umkc.edu/ill">Interlibrary loan</a> can send an electronic copy to you, free of charge.</p><p>Need the whole journal? We can put it on hold for you.</p><div class="line"><a href="https://ill.library.umkc.edu/illiad/illiad.dll/OpenURL?sid=&genre=article&aulast=&aufirst=&issn=' + journalIssn + '&title=' + journalTitle + '&atitle=&volume=&part=&issue=&spage=&epage=&date=" class="btn btn-primary btn-lg">Request an Article</a> -or - <a href="' + link + '" class="btn btn-default btn-lg">Request the Journal</a></div></div>');
$(".close-button").click(function() {
$(".modal-box").hide();
});
});
// Close modal dialogs
}
}
@kalanchoej
Copy link
Author

Small tweak to the awesome addition from @mreidsma - The last revision of the Gist contained some random classes and a bit too much markup for me. I removed the cruft and added the Bootstrap classes that @mreidsma had also done in production. The styles can be poached from http://merlin.searchmobius.org/record=b2445286~S3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment