Skip to content

Instantly share code, notes, and snippets.

@mreidsma
Last active July 1, 2016 19:55
Show Gist options
  • Save mreidsma/8849877 to your computer and use it in GitHub Desktop.
Save mreidsma/8849877 to your computer and use it in GitHub Desktop.
Give folks a prompt before requesting journals from the ASRS
// Create modal dialog for requesting journals
if($("#bib_items").find("td:contains('PERIODICALS')") && $("#bib_items").find("td:contains('ASRS')")) {
// 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"><p><strong>Are you looking for a specific article?</strong> <a href="http://gvsu.edu/library/ill">Document Delivery</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"><div class="span2 unit left"><p><a href="https://gvsu.illiad.oclc.org/illiad/illiad.dll/OpenURL?sid=&genre=article&aulast=&aufirst=&issn=' + journalIssn + '&title=' + journalTitle + '&atitle=&volume=&part=&issue=&spage=&epage=&date=" class="lib-button-small">Request an Article</a></p></div><div class="span2 unit left lastUnit"><p><a href="' + link + '" class="lib-button-small-grey">Request the Journal</a></p></div></div><div class="close-button">[x]</div></div><style>.modal-box{font-size:1.2em;width:30em;background-color: #fff;padding:1em;position:fixed;top:20%;left:39%;z-index:1000;box-shadow:5px;border:2px solid #bbb;}.close-button{cursor:pointer;}@media screen and (max-width:700px){.modal-box{width:90%;left:0;}}</style>');
$(".close-button").click(function() {
$(".modal-box").hide();
});
});
// Close modal dialogs
}
@mreidsma
Copy link
Author

mreidsma commented Feb 6, 2014

This is a little jQuery that adds a modal dialog whenever someone tries to request a journal from the ASRS. It directs them to Document Deliver (via an OpenURL) for a specific article, or lets them pass on to request the whole journal. Most people don't want the journal and don't read closely enough to see what they have requested. Hopefully this will help!

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