Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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, '+');
var journalIssn = $("td.bibInfoLabel:contains('ISSN')").first().next("td").text();
journalIssn = journalIssn.replace(/\-/g,"");
// alert(link);
$("#bib_items").find("tr").find("td:first").find("a").click(function(e) {
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="">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="' + 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() {
// Close modal dialogs

This comment has been minimized.

Copy link
Owner Author

@mreidsma 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