2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-17 19:21:23 +03:00

Update search.js

This commit is contained in:
XhmikosR
2020-02-17 18:33:57 +02:00
parent 0bba1b54b5
commit 331807b32b
+5 -2
View File
@@ -52,13 +52,16 @@
}) })
function hashSearch() { function hashSearch() {
if (window.location.hash && window.location.hash.indexOf('#search=') === 0) { var SEARCH_WORD = '#search='
search.input.autocomplete.setVal(window.location.hash.slice(8))
if (window.location.hash && window.location.hash.startsWith(SEARCH_WORD)) {
search.input.autocomplete.setVal(window.location.hash.slice(SEARCH_WORD.length))
search.input.autocomplete.open() search.input.autocomplete.open()
} }
} }
hashSearch() hashSearch()
// For the nerds: search by changing the url hash // For the nerds: search by changing the url hash
window.addEventListener('hashchange', hashSearch, false) window.addEventListener('hashchange', hashSearch, false)
})() })()