Last active
December 27, 2015 23:29
-
-
Save rococodogs/7406450 to your computer and use it in GitHub Desktop.
Fix for SerialsSolutions 360Link landing page to replace link to Interlibrary Loan forms with a pre-populated url to firstsearch to streamline ILL requests.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var item = { | |
// firstsearch _appears_ to use a '_pub-date-comp' key for article dates | |
"_pub-date-comp" : document.getElementById("CitationJournalDateValue") || undefined | |
, "atitle" : document.getElementById("CitationJournalArticleValue") | |
|| document.getElementById("CitationBookChapterValue") || undefined | |
// "au" field works for articles AND books | |
, "au" : document.getElementById("CitationJournalAuthorValue") | |
|| document.getElementById("CitationBookAuthorValue") || undefined | |
// for books, firstsearch uses a 'date' key | |
, "date" : document.getElementById("CitationBookDateValue") || undefined | |
, "isbn" : document.getElementById("CitationBookISBNValue") || undefined | |
, "issn" : document.getElementById("CitationJournalIssnValue") || undefined | |
, "issue" : document.getElementById("CitationJournalIssueValue") || undefined | |
// book chapters only list the start page value | |
, "pages" : document.getElementById("CitationJournalPageValue") | |
|| document.getElementById("CitationBookSpageValue") || undefined | |
// "title" field works for articles AND books | |
, "title" : document.getElementById("CitationJournalTitleValue") | |
|| document.getElementById("CitationBookTitleValue") || undefined | |
, "volume" : document.getElementById("CitationJournalVolumeValue") || undefined | |
} | |
, url = "http://firstsearch.oclc.org/WebZ/FSOpenILL?:sessionid=0:dbname=WorldCat:libraryowns=false" | |
, a = document.getElementsByClassName("AnchorButton") || document.getElementsByTagName("a") | |
, counter = 0 | |
; | |
for ( var prop in item ) { | |
if ( typeof item[prop] !== "undefined" ) { | |
var res = item[prop].getElementsByClassName("res")[0].innerHTML; | |
url += ":" + prop + "=" + encodeURI(res); | |
// if only the start page is listed, we'll append an '-EOA' note at the end to clarify | |
url += prop === "pages" && !res.match(/\-/) ? "-EOA" : ""; | |
} else { | |
counter++; | |
} | |
} | |
// if every field is undefined, leave the ILL link as-is | |
if ( counter === Object.keys(item).length ) { | |
return false; | |
} | |
for ( var i = 0, count = a.length; i < count; i++ ) { | |
if ( a[i].href.match(/(library\.muhlenberg\.edu\/ill)/i) ) { | |
a[i].href = url; | |
} | |
} | |
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(){var e={"_pub-date-comp":document.getElementById("CitationJournalDateValue")||undefined,atitle:document.getElementById("CitationJournalArticleValue")||document.getElementById("CitationBookChapterValue")||undefined,au:document.getElementById("CitationJournalAuthorValue")||document.getElementById("CitationBookAuthorValue")||undefined,date:document.getElementById("CitationBookDateValue")||undefined,isbn:document.getElementById("CitationBookISBNValue")||undefined,issn:document.getElementById("CitationJournalIssnValue")||undefined,issue:document.getElementById("CitationJournalIssueValue")||undefined,pages:document.getElementById("CitationJournalPageValue")||document.getElementById("CitationBookSpageValue")||undefined,title:document.getElementById("CitationJournalTitleValue")||document.getElementById("CitationBookTitleValue")||undefined,volume:document.getElementById("CitationJournalVolumeValue")||undefined},t="http://firstsearch.oclc.org/WebZ/FSOpenILL?:sessionid=0:dbname=WorldCat:libraryowns=false",n=document.getElementsByClassName("AnchorButton")||document.getElementsByTagName("a"),r=0;for(var i in e){if(typeof e[i]!=="undefined"){var s=e[i].getElementsByClassName("res")[0].innerHTML;t+=":"+i+"="+encodeURI(s);t+=i==="pages"&&!s.match(/\-/)?"-EOA":""}else{r++}}if(r===Object.keys(e).length){return false}for(var o=0,u=n.length;o<u;o++){if(n[o].href.match(/(library\.muhlenberg\.edu\/ill)/i)){n[o].href=t}}})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment