From af35df5281b0cf2d21ff4c000025c9a3940b5021 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 15 Oct 2024 09:57:30 +0200 Subject: [PATCH 1/3] Offload inline javascript to file --- src/main/resources/public/lang.js | 5 +++++ src/main/resources/public/post.js | 3 +++ src/main/resources/templates/consent.html | 12 ++---------- src/main/resources/templates/device_continue.html | 12 ++---------- src/main/resources/templates/device_error.html | 12 ++---------- src/main/resources/templates/form_post.html | 5 +++-- src/main/resources/templates/verify.html | 12 ++---------- 7 files changed, 19 insertions(+), 42 deletions(-) create mode 100644 src/main/resources/public/lang.js create mode 100644 src/main/resources/public/post.js diff --git a/src/main/resources/public/lang.js b/src/main/resources/public/lang.js new file mode 100644 index 00000000..1af2015d --- /dev/null +++ b/src/main/resources/public/lang.js @@ -0,0 +1,5 @@ +function switchLang(lang) { + const searchParams = new URLSearchParams(window.location.search); + searchParams.set("lang", lang); + window.location.search = searchParams.toString(); +} diff --git a/src/main/resources/public/post.js b/src/main/resources/public/post.js new file mode 100644 index 00000000..a68b91da --- /dev/null +++ b/src/main/resources/public/post.js @@ -0,0 +1,3 @@ +document.addEventListener("DOMContentLoaded", function () { + document.forms[0].submit(); +}); diff --git a/src/main/resources/templates/consent.html b/src/main/resources/templates/consent.html index fd2fb032..6fee6640 100644 --- a/src/main/resources/templates/consent.html +++ b/src/main/resources/templates/consent.html @@ -138,13 +138,5 @@

- - \ No newline at end of file + + diff --git a/src/main/resources/templates/device_continue.html b/src/main/resources/templates/device_continue.html index 42313e49..04406d00 100644 --- a/src/main/resources/templates/device_continue.html +++ b/src/main/resources/templates/device_continue.html @@ -37,13 +37,5 @@

- - \ No newline at end of file + + diff --git a/src/main/resources/templates/device_error.html b/src/main/resources/templates/device_error.html index c01cc60a..1750c42a 100644 --- a/src/main/resources/templates/device_error.html +++ b/src/main/resources/templates/device_error.html @@ -37,13 +37,5 @@

- - \ No newline at end of file + + diff --git a/src/main/resources/templates/form_post.html b/src/main/resources/templates/form_post.html index 7c696f2c..56c703c7 100644 --- a/src/main/resources/templates/form_post.html +++ b/src/main/resources/templates/form_post.html @@ -1,6 +1,6 @@ Submit This Form - +
@@ -10,4 +10,5 @@
- \ No newline at end of file + + diff --git a/src/main/resources/templates/verify.html b/src/main/resources/templates/verify.html index ddd48b2f..b8a45277 100644 --- a/src/main/resources/templates/verify.html +++ b/src/main/resources/templates/verify.html @@ -83,13 +83,5 @@

- - \ No newline at end of file + + From b12d13bae4418b83013ff0a3ba5b835dcd1f8073 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Wed, 30 Oct 2024 16:41:23 +0100 Subject: [PATCH 2/3] Use legacy JS instead of event handlers Legacy browsers and 'embedded' browsers like the one in Office do not always support event handlers --- src/main/resources/public/post.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/resources/public/post.js b/src/main/resources/public/post.js index a68b91da..6e8d0288 100644 --- a/src/main/resources/public/post.js +++ b/src/main/resources/public/post.js @@ -1,3 +1,6 @@ -document.addEventListener("DOMContentLoaded", function () { +window.handleState = function handleState() { + if (document.readyState === 'interactive' || document.readyState === "complete") { document.forms[0].submit(); -}); + } +}; +document.onreadystatechange = window.handleState; From 59a224ab546dd3cb3f6d410ca93ba44b545e6772 Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Wed, 20 Nov 2024 09:30:00 +0100 Subject: [PATCH 3/3] Remove type for script-tags where content is JavaScript --- src/main/resources/templates/consent.html | 2 +- src/main/resources/templates/device_continue.html | 2 +- src/main/resources/templates/device_error.html | 2 +- src/main/resources/templates/form_post.html | 2 +- src/main/resources/templates/no_session_found.html | 4 ++-- src/main/resources/templates/no_session_found_nl.html | 4 ++-- src/main/resources/templates/verify.html | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/resources/templates/consent.html b/src/main/resources/templates/consent.html index 6fee6640..1ba1627c 100644 --- a/src/main/resources/templates/consent.html +++ b/src/main/resources/templates/consent.html @@ -138,5 +138,5 @@

- + diff --git a/src/main/resources/templates/device_continue.html b/src/main/resources/templates/device_continue.html index 04406d00..ebc51356 100644 --- a/src/main/resources/templates/device_continue.html +++ b/src/main/resources/templates/device_continue.html @@ -37,5 +37,5 @@

- + diff --git a/src/main/resources/templates/device_error.html b/src/main/resources/templates/device_error.html index 1750c42a..900b583c 100644 --- a/src/main/resources/templates/device_error.html +++ b/src/main/resources/templates/device_error.html @@ -37,5 +37,5 @@

- + diff --git a/src/main/resources/templates/form_post.html b/src/main/resources/templates/form_post.html index 56c703c7..cb8c1ff9 100644 --- a/src/main/resources/templates/form_post.html +++ b/src/main/resources/templates/form_post.html @@ -10,5 +10,5 @@ - + diff --git a/src/main/resources/templates/no_session_found.html b/src/main/resources/templates/no_session_found.html index 5960c732..0c1d1a8b 100644 --- a/src/main/resources/templates/no_session_found.html +++ b/src/main/resources/templates/no_session_found.html @@ -63,8 +63,8 @@

Error - No session found

- + - \ No newline at end of file + diff --git a/src/main/resources/templates/no_session_found_nl.html b/src/main/resources/templates/no_session_found_nl.html index 6c8bc4f5..c050b09c 100644 --- a/src/main/resources/templates/no_session_found_nl.html +++ b/src/main/resources/templates/no_session_found_nl.html @@ -65,8 +65,8 @@

Fout - Geen sessie gevonden

- + - \ No newline at end of file + diff --git a/src/main/resources/templates/verify.html b/src/main/resources/templates/verify.html index b8a45277..37b103b1 100644 --- a/src/main/resources/templates/verify.html +++ b/src/main/resources/templates/verify.html @@ -82,6 +82,6 @@

- - + +