2 * This function should return a URL which points to the book cover image based on ISBN.
6 function buildISBNSrc(isbn, size) {
7 size = (size) ? size : 'small';
8 if(OILS_OPAC_IMAGES_HOST)
9 return location.protocol + '//' + OILS_OPAC_IMAGES_HOST + size + '/' + isbn;
10 return '../../../../extras/ac/jacket/'+size+'/'+isbn;
14 function acMakeURL(type, key) {
15 return '../../../../extras/ac/' + type + '/html/' + key;
19 function acCollectData( key, callback ) {
20 var context = { key : key, callback: callback, data : {} };
21 acCollectItem(context, 'reviews');
22 acCollectItem(context, 'toc');
23 acCollectItem(context, 'excerpt');
24 acCollectItem(context, 'anotes');
27 function acCheckDone(context) {
28 if( context.data.reviews && context.data.reviews.done &&
29 context.data.toc && context.data.toc.done &&
30 context.data.excerpt && context.data.excerpt.done &&
31 context.data.anotes && context.data.anotes.done ) {
33 if(context.callback) context.callback(context.data);
37 function acCollectItem(context, type) {
38 var req = buildXMLRequest();
39 req.open('GET', acMakeURL(type, context.key), true);
40 req.onreadystatechange = function() {
41 if( req.readyState == 4 ) {
42 context.data[type] = { done : true }
46 /* Someone please explain why IE treats status 404 as status 200??
47 On second thought, don't bother.
49 if( ! req.responseText.match(
50 /The requested URL.*was not found on this server/) )
51 context.data[type].html = req.responseText;
54 if( req.status != 404 )
55 context.data[type].html = req.responseText;