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>
This commit is contained in:
Ilmari Lauhakangas
2019-05-02 19:14:02 +02:00
committed by Olivier Hallot
parent 3c13f19cca
commit 578f74466f

View File

@ -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"));