Revision 70022b58
Added by koszko about 1 year ago
src/worldcat-org-fix/index.json | ||
---|---|---|
16 | 16 |
"type": "mapping_and_resource", |
17 | 17 |
"identifier": "worldcat-org-fix", |
18 | 18 |
"long_name": "WorldCat catalog search fix", |
19 |
"version": [2022, 2, 18],
|
|
20 |
"revision": 2,
|
|
19 |
"version": [2022, 6, 28],
|
|
20 |
"revision": 1,
|
|
21 | 21 |
"description": "Make library catalogs on worldcat.org searchable without relying on site-served JavaScript.", |
22 | 22 |
"dependencies": [], |
23 | 23 |
"scripts": [{"file": "worldcat.js"}], |
src/worldcat-org-fix/worldcat.js | ||
---|---|---|
20 | 20 |
|
21 | 21 |
// Generate a function which, when invoked, loads the catalog holdings starting at i (one-indexed) focused on loc |
22 | 22 |
function generateGoTo(i, set_loc) { |
23 |
return function () { |
|
23 |
return function (e) { |
|
24 |
e.preventDefault(); |
|
24 | 25 |
; // If this is a new search, "set_loc" won't be set; set it |
25 |
var xhr = new content.XMLHttpRequest(), loc = set_loc || encodeURIComponent(locInput.value);
|
|
26 |
var xhr = new XMLHttpRequest(), loc = set_loc || encodeURIComponent(locInput.value); |
|
26 | 27 |
xhr.onreadystatechange = function () { |
27 | 28 |
if (this.readyState === 4) { |
28 | 29 |
if (this.status === 200) { |
... | ... | |
42 | 43 |
xhr.open('GET', 'https://www.worldcat.org/wcpa/servlet/org.oclc.lac.ui.ajax.ServiceServlet?wcoclcnum=' + itemRef + '&start_holding=' |
43 | 44 |
+ i + '&serviceCommand=holdingsdata&loc=' + loc, true); |
44 | 45 |
xhr.send(); |
45 |
return false; // Make sure the browser doesn't try to submit any holding form |
|
46 | 46 |
}; |
47 | 47 |
} |
48 | 48 |
|
Also available in: Unified diff
update Worldcat fix