Skip to content

Instantly share code, notes, and snippets.

@jsicot
Created June 8, 2015 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jsicot/8a978e26197a63a5ee1a to your computer and use it in GitHub Desktop.
Save jsicot/8a978e26197a63a5ee1a to your computer and use it in GitHub Desktop.
360.js
function get360link() {
if (!kioskMod && (jQuery("div.ISSN").size() > 0 || jQuery("div.ISBN").size() > 0)) {
if (jQuery("div.ISSN").size() > 0) {
var ISSN = jQuery("div.ISSN").text();
var url = jsHost+OPAC_SVC+'360.php?request=issn&id='+ISSN;
}
else {
if (jQuery("div.ISBN").size() > 0) {
var ISBN = jQuery("div.ISBN").eq(index).text();
var url =jsHost+OPAC_SVC+'360.php?request=isbn&id='+ISBN;
}
}
jQuery.ajax({
url : url,
dataType: 'jsonp',
success : function(data, textStatus, jqXHR) {
if (data.length > 0) {
var container = jQuery("<div></div>").attr('id','360holdings');
for (var i = 0 ; i < data.length ; i++) {
var toAppend = "<div class='360link'><a href='"+data[i].href+"' target='_blank'>"+data[i].title+"</a>";
toAppend += (data[i].coverage != undefined)?" ("+data[i].coverage+")":"";
toAppend += "</div>";
toAppend += (i < data.length-1)?"<hr/>":"";
container.append(toAppend);
}
jQuery('div#bibliodescriptions').first().append(container);
jQuery("#bibliodescriptions").tabs("add", "#360holdings", "<div class='360holdings'>Consulter en ligne</div>");
}
},
error : makeAjaxError
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment