aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2019-10-26 19:32:41 +0300
committersiikamiika <siikamiika@users.noreply.github.com>2019-10-26 19:32:41 +0300
commit01ffb052e6bfc04c2a0e260769ac9183b2bd60a0 (patch)
tree553db5351a7cdad2a4a721e140b72ed746df76f5 /ext/bg/js
parentbbbd23c842fae4a6f21afcf91fb797dd6f5709f7 (diff)
simplify search history state handling
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/search.js9
1 files changed, 2 insertions, 7 deletions
diff --git a/ext/bg/js/search.js b/ext/bg/js/search.js
index 11d1d871..bfd88552 100644
--- a/ext/bg/js/search.js
+++ b/ext/bg/js/search.js
@@ -74,7 +74,6 @@ class DisplaySearch extends Display {
query = window.wanakana.toKana(query);
}
this.query.value = query;
- window.history.replaceState({query}, '');
this.onSearchQueryUpdated(query, false);
}
}
@@ -130,16 +129,12 @@ class DisplaySearch extends Display {
const query = this.query.value;
const queryString = query.length > 0 ? `?query=${encodeURIComponent(query)}` : '';
- window.history.pushState({query}, '', `${window.location.pathname}${queryString}`);
+ window.history.pushState(null, '', `${window.location.pathname}${queryString}`);
this.onSearchQueryUpdated(query, true);
}
onPopState(e) {
- let query = '';
- if (e.state && e.state.query) {
- query = e.state.query
- }
-
+ const query = DisplaySearch.getSearchQueryFromLocation(window.location.href) || '';
if (this.query !== null) {
this.query.value = query;
}