diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/docs-google-com-fix-forms/google_forms.js | 16 |
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) { |