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. --- .../display_prices.js | 55 ---------------------- .../spc_specialist_uk-_display_prices/index.json | 6 --- 2 files changed, 61 deletions(-) delete mode 100644 content/spc_specialist_uk-_display_prices/display_prices.js delete mode 100644 content/spc_specialist_uk-_display_prices/index.json (limited to 'content/spc_specialist_uk-_display_prices') diff --git a/content/spc_specialist_uk-_display_prices/display_prices.js b/content/spc_specialist_uk-_display_prices/display_prices.js deleted file mode 100644 index f60f6ae..0000000 --- a/content/spc_specialist_uk-_display_prices/display_prices.js +++ /dev/null @@ -1,55 +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. -*/ - -const formId = document.querySelector('input[name="page_id"]').value; -const form = document.querySelector('form[name="specbuilder"]'); -const noVat = document.getElementById('running_total_ex'); -const incVat = document.getElementById('running_total_inc'); - -function updatePrice() { - const xhr = new XMLHttpRequest(); - - var names = [], values = []; - for (var inputElement of form.querySelectorAll('select, input[type="radio"]')) { - if (inputElement.name && (inputElement.checked || inputElement.tagName === 'SELECT')) { - names.push(inputElement.name); - values.push(inputElement.value); - } - } - - const url = 'https://www.pcspecialist.co.uk/ajax/running_total.php?categories=' + names.join('%2C') + - '%2C&products=' + values.join('%2C') + '%2C&q=' + form.querySelector('input[name="q"]').value + '&form_id=' + formId; - - xhr.onreadystatechange = priceUpdated; - xhr.open('GET', url, true); - xhr.send(); -} - -function priceUpdated() { - if (this.readyState === 4) { - if (this.status === 200) { - const parts = this.responseText.split("'"); - noVat.innerText = parts[parts.length - 6]; - incVat.innerText = parts[parts.length - 2]; - } - else alert('Failed to get data: HTTP status code ' + this.status); - } -} - -const button = document.createElement('button'); -button.innerText = 'Update Prices'; -button.onclick = updatePrice; -document.querySelector('.price-holder.price-finance-holder').append(button); \ No newline at end of file diff --git a/content/spc_specialist_uk-_display_prices/index.json b/content/spc_specialist_uk-_display_prices/index.json deleted file mode 100644 index 98ebc2f..0000000 --- a/content/spc_specialist_uk-_display_prices/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ -"type" : "script", -"name" : "PC Specialist UK- Display Prices", -"sha256" : "2fe767a1b8ee4d28e4c15eb065ecfbc0d4aebebfb2569497ed779a0ebe71112b", -"location" : "display_prices.js" -} -- cgit v1.2.3