aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWojtek Kosior <koszko@koszko.org>2022-02-21 14:03:11 +0100
committerWojtek Kosior <koszko@koszko.org>2022-02-21 14:03:11 +0100
commitbac96457a5b53a3f5fa5857e108e9e32515bb02b (patch)
treec0db5658a7201146e729bef85aecbca2bf1f6caa /src
parentc9ea962d4703fdc33fb5af6670383b721e8be3f9 (diff)
downloadhydrilla-fixes-bundle-bac96457a5b53a3f5fa5857e108e9e32515bb02b.tar.gz
hydrilla-fixes-bundle-bac96457a5b53a3f5fa5857e108e9e32515bb02b.zip
improve some of the fixes and add sample URLs for testing
Diffstat (limited to 'src')
-rw-r--r--src/box.js29
-rw-r--r--src/google_forms.js40
-rw-r--r--src/odysee.js4
-rw-r--r--src/pcspecialist_cookie_notice.js21
-rw-r--r--src/pcspecialist_display_prices.js2
-rw-r--r--src/pcspecialist_notice.js35
-rw-r--r--src/royal_geographical_society.js25
7 files changed, 81 insertions, 75 deletions
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 <jahoti@tilde.team>
+ * Copyright 2022 Wojtek Kosior <koszko@koszko.org>
*
* 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 <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 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 <jahoti@tilde.team>
+ * Copyright 2022 Wojtek Kosior <koszko@koszko.org>
+ *
+ * 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 <jahoti@tilde.team>
+ * 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 <koszko@koszko.org>
*
- * 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);