From 7e0bcba919b0bb27f8131f3a9acc0cc2bd2e5764 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Wed, 17 Aug 2022 12:38:44 +0200 Subject: [Google Forms] Support forms with reCAPTCHA --- src/docs-google-com-fix-forms/google_forms.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/docs-google-com-fix-forms/google_forms.js') diff --git a/src/docs-google-com-fix-forms/google_forms.js b/src/docs-google-com-fix-forms/google_forms.js index 4652426..73d6840 100644 --- a/src/docs-google-com-fix-forms/google_forms.js +++ b/src/docs-google-com-fix-forms/google_forms.js @@ -82,7 +82,19 @@ document.querySelectorAll('[jsname=LwH6nd]').forEach(n => n.remove()); /* Enable the form sumbission button (if any). */ for (const submit_but of document.querySelectorAll('[jsname=M2UYVd]')) - submit_but.addEventListener("click", () => form.submit()); + submit_but.addEventListener("click", () => { + /* + * hacktcha_completed() will be defined by google-forms-hacktcha.js but only + * if we have the actual captcha support enabled. It will return true if + * we're already authenticated. + */ + if (typeof window.hacktcha_completed === "function") { + if (!window.hacktcha_completed()) + return; + } + + form.submit() + }); /* Enable the "next page" button (if any). */ function goToNext() @@ -109,6 +121,5 @@ for (const warning of * support dropdown inputs * support "other" radio buttons and "other" checkbox buttons, in which the user types text in addition to selecting the "other" box - * support reCAPTCHA integration * support displaying public analytics ("viewanalytics" instead of "viewform") */ -- cgit v1.2.3