Skip to content

Instantly share code, notes, and snippets.

@tingletech
Created August 27, 2010 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tingletech/553588 to your computer and use it in GitHub Desktop.
Save tingletech/553588 to your computer and use it in GitHub Desktop.
// script src="http://dsc-api.cdlib.org/js/api0.01.js"
/*
events
form
- form is Drawn
- words typed into search box (for autocomplete)
- autocomplete suggestion selected
- search form in submitted
search results
- last result on page is shown (continuos scroll)
- result selected for preview
*/
var cdlApi = CDL.DSC.({
url : 'http://dsc-api.cdlib.org/v0.01', // url to service
relation : 'http://bampfa.berkeley.edu/moac/' // default limits
key : 'API-KEY'
// search-fields: [ 'text' ] // default to XTF "keyword"
});
var result = cdlApi.doSearch({
displayFields : [ "thumbnail", "title", "publisher", "date", "rights" ], // XTF fields
displayFacets : [ "date", "publisher" ] ,
linkFields : { thumbnail: "identifier",
title : "identifier",
publisher : "lookup",
rights : "internal" },
pageSize : 25
});
facetDiv = result.facets; // HTML of a <div> with the facet limit area
result.docHits( { start : 50 } ); // grab the next results starting at 50
result.thumbnails; // Array of all the thumbnail objects { url: , x: , y: }
result.slideshow({ maxX: 500, maxY: 500}); // Array of <canvas elements
digitalObject = result[1];
digitalObject.thumbnail; // thumbnail objects { url: , x: , y: }
digitalObject.nativeMetadata; // full Metadata record from the METS
digitalObject.toHtml( { width : 450, height : "screen" ); //
digitalObject.slide; // <canvas element
digitalObject.tableOfContents; // <div element with internal divs representing table of contents
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment