diff options
author | tdro <tdro@noreply.example.com> | 2024-02-02 20:10:06 -0500 |
---|---|---|
committer | tdro <tdro@noreply.example.com> | 2024-02-02 20:10:06 -0500 |
commit | 78855c919aa825c5fff2c99cd137cb2eee6878a4 (patch) | |
tree | e100b55ec6527fa09d40cad5ef6e91be5666983e /assets | |
parent | 9508719b77269d1a9a67aab4b9c9070b2b3d6ebd (diff) | |
download | canory-78855c919aa825c5fff2c99cd137cb2eee6878a4.tar.gz canory-78855c919aa825c5fff2c99cd137cb2eee6878a4.tar.bz2 canory-78855c919aa825c5fff2c99cd137cb2eee6878a4.zip |
static/js/forms: Scope to inside forms
Persist pageshow
Diffstat (limited to 'assets')
-rw-r--r-- | assets/js/index.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/assets/js/index.js b/assets/js/index.js index 78539a2..9f17871 100644 --- a/assets/js/index.js +++ b/assets/js/index.js @@ -691,13 +691,14 @@ return console.warn("WARNING: Cannot persist form state due to cookie restrictions"); } [ + "pageshow", "URLChangedCustomEvent", "DOMContentLoaded" ].forEach(function(event) { self.addEventListener(event, function(event) { - const input = Array.prototype.slice.call(document.querySelectorAll("input")); - const select = Array.prototype.slice.call(document.querySelectorAll("select")); - const textarea = Array.prototype.slice.call(document.querySelectorAll("textarea")); + const input = Array.prototype.slice.call(document.querySelectorAll("form input")); + const select = Array.prototype.slice.call(document.querySelectorAll("form select")); + const textarea = Array.prototype.slice.call(document.querySelectorAll("form textarea")); const states = input.concat(select).concat(textarea); for(let i1 = 0; i1 < states.length; i1++){ if (localStorage[states[i1].id]) { |