// ****************
// Get Print Availability
// Example assumes a page listing one or more items, each with a COinS (Context Object in Span - see http://ocoins.info/). For print availability the ISBN has been extracted from the COinS and added to an array of ISBNs as a metatag
// ****************
// Extension allows control over how many lines show in availabilty statements
// Define icons to be clicked for hiding/showing additional lines
var expandIcon = "http://example.ac.uk/expand.gif";
var collapseIcon = "http://example.ac.uk/collapse.gif";
var availServer = "http://daia.example.ac.uk"; // DAIA server for print availability
var availabilityDiv = '<div id="availability"></div>';
var insert_avail = new JuiceInsert(availabilityDiv,"span.Z3988","after");
// call daiaAvailability
/*
* Constructor arguments:
* arg: ju - instance of juice
* arg: insert - JuiceInsert to use
* arg: targetDiv - id of element to place image in
* arg: availIDs - Juice Meta element containing array of IDs for DAIA requests
* arg: availServer - url of availability server
* arg: availType - set to 'online' to treat all availability as online, otherwise will treat DAIA response generically
* arg: format - format to return DAIA results [jsonp only format currently supported]
* arg: noLines - number of availability lines to display unhidden.
* Remaining lines will be hidden and 'show' button added.
* Any 'open access' availability will be shown whatever this value
* Ignored when availType == 'online'
* arg: toggleExpand - URL of image to be used for the toggleAvailability 'expand' function where some results are hidden. Not used when availType == 'online'
* arg: toggleCollapse - URL of image to be used for the toggleAvailability 'collapse' function where some results are hidden. Not used when availType == 'online'
*/
new daiaAvailability(juice,insert_avail,"availability","isbns",availServer,"print","jsonp",1,expandIcon,collapseIcon);
}
// ****************
// Get Electronic Availability
// Example assumes a page listing one or more items, each with a COinS (Context Object in Span - see http://ocoins.info/). This has been used to create an array of COinS (one for each item) as a metatag
// ****************
// Create new Juice Meta that contains OpenURLs rather than just COINS
// This is so we can use a proper http URI for DAIA request
var base_url = "http://openurl.ac.uk/?";
openurls = new(Array);
var coins = juice.getMetaValues("coins");
for (var i = 0; i < coins.length; i++){
openurls.push(base_url + coins[i]);
};
juice.setMeta("openurls",openurls);
var eavailServer = "http://daia.example.ac.uk"; // DAIA server for electronic availability
var eavailabilityDiv = '<div id="e-availability"></div>';
var insert_eavail = new JuiceInsert(eavailabilityDiv,"span.Z3988","after");
// call daiaAvailability
/*
* Constructor arguments:
* arg: ju - instance of juice
* arg: insert - JuiceInsert to use
* arg: targetDiv - id of element to place image in
* arg: availIDs - Juice Meta element containing array of IDs for DAIA requests
* arg: availServer - url of availability server
* arg: availType - set to 'online' to treat all availability as online, otherwise will treat DAIA response generically
* arg: format - format to return DAIA results [jsonp only format currently supported]
* arg: noLines - number of availability lines to display unhidden.
* Remaining lines will be hidden and 'show' button added.
* Any 'open access' availability will be shown whatever this value
* Ignored when availType == 'online'
* arg: toggleExpand - URL of image to be used for the toggleAvailability 'expand' function where some results are hidden. Not used when availType == 'online'
* arg: toggleCollapse - URL of image to be used for the toggleAvailability 'collapse' function where some results are hidden. Not used when availType == 'online'
*/
new daiaAvailability(juice,insert_eavail,"online-availability","openurls",eavailServer,"online","jsonp",0,expandIcon,collapseIcon);