diff --git a/resources/assets/js/searchbar.js b/resources/assets/js/searchbar.js index 16e3a4dd26abe58fa2d8856193fe5bcac9657910..e17074fdce50634dc3a8ba213ccbc06594535bce 100644 --- a/resources/assets/js/searchbar.js +++ b/resources/assets/js/searchbar.js @@ -1,17 +1,33 @@ $(function () { loadLocalStorage(); + setActionListenersSearchbar(); }); +function setActionListenersSearchbar() { + $('#input-key').keydown(saveKey); +} + +function saveKey() { + var key = $('#input-key').val(); + localStorage.setItem('key', key); +} + +function loadKey() { + var key = localStorage.getItem('key'); + $('#input-key').val(key); +} + /** * Loads the user theme and stored settings from local storage */ -function loadLocalStorage () { +function loadLocalStorage() { if (localStorage) { setSettings(); + loadKey(); } } -function setSettings () { +function setSettings() { var acceptedParams = ['autocomplete', 'key', 'lang', 'newtab', 'sprueche']; for (var key in localStorage) { var value = localStorage.getItem(key); diff --git a/resources/views/parts/searchbar.blade.php b/resources/views/parts/searchbar.blade.php index df96fdff984b2f50a66265784105a96239be6f9f..55fbf7c68f9a2c078df249d8ac38033eb6f1d581 100644 --- a/resources/views/parts/searchbar.blade.php +++ b/resources/views/parts/searchbar.blade.php @@ -16,13 +16,13 @@ </label> </div> <div id="search-key"> - <input id="input-key" type="text" name="key" placeholder="{{ trans ('index.key.placeholder') }}"> + <input id="input-key" type="text" name="key" placeholder="{{ trans ('index.key.placeholder') }}" tabindex="1"> <label id="key-label" for="input-key" data-tooltip="{{ trans ('index.key.tooltip') }}"> <i class="fa fa-key" aria-hidden="true"></i> </label> </div> <div class="search-input"> - <input type="text" name="eingabe" value="@if(isset($eingabe)){{$eingabe}}@endif" required="" autocomplete="{{$autocomplete or 'off'}}" class="form-control" placeholder="{{ trans('index.placeholder') }}" tabindex="1"> + <input type="text" name="eingabe" value="@if(isset($eingabe)){{$eingabe}}@endif" required="" autocomplete="{{$autocomplete or 'off'}}" class="form-control" placeholder="{{ trans('index.placeholder') }}" tabindex="2"> <button class="hidden" id="search-delete-btn" type="button"> × </button>