2 * This function should return a URL which points to the book cover image based on ISBN.
3 * Ideally, this should point to some type of added content service.
4 * The example below uses Amazon... *use at own risk*
7 function buildISBNSrc(isbn, size) {
8 //return "http://images.amazon.com/images/P/" + isbn + ".01._SCMZZZZZZZ_.jpg";
9 //return '../../../../jackets/'+isbn;
10 size = (size) ? size : 'small';
11 return '../../../../extras/jacket/'+size+'/'+isbn;
16 function acMakeURL(type, key) {
17 return '../../../../extras/ac/' + type + '/html/' + key;
21 function acCollectData( key, callback ) {
22 var context = { key : key, callback: callback, data : {} };
23 acCollectItem(context, 'reviews');
24 acCollectItem(context, 'toc');
25 acCollectItem(context, 'excerpt');
26 acCollectItem(context, 'anotes');
29 function acCheckDone(context) {
30 if( context.data.reviews && context.data.reviews.done &&
31 context.data.toc && context.data.toc.done &&
32 context.data.excerpt && context.data.excerpt.done &&
33 context.data.anotes && context.data.anotes.done ) {
35 if(context.callback) context.callback(context.data);
39 function acCollectItem(context, type) {
40 var req = buildXMLRequest();
41 req.open('GET', acMakeURL(type, context.key), true);
42 req.onreadystatechange = function() {
43 if( req.readyState == 4 ) {
44 context.data[type] = { done : true }
48 /* Someone please explain why IE treats status 404 as status 200??
49 On second thought, don't bother.
51 if( ! req.responseText.match(
52 /The requested URL.*was not found on this server/) )
53 context.data[type].html = req.responseText;
56 if( req.status != 404 )
57 context.data[type].html = req.responseText;