|
Lines 112-117
var ol_readapi_automator =
Link Here
|
| 112 |
// 'constants' |
112 |
// 'constants' |
| 113 |
var readapi_bibids = ['isbn', 'lccn', 'oclc', 'olid', 'iaid', 'bibkeys']; |
113 |
var readapi_bibids = ['isbn', 'lccn', 'oclc', 'olid', 'iaid', 'bibkeys']; |
| 114 |
var magic_classname = 'ol_readapi_book'; |
114 |
var magic_classname = 'ol_readapi_book'; |
|
|
115 |
var ol_readapi_books = $("." + magic_classname ); |
| 116 |
var result; |
| 115 |
|
117 |
|
| 116 |
// added to book divs to correlate with API results |
118 |
// added to book divs to correlate with API results |
| 117 |
var magic_bookid = 'ol_bookid'; |
119 |
var magic_bookid = 'ol_bookid'; |
|
Lines 171-179
function make_read_button(bookdata) {
Link Here
|
| 171 |
function default_decorate_el_fn(el, bookdata) { |
173 |
function default_decorate_el_fn(el, bookdata) { |
| 172 |
// Note that 'bookdata' may be undefined, if the Read API call |
174 |
// Note that 'bookdata' may be undefined, if the Read API call |
| 173 |
// didn't return results for this book |
175 |
// didn't return results for this book |
| 174 |
if (!bookdata) { |
176 |
var decoration; |
| 175 |
decoration = 'Not found'; |
177 |
if (bookdata) { |
| 176 |
} else { |
|
|
| 177 |
decoration = make_read_button(bookdata); |
178 |
decoration = make_read_button(bookdata); |
| 178 |
} |
179 |
} |
| 179 |
if (decoration) { |
180 |
if (decoration) { |
|
Lines 216-230
function do_query(q, decorate_el_fn) {
Link Here
|
| 216 |
}); |
217 |
}); |
| 217 |
} |
218 |
} |
| 218 |
|
219 |
|
| 219 |
// Do stuff |
220 |
if( ol_readapi_books.length > 0 ){ |
| 220 |
var q = create_query(); |
221 |
// Do stuff |
| 221 |
do_query(q); |
222 |
var q = create_query(); |
|
|
223 |
do_query(q); |
| 222 |
|
224 |
|
| 223 |
result = { |
225 |
result = { |
| 224 |
do_query: do_query, |
226 |
do_query: do_query, |
| 225 |
create_query: create_query, |
227 |
create_query: create_query, |
| 226 |
make_read_button: make_read_button |
228 |
make_read_button: make_read_button |
| 227 |
}; |
229 |
}; |
|
|
230 |
} |
| 228 |
|
231 |
|
| 229 |
return result; |
232 |
return result; |
| 230 |
})(); // close anonymous scope |
233 |
})(); // close anonymous scope |
| 231 |
- |
|
|