From e24c60dd6acbb8db5912a7715c302374d7eb18b8 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Fri, 18 Feb 2022 18:51:22 +0100 Subject: translate all site fixes to the new Hydrilla format Fixes in new format are yet to be tested. Things may break. Alternative site interfaces were removed. This repository is meant exclusively for holding fixes for js-encumbered websites. Jahoti's SParse code shall be put in a separate repository. --- content/sworldcat_library_holdings/index.json | 6 -- .../sworldcat_library_holdings/library_holdings.js | 65 ---------------------- 2 files changed, 71 deletions(-) delete mode 100644 content/sworldcat_library_holdings/index.json delete mode 100644 content/sworldcat_library_holdings/library_holdings.js (limited to 'content/sworldcat_library_holdings') diff --git a/content/sworldcat_library_holdings/index.json b/content/sworldcat_library_holdings/index.json deleted file mode 100644 index f2f3a39..0000000 --- a/content/sworldcat_library_holdings/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ -"type" : "script", -"name" : "worldcat (library holdings)", -"sha256" : "b1ffa6162dc9f68e2bfb1d4b6adaeac850c23bcfcc86162a2d4450aecc22f7fd", -"location" : "library_holdings.js" -} diff --git a/content/sworldcat_library_holdings/library_holdings.js b/content/sworldcat_library_holdings/library_holdings.js deleted file mode 100644 index 3a30b2b..0000000 --- a/content/sworldcat_library_holdings/library_holdings.js +++ /dev/null @@ -1,65 +0,0 @@ -/* - Copyright © 2021 jahoti (jahoti@tilde.team) - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -var pathParts = location.pathname.split('/'), itemRef = pathParts[pathParts.length - 1]; - -// 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 () { - ; // 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); - xhr.onreadystatechange = function () { - if (this.readyState === 4) { - if (this.status === 200) { - retrieved.innerHTML = this.responseText; - - var i, node = document.getElementById('libslocator'); - node.parentNode.removeChild(node); - for (node of retrieved.querySelectorAll('a[href^="javascript:findLibs(\'\', "]')) { - i = parseInt(node.href.split(',', 2)[1]); - node.onclick = generateGoTo(i, loc); - } - } - else alert('Search failed: response code ' + this.status); - } - } - - 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 - }; -} - - -var retriever = document.querySelector('.retrieving'), retrieved = document.getElementById('donelocator'); - -var locForm = document.createElement('form'), locLabel = document.createElement('label'), locInput = document.createElement('input'), - locSubmit = document.createElement('input'); - -locForm.appendChild(locLabel); -locForm.appendChild(locInput); -locForm.appendChild(locSubmit); - -locInput.name = locLabel.htmlFor = 'cat_location'; -locInput.type = 'text'; -locInput.required = 'yes'; -locLabel.innerText = 'Find copies closest to: '; -locSubmit.value = 'Go'; -locSubmit.type = 'submit'; -locForm.onsubmit = generateGoTo(1); - -retriever.parentNode.replaceChild(locForm, retriever); \ No newline at end of file -- cgit v1.2.3