From 70022b58d156ca58ff7cb53a4a0c1f111d161403 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 28 Jun 2022 20:54:58 +0200 Subject: update Worldcat fix --- src/worldcat-org-fix/index.json | 4 ++-- src/worldcat-org-fix/worldcat.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/worldcat-org-fix') diff --git a/src/worldcat-org-fix/index.json b/src/worldcat-org-fix/index.json index a4e8edd..0c1f341 100644 --- a/src/worldcat-org-fix/index.json +++ b/src/worldcat-org-fix/index.json @@ -16,8 +16,8 @@ "type": "mapping_and_resource", "identifier": "worldcat-org-fix", "long_name": "WorldCat catalog search fix", - "version": [2022, 2, 18], - "revision": 2, + "version": [2022, 6, 28], + "revision": 1, "description": "Make library catalogs on worldcat.org searchable without relying on site-served JavaScript.", "dependencies": [], "scripts": [{"file": "worldcat.js"}], diff --git a/src/worldcat-org-fix/worldcat.js b/src/worldcat-org-fix/worldcat.js index 0a4b531..b35a12f 100644 --- a/src/worldcat-org-fix/worldcat.js +++ b/src/worldcat-org-fix/worldcat.js @@ -20,9 +20,10 @@ var pathParts = location.pathname.split('/'), itemRef = pathParts[pathParts.leng // Generate a function which, when invoked, loads the catalog holdings starting at i (one-indexed) focused on loc function generateGoTo(i, set_loc) { - return function () { + return function (e) { + e.preventDefault(); ; // If this is a new search, "set_loc" won't be set; set it - var xhr = new content.XMLHttpRequest(), loc = set_loc || encodeURIComponent(locInput.value); + var xhr = new XMLHttpRequest(), loc = set_loc || encodeURIComponent(locInput.value); xhr.onreadystatechange = function () { if (this.readyState === 4) { if (this.status === 200) { @@ -42,7 +43,6 @@ function generateGoTo(i, set_loc) { xhr.open('GET', 'https://www.worldcat.org/wcpa/servlet/org.oclc.lac.ui.ajax.ServiceServlet?wcoclcnum=' + itemRef + '&start_holding=' + i + '&serviceCommand=holdingsdata&loc=' + loc, true); xhr.send(); - return false; // Make sure the browser doesn't try to submit any holding form }; } -- cgit v1.2.3