diff --git a/index.html b/index.html index c677181..042bf41 100644 --- a/index.html +++ b/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 }; @@ -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);