mirror of
https://github.com/xvvvyz/tilde.git
synced 2026-03-11 14:44:24 +00:00
Merge pull request #8 from cadejscroggins/query-param
allow searching via q query param
This commit is contained in:
commit
8a0263f090
1 changed files with 10 additions and 0 deletions
10
index.html
10
index.html
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue