summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>2019-05-02 19:14:02 +0200
committerOlivier Hallot <olivier.hallot@libreoffice.org>2019-05-02 20:17:50 +0200
commit578f74466fcbf2dca537859e73064bfb4583928a (patch)
treed009b9c8c12ae10620046be390c1984786e0eaf5
parent3c13f19ccac3c882a1971e5cf78e6bfb8ffcaa7d (diff)
tdf#122366 Store search filter value in sessionStorage
sessionStorage seems to be reset, when we change the module context. If this is not acceptable, we can try localStorage. Change-Id: I5ec2ff526e48dd2c7d1889578e991833e43f76c6 Reviewed-on: https://gerrit.libreoffice.org/71688 Tested-by: Jenkins Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
-rw-r--r--help3xsl/help.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/help3xsl/help.js b/help3xsl/help.js
index 2767b157f8..1e92f6ef99 100644
--- a/help3xsl/help.js
+++ b/help3xsl/help.js
@@ -81,6 +81,17 @@ function debounce(fn, wait) {
}
search.addEventListener('keyup', debounce(filter, 100));
+// Preserve search input value during the session
+search.value = sessionStorage.getItem('searchsave');
+
+if (search.value !== undefined) {
+ filter();
+}
+
+window.addEventListener('unload', function(event) {
+ sessionStorage.setItem('searchsave', search.value);
+});
+
// copy pycode and bascode to clipboard on mouse click
// Show border when copy is done
divcopyable(document.getElementsByClassName("bascode"));