From 0f08c8dda38d1ef9e89e5f59d81b86847239fe29 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Fri, 6 May 2022 23:40:32 +0200 Subject: [PATCH] Toggle visibility of extra requests options/settings when not in use (#584) --- changedetectionio/static/js/settings.js | 13 ------------- changedetectionio/static/js/watch-settings.js | 14 ++++++++++++++ changedetectionio/templates/edit.html | 9 ++++----- changedetectionio/templates/settings.html | 1 - 4 files changed, 18 insertions(+), 19 deletions(-) delete mode 100644 changedetectionio/static/js/settings.js create mode 100644 changedetectionio/static/js/watch-settings.js diff --git a/changedetectionio/static/js/settings.js b/changedetectionio/static/js/settings.js deleted file mode 100644 index 9ce51d07..00000000 --- a/changedetectionio/static/js/settings.js +++ /dev/null @@ -1,13 +0,0 @@ -window.addEventListener("load", (event) => { - // just an example for now - function toggleVisible(elem) { - // theres better ways todo this - var x = document.getElementById(elem); - if (x.style.display === "block") { - x.style.display = "none"; - } else { - x.style.display = "block"; - } - } -}); - diff --git a/changedetectionio/static/js/watch-settings.js b/changedetectionio/static/js/watch-settings.js new file mode 100644 index 00000000..c7f070fe --- /dev/null +++ b/changedetectionio/static/js/watch-settings.js @@ -0,0 +1,14 @@ +$(document).ready(function() { + function toggle() { + if ($('input[name="fetch_backend"]:checked').val() != 'html_requests') { + $('#requests-override-options').hide(); + } else { + $('#requests-override-options').show(); + } + } + $('input[name="fetch_backend"]').click(function (e) { + toggle(); + }); + toggle(); + +}); diff --git a/changedetectionio/templates/edit.html b/changedetectionio/templates/edit.html index 07af9c4d..87590fb3 100644 --- a/changedetectionio/templates/edit.html +++ b/changedetectionio/templates/edit.html @@ -9,6 +9,7 @@ const email_notification_prefix=JSON.parse('{{ emailprefix|tojson }}'); {% endif %} +
@@ -65,12 +66,10 @@
-
-
- - +
+
Request override is currently only used by the Basic fast Plaintext/HTTP Client method. - +
{{ render_field(form.method) }}
diff --git a/changedetectionio/templates/settings.html b/changedetectionio/templates/settings.html index fcac7097..f66c0755 100644 --- a/changedetectionio/templates/settings.html +++ b/changedetectionio/templates/settings.html @@ -9,7 +9,6 @@ const email_notification_prefix=JSON.parse('{{emailprefix|tojson}}'); {% endif %} -