aboutsummaryrefslogtreecommitdiff
path: root/src/docs-google-com-fix-forms
diff options
context:
space:
mode:
authorJacob K <jacobk@disroot.org>2022-08-14 20:05:56 -0500
committerJacob K <jacobk@disroot.org>2022-08-15 00:05:55 -0500
commit283be80b6d893b5fb6fa47ffe8694792e050faf5 (patch)
treef32f3047f212d9f3feb5b13504619f10de1a6783 /src/docs-google-com-fix-forms
parent618dbc2a6d5eaadf51a3b13d518ce6275526f9d1 (diff)
downloadhydrilla-fixes-bundle-283be80b6d893b5fb6fa47ffe8694792e050faf5.tar.gz
hydrilla-fixes-bundle-283be80b6d893b5fb6fa47ffe8694792e050faf5.zip
[Google Forms] Add (untested) support for email address fields.
Diffstat (limited to 'src/docs-google-com-fix-forms')
-rw-r--r--src/docs-google-com-fix-forms/google_forms.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/docs-google-com-fix-forms/google_forms.js b/src/docs-google-com-fix-forms/google_forms.js
index e9b7dfd..dcb2d54 100644
--- a/src/docs-google-com-fix-forms/google_forms.js
+++ b/src/docs-google-com-fix-forms/google_forms.js
@@ -27,9 +27,19 @@
var form = document.forms[0];
/* Fix form fields. */
-for (let div of form.querySelectorAll('div[data-params]')) {
- var data = JSON.parse('[' + div.dataset.params.substring(4));
- var name = 'entry.' + data[0][4][0][0];
+for (let div of form.querySelectorAll('div[data-params], div.geS5n.AgroKb.oQYVNd')) {
+ /* The selector, "div.geS5n.AgroKb.oQYVNd" is to catch email fields, which
+ don't have a data-params attribute. Those same classes appear on 3 email
+ fields in different forms that I found. */
+ if (div.dataset.params) {
+ var data = JSON.parse('[' + div.dataset.params.substring(4));
+ var name = 'entry.' + data[0][4][0][0];
+ } else if (div.className == "geS5n AgroKb oQYVNd") {
+ var name = "emailAddress";
+ } else {
+ console.error(`Cannot enable input`, div);
+ continue;
+ }
var input = div.querySelector('input, textarea');
if (!input) {