Merge pull request #8 from cadejscroggins/query-param

allow searching via q query param
This commit is contained in:
Cade Scroggins 2017-07-23 16:09:39 -07:00 committed by GitHub
commit 8a0263f090

View file

@ -77,6 +77,10 @@
// the delimiter between the hours and minutes in the clock
clockDelimiter: ' ',
// note: you can pass in your search query via the q query param
// e.g. going to file:///path/to/tilde/index.html?q=hamsters is equivalent
// to typing "hamsters" and pressing enter
};
</script>
@ -874,6 +878,7 @@
this._inputElVal = '';
this._bindMethods();
this._registerEvents();
this._loadQueryParam();
}
_bindMethods() {
@ -945,6 +950,11 @@
}
}
_loadQueryParam() {
const q = new URLSearchParams(window.location.search).get('q');
if (q) this._submitWithValue(q);
}
_previewValue(value) {
this._inputEl.value = value;
this._setBackgroundFromQuery(value);