fix(search): after dialog closes, results reappear on refresh (#1161)

This commit is contained in:
momchil-anachkov authored and George committed 2019-06-26 16:46:47 +01:00
1 parent 4cfd000001
commit 9a18bf2211
1 file changed
+8
+8
View File
@@ -49,6 +49,13 @@
}
}
function removeQueryParamsFromUrl() {
if (window.history.pushState) {
let urlWithoutSearchParams = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.hash;
window.history.pushState({path:urlWithoutSearchParams}, '', urlWithoutSearchParams);
}
}
// Check for hash change event and fix responsive offset for hash links (e.g. Markdown footnotes).
window.addEventListener("hashchange", scrollToAnchor);
@@ -295,6 +302,7 @@
if ($('body').hasClass('searching')) {
$('[id=search-query]').blur();
$('body').removeClass('searching');
removeQueryParamsFromUrl();
} else {
$('body').addClass('searching');
$('.search-results').css({opacity: 0, visibility: 'visible'}).animate({opacity: 1}, 200);