From bac96457a5b53a3f5fa5857e108e9e32515bb02b Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Mon, 21 Feb 2022 14:03:11 +0100 Subject: improve some of the fixes and add sample URLs for testing --- index.json | 102 +++++++++++++++++++++++++++---------- src/box.js | 29 +++-------- src/google_forms.js | 40 ++++++++------- src/odysee.js | 4 +- src/pcspecialist_cookie_notice.js | 21 -------- src/pcspecialist_display_prices.js | 2 +- src/pcspecialist_notice.js | 35 +++++++++++++ src/royal_geographical_society.js | 25 +++++---- 8 files changed, 156 insertions(+), 102 deletions(-) delete mode 100644 src/pcspecialist_cookie_notice.js create mode 100644 src/pcspecialist_notice.js diff --git a/index.json b/index.json index 6cb9129..0522ce9 100644 --- a/index.json +++ b/index.json @@ -33,6 +33,10 @@ "version": [2022, 2, 18], "description": "Make accuweather.com display its contents without nonfree JavaScript.", "payloads": { + // * https://www.accuweather.com/en/pl/krakow/2-274455_1_al/weather-forecast/2-274455_1_al + // * https://www.accuweather.com/en/us/new-york/10007/weather-forecast/349727 + // Or just go https://www.accuweather.com/en/search-locations?query= + // and select a city from the list. "https://www.accuweather.com/***": { "identifier": "accuweather-com-fix" } @@ -56,6 +60,9 @@ "version": [2022, 2, 18], "description": "Make bandcamp.com inline player usable without nonfree JavaScript.", "payloads": { + // * https://old.reddit.com/search?q=url%3Abandcamp.com%2Ftrack%2F <- to get more testing links + // * https://chaiofficial.bandcamp.com/track/whole + // * https://studio273.bandcamp.com/track/sweet "https://*.bandcamp.com/track/*": { "identifier": "bandcamp-com-fix" } @@ -79,6 +86,13 @@ "version": [2022, 2, 18], "description": "Make app.box.com files downloadable without nonfree JavaScript.", "payloads": { + // * https://old.reddit.com/domain/app.box.com/ <- to get more testing links + // * https://uwmadison.app.box.com/s/ydht2incbdmw1lhpjg5t40adguc0fm14 + // * https://app.box.com/s/gc4ygloi4qtimeh98dq9mmydyuydawcn + // * https://app.box.com/s/vysdh2u78yih3c8leetgq82il954a3g3 + // * https://app.box.com/s/nnlplkmjhimau404qohh9my10pwmo8es + // * https://ucla.app.box.com/s/mv32q624ojihohzh8d0mhhj0b3xluzbz + // * https://app.box.com/s/6qktxunhz5sjkheg1a8iihvu4mofpdue "https://***.app.box.com/s/*": { "identifier": "app-box-fix" } @@ -86,37 +100,47 @@ }, { "type": "resource", - "identifier": "pcspecialist-co-uk-fix-cookienotice", - "long_name": "PCSpecialist cookie notice fix", + "identifier": "pcspecialist-fix-notice", + "long_name": "PCSpecialist notice fix", "uuid": "ce43448d-7c51-4e63-91b0-d69ffd4dd4d1", - "version": [2022, 2, 18], + "version": [2022, 2, 21], "revision": 1, - "description": "Make pcspecialist.co.uk cookie notice closable without nonfree JavaScript.", + "description": "Make PCSpecialist cookie and language notices closable without nonfree JavaScript.", "dependencies": [], - "scripts": [{"file": "src/pcspecialist_cookie_notice.js"}] + "scripts": [{"file": "src/pcspecialist_notice.js"}] }, { "type": "resource", - "identifier": "pcspecialist-co-uk-fix-priceview", + "identifier": "pcspecialist-fix-priceview", "long_name": "PCSpecialist price display fix", "uuid": "57a21d8a-8d7b-466b-b9c9-69d835619e4d", - "version": [2022, 2, 18], + "version": [2022, 2, 21], "revision": 1, - "description": "Make pcspecialist.co.uk product prices viewable without nonfree JavaScript.", - "dependencies": [], + "description": "Make PCSpecialist product prices viewable without nonfree JavaScript.", + "dependencies": [{"identifier": "pcspecialist-fix-notice"}], "scripts": [{"file": "src/pcspecialist_display_prices.js"}] }, { "type": "mapping", - "identifier": "pcspecialist-co-uk-fix", + "identifier": "pcspecialist-fix", "long_name": "PCSpecialist fix", "uuid": "159a2adc-9b05-4dc6-9eb3-e18ee3843d8d", - "version": [2022, 2, 18], - "description": "Make pcspecialist.co.uk cookie notice closable and display prices without nonfree JavaScript.", + "version": [2022, 2, 21], + "description": "Make PCSpecialist cookie notice closable and display prices without nonfree JavaScript.", "payloads": { + // https://www.pcspecialist.co.uk/ "https://www.pcspecialist.co.uk/***": { - "identifier": "pcspecialist-co-uk-fix-cookienotice" + "identifier": "pcspecialist-fix-notice" }, + // https://www.pcspecialist.pl/ + "https://www.pcspecialist.pl/***": { + "identifier": "pcspecialist-fix-notice" + }, + // https://www.pcspecialist.co.uk/view/AURORA-ELITE/ "https://www.pcspecialist.co.uk/view/*": { - "identifier": "pcspecialist-co-uk-fix-priceview" + "identifier": "pcspecialist-fix-priceview" + }, + // https://www.pcspecialist.pl/widok/Torva-Elite/ + "https://www.pcspecialist.pl/widok/*": { + "identifier": "pcspecialist-fix-priceview" } } }, { @@ -138,6 +162,7 @@ "version": [2022, 2, 18], "description": "Make it possible to sumbit SMS code on acsv.centrum24.pl without nonfree JavaScript.", "payloads": { + // Only possible to use when paying with a credit/debit card online. "https://acsv.centrum24.pl/ACS/servlet/ACSAuthoriz": { "identifier": "acsv-centrum24-pl-fix-authorize" } @@ -171,7 +196,7 @@ "identifier": "google-forms-fix", "long_name": "Google Forms submission (incomplete) fix", "uuid": "23f51630-6118-4ef2-9709-2a1dba7ebb52", - "version": [2022, 2, 18], + "version": [2022, 2, 21], "revision": 1, "description": "Enable filling and submitting of Google Forms without nonfree JavaScript.", "dependencies": [], @@ -181,10 +206,14 @@ "identifier": "google-forms-fix", "long_name": "Google Forms submission (incomplete) fix", "uuid": "0aba91dc-e552-4276-a981-1a56d30f9058", - "version": [2022, 2, 18], + "version": [2022, 2, 21], "description": "Enable filling and submitting of Google Forms without nonfree JavaScript.", "payloads": { - "https://docs.google.com/forms/d/e/**": { + // * https://old.reddit.com/search?q=url%3Adocs.google.com%2Fforms <- to get more testing links + // * https://docs.google.com/forms/d/e/1FAIpQLSeptahnx4tj-mr2QIzKiy1LN0HrZVR88-XwVtKDb33KbshaQA/viewform + // * https://docs.google.com/forms/d/e/1FAIpQLSeswHRJzUMWnCQPnaGHeB3xM7YyJdWMf2eMpHJOnetLEoeXmw/viewform + // * https://docs.google.com/forms/d/e/1FAIpQLSeptahnx4tj-mr2QIzKiy1LN0HrZVR88-XwVtKDb33KbshaQA/viewform + "https://docs.google.com/forms/d/**": { "identifier": "google-forms-fix" } } @@ -207,6 +236,7 @@ "version": [2022, 2, 18], "description": "Enable browsing of Google Drive folders without nonfree JavaScript.", "payloads": { + // * https://old.reddit.com/search?q=url%3Adrive.google.com%2Fdrive%2Ffolders%2F <- to get testing links "https://drive.google.com/drive/folders/***": { "identifier": "google-drive-fix-browse" } @@ -230,6 +260,7 @@ "version": [2022, 2, 18], "description": "Enable download of Google Drive files without nonfree JavaScript.", "payloads": { + // * https://old.reddit.com/search?q=url%3Adrive.google.com%2Fdrive%2Ffile%2Fd%2F <- to get testing links "https://drive.google.com/file/d/**": { "identifier": "google-drive-fix-download" } @@ -240,9 +271,9 @@ "identifier": "google-sheets-fix-display", "long_name": "Google Sheets display&download fix", "uuid": "268235b0-85d5-4170-b90f-7722926f0a93", - "version": [2022, 2, 18, 1], + "version": [2022, 2, 21], "revision": 1, - "description": "Make spreadsheets on drive.google.com viewable and downloadable without nonfree JavaScript.", + "description": "Make spreadsheets on docs.google.com viewable and downloadable without nonfree JavaScript.", "dependencies": [], "scripts": [{"file": "src/google_sheets_download.js"}] }, { @@ -250,9 +281,10 @@ "identifier": "google-sheets-fix-display", "long_name": "Google Sheets display&download fix", "uuid": "adf53341-685d-4c20-b481-d5c778144ec6", - "version": [2022, 2, 18], - "description": "Make spreadsheets on drive.google.com viewable and downloadable without nonfree JavaScript.", + "version": [2022, 2, 21], + "description": "Make spreadsheets on docs.google.com viewable and downloadable without nonfree JavaScript.", "payloads": { + // * https://old.reddit.com/search?q=url%3Adocs.google.com%2Fspreadsheets%2Fd%2F <- to get testing links "https://docs.google.com/spreadsheets/d/**": { "identifier": "google-sheets-fix-display" } @@ -276,6 +308,7 @@ "version": [2022, 2, 18], "description": "Make videos on archive.org playable without relying on site-served JavaScript.", "payloads": { + // * https://archive.org/details/opensource_movies <- to get testing links "https://archive.org/details/*": { "identifier": "internet-archive-fix-videos" } @@ -299,6 +332,7 @@ "version": [2022, 2, 18], "description": "Make library catalogs on worldcat.org searchable without nonfree JavaScript.", "payloads": { + // * https://old.reddit.com/search?q=url%3Aworldcat.org%2Ftitle%2F <- to get testing links "https://www.worldcat.org/title/**": { "identifier": "worldcat-org-fix" }, @@ -312,7 +346,7 @@ "identifier": "odysee-com-fix", "long_name": "Odysee fix", "uuid": "3309cb13-9910-4bdd-ab15-d6bb4f84c16a", - "version": [2022, 2, 18], + "version": [2022, 2, 21], "revision": 1, "description": "Make video playback and search on odysee.com functional without nonfree JavaScript.", "dependencies": [], @@ -325,6 +359,8 @@ "version": [2022, 2, 18], "description": "Make video playback and search on odysee.com functional without nonfree JavaScript.", "payloads": { + // To test go to https://odysee.com/, then try searching for videos + // and playing them. "https://odysee.com/***": { "identifier": "odysee-com-fix" } @@ -358,7 +394,7 @@ "identifier": "rgs-org-fix-exhibitions", "long_name": "Royal Geographical Society online exhibitions fix", "uuid": "041bc23a-86ca-4c98-8bc2-2965baa0f5f9", - "version": [2022, 2, 18], + "version": [2022, 2, 21], "revision": 1, "description": "Make online exhibitions pages on rgs.org viewable without nonfree JavaScript.", "dependencies": [], @@ -371,6 +407,8 @@ "version": [2022, 2, 18], "description": "Make online exhibitions pages on rgs.org viewable without nonfree JavaScript.", "payloads": { + // To test go to https://www.rgs.org/about/our-collections/online-exhibitions/ + // and navigate to subpages from there. "https://www.rgs.org/about/our-collections/online-exhibitions/***": { "identifier": "rgs-org-fix-exhibitions" } @@ -394,6 +432,9 @@ "version": [2022, 2, 18], "description": "Make benchmarks in phoronix.com articles display without nonfree JavaScript.", "payloads": { + // To test use your preferred search engine to search for + // "phoronix com benchmarks" - most of the articles that show up + // should have some openbenchmarking.org benchmarks in them. "https://www.phoronix.com/***": { "identifier": "phoronix-com-fix-benchmarks" } @@ -417,6 +458,7 @@ "version": [2022, 2, 18], "description": "Make it possible to sign SumOfUs petitions without nonfree Javascript.", "payloads": { + // * https://actions.sumofus.org/a/mps-protect-the-indigenous-people-and-scrap-draft-bill-490-2007-1 "https://actions.sumofus.org/a/*": { "identifier": "sumofus-fix" } @@ -437,7 +479,7 @@ "identifier": "stack-exchange-fix-cookienotice", "long_name": "StackExchange cookie notice fix", "uuid": "ed01ce66-2dae-492f-9448-7e6309970315", - "version": [2022, 2, 18], + "version": [2022, 2, 21], "description": "Make cookie notice on StackExchange websites closable without nonfree JavaScript.", "payloads": { // The list of domains can be constructed by going to @@ -446,9 +488,10 @@ // .filter(n => n.nodeName === "A" && n.href) // .map(n => n.href) // .filter(u => !/^https:\/\/[^.]+\.stackexchange.com\/$/.test(u)) - "https://stackoverflow.com/***": { - "identifier": "stack-exchange-fix-cookienotice" - }, + // + // * https://academia.stackexchange.com/questions/182562/results-that-are-too-good-to-be-true-peer-review + // * https://stackoverflow.com + // * https://superuser.com "https://serverfault.com/***": { "identifier": "stack-exchange-fix-cookienotice" }, @@ -504,6 +547,8 @@ "version": [2022, 2, 18], "description": "Watch YouTube videos on yewtu.be instead.", "payloads": { + // * https://youtube.com/watch?v=aqz-KE-bpKQ + // * https://www.youtube.com/embed/aqz-KE-bpKQ "https://www.youtube.com/***": { "identifier": "yewtube-com-redirect-yewtube" } @@ -527,6 +572,9 @@ "version": [2022, 2, 18], "description": "Watch vaticannews.va embedded YouTube videos on yewtu.be instead.", "payloads": { + // * https://www.vaticannews.va/en/vatican-city/news/2022-02/caritas-cambodia-retreat-czerny-video-message-care-fraternity.html + // Or just go to vaticannews.va and look for an article with video + // in it. "https://www.vaticannews.va/***": { "identifier": "vaticannews-va-fix-videos" } diff --git a/src/box.js b/src/box.js index f02bf3a..0d8bb87 100644 --- a/src/box.js +++ b/src/box.js @@ -40,27 +40,14 @@ * proprietary program, I am not going to enforce this in court. */ -// meta: match should be https://***.app.box.com/s/* (*** instead of * for the first section because otherwise plain app.box.com URLs won't work) -// meta: some test cases (mostly found at https://old.reddit.com/search?q="box.com"&include_over_18=on&sort=new) - // https://uwmadison.app.box.com/s/ydht2incbdmw1lhpjg5t40adguc0fm14 - // umadison's enrollment report - // pdf - // https://app.box.com/s/gc4ygloi4qtimeh98dq9mmydyuydawcn - // password-protected 7z file (nsfw) - // https://app.box.com/shared/static/su6xx6zx50cd68zdtbm3wfxhh9kwke8x.zip - // a soundtrack in a zip file - // This is a static download, so it works without this script. - // https://app.box.com/s/vysdh2u78yih3c8leetgq82il954a3g3 - // some gambling ad - // pptx - // https://app.box.com/s/nnlplkmjhimau404qohh9my10pwmo8es - // a list of books(?) - // txt - // https://ucla.app.box.com/s/mv32q624ojihohzh8d0mhhj0b3xluzbz - // "COVID-19 Pivot Plan Decision Matrix" - // If you load the proprietary scripts on this page, you'll see that there is no download button - // TODO: find a public folder link (the private links I have seem to work) - // TODO: find a (preferably public) link with a folder inside a folder, as these may need to be handled differently +/* + * Use with https://***.app.box.com/s/* + * '***' instead of '*' for the first section because otherwise plain app.box.com + * URLs won't work. + */ + +// TODO: find a public folder link (the private links I have seem to work) +// TODO: find a (preferably public) link with a folder inside a folder, as these may need to be handled differently /* Extract data from a script that sets multiple variables. */ // from here: https://api-demo.hachette-hydrilla.org/content/sgoogle_sheets_download/google_sheets_download.js diff --git a/src/google_forms.js b/src/google_forms.js index 5d8826d..54c1a04 100644 --- a/src/google_forms.js +++ b/src/google_forms.js @@ -4,6 +4,7 @@ * (Incomplete) Fix for Google Forms * * Copyright © 2021 jahoti + * Copyright 2022 Wojtek Kosior * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +17,10 @@ * 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. + * + * I, Wojtek Kosior, thereby promise not to sue for violation of this file's + * license. Although I request that you do not make use of this code in a way + * incompliant with the license, I am not going to enforce this in court. */ var form = document.forms[0]; @@ -24,13 +29,18 @@ for (let div of form.querySelectorAll('div[data-params]')) { var name = 'entry.' + data[0][4][0][0]; var input = div.querySelector('input'); + if (!input) { + console.error(`cannot enable input ${name}`, div); + continue; + } + if (input.name === name + '_sentinel') { // Radio - for (input of div.querySelectorAll('.appsMaterialWizToggleRadiogroupElContainer')) { - div = document.createElement('input'); - div.type = 'radio'; - div.name = name; - div.value = input.nextElementSibling.innerText.trim(); - input.parentNode.replaceChild(div, input); + for (const input_div of div.querySelectorAll('.appsMaterialWizToggleRadiogroupEl')) { + const new_radio = document.createElement('input'); + new_radio.type = 'radio'; + new_radio.name = name; + new_radio.value = input_div.getAttribute("data-value"); + input_div.replaceWith(new_radio); } } else { input.removeAttribute('disabled'); @@ -51,16 +61,12 @@ function goToNext() form.submit(); } -for (div of document.querySelectorAll('.freebirdFormviewerViewNavigationNoSubmitButton')) { - input = document.createElement('button'); +const submit_selector = ".freebirdFormviewerViewNavigationSubmitButton"; +const next_selector = ".freebirdFormviewerViewNavigationNoSubmitButton"; +for (const but_div of document.querySelectorAll(submit_selector)) + but_div.addEventListener("click", () => form.submit()); - data = div.innerText.trim(); - input.innerText = data; - if (data.toLowerCase() === 'next') - input.onclick = goToNext; - else if (data.toLowerCase() === 'submit') - input.type = 'submit'; - div.parentNode.replaceChild(input, div); -} +for (const but_div of document.querySelectorAll(next_selector)) + but_div.addEventListener("click", goToNext); -// TODO: back, instate previous entries +// TODO: back, instate previous entries, fix form parts that still don't work diff --git a/src/odysee.js b/src/odysee.js index cd1c49c..e0c6609 100644 --- a/src/odysee.js +++ b/src/odysee.js @@ -287,7 +287,7 @@ function show_search_entries(new_results_div, response) description_div.textContent = result.value.description; result_a.setAttribute("style", "display: block; width: 100%; text-decoration: none; color: #333; margin: 8px; border-style: solid; border-width: 3px 0 0 0; border-color: #7aa;"); - result_a.href = `https://odysee.com${channel_specifier}/${video_name}:${video_id}`; + result_a.href = `https://odysee.com/${channel_specifier}/${video_name}:${video_id}`; if (result.value.thumbnail.url) result_a.appendChild(thumbnail); @@ -325,7 +325,7 @@ function search_ajax_error(url) function get_detailed_search_entries(new_results_div, response) { - /* TODO: Simplify JSON handling using sanitize_JSON.js from Hachette. */ + /* TODO: Simplify JSON handling using JSON schemas. */ try { var response_data = JSON.parse(response); if (!Array.isArray(response_data)) diff --git a/src/pcspecialist_cookie_notice.js b/src/pcspecialist_cookie_notice.js deleted file mode 100644 index bd61bf7..0000000 --- a/src/pcspecialist_cookie_notice.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * SPDX-License-Identifier: Apache-2.0 - * - * Copyright © 2021 jahoti - * - * 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 jbc = document.querySelector('.cc-policy'); - -jbc.querySelector('.cc-buttons').onclick = () => jbc.parentNode.removeChild(jbc); diff --git a/src/pcspecialist_display_prices.js b/src/pcspecialist_display_prices.js index c28cb47..d38fee3 100644 --- a/src/pcspecialist_display_prices.js +++ b/src/pcspecialist_display_prices.js @@ -32,7 +32,7 @@ function updatePrice() { } } - const url = 'https://www.pcspecialist.co.uk/ajax/running_total.php?categories=' + names.join('%2C') + + const url = '/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; diff --git a/src/pcspecialist_notice.js b/src/pcspecialist_notice.js new file mode 100644 index 0000000..987c1c2 --- /dev/null +++ b/src/pcspecialist_notice.js @@ -0,0 +1,35 @@ +/** + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright © 2021 jahoti + * Copyright 2022 Wojtek Kosior + * + * 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. + * + * I, Wojtek Kosior, thereby promise not to sue for violation of this file's + * license. Although I request that you do not make use of this code in a way + * incompliant with the license, I am not going to enforce this in court. + */ + +/* Make cookie notice closable. */ +const to_rem = document.querySelectorAll(".cc-policy-overlay, .cc-policy"); + +for (const cc_button of document.querySelectorAll(".cc-policy .cc-buttons")) + cc_button.addEventListener("click", () => to_rem.forEach(n => n.remove())); + +/* Make country selection popup closable. */ +const langbox_remover = () => document.getElementById("langbox").remove(); + +const link_selector = ".country_flag a[onclick], .country_button a[onclick]"; +for (const a of document.querySelectorAll(link_selector)) + a.addEventListener("click", langbox_remover); diff --git a/src/royal_geographical_society.js b/src/royal_geographical_society.js index 0e983b0..0fa5080 100644 --- a/src/royal_geographical_society.js +++ b/src/royal_geographical_society.js @@ -1,20 +1,19 @@ /** - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: CC0-1.0 * - * Copyright © 2021 jahoti + * Unhide RGS exhibitions page after it loads without nonfree js. * - * 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 + * Copyright (C) 2021 Wojtek Kosior * - * http://www.apache.org/licenses/LICENSE-2.0 + * This program is free software: you can redistribute it and/or modify + * it under the terms of the CC0 1.0 Universal License as published by + * the Creative Commons Corporation. * - * 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. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * CC0 1.0 Universal License for more details. */ -document.documentElement.style.visibility = 'visible'; -document.documentElement.style.opacity = '100'; +const unhide_style = "visibility: visible !important; opacity: 1 !important;"; +document.documentElement.setAttribute("style", unhide_style); -- cgit v1.2.3