From 85bb5b4a53bef18dcdf61a5776ce02aea0293fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Mon, 31 Jan 2022 18:42:18 -0500 Subject: [PATCH] quick search --- less/search.less | 7 +++++++ public/persona.js | 20 +++++++++++++++----- templates/partials/menu.tpl | 3 +++ 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/less/search.less b/less/search.less index fa5646f..2fdc340 100644 --- a/less/search.less +++ b/less/search.less @@ -78,6 +78,13 @@ } } +@media (max-width: @screen-xs-max) { + .quick-search-container { + left: 0px; + right: 0px; + } +} + .quick-search-results, .search-results { .post-info { font-size: 12px; diff --git a/public/persona.js b/public/persona.js index e35bdad..1fa438d 100644 --- a/public/persona.js +++ b/public/persona.js @@ -192,7 +192,7 @@ $(document).ready(function () { return; } - require(['pulling', 'storage', 'alerts'], function (Pulling, Storage, alerts) { + require(['pulling', 'storage', 'alerts', 'search'], function (Pulling, Storage, alerts, search) { if (!Pulling) { return; } @@ -354,12 +354,22 @@ $(document).ready(function () { searchButton.addClass('hidden'); searchInputEl.removeClass('hidden').focus(); - searchInputEl.off('blur').on('blur', function () { - searchInputEl.addClass('hidden'); - searchButton.removeClass('hidden'); - }); return false; }); + searchInputEl.on('blur', function () { + searchInputEl.addClass('hidden'); + searchButton.removeClass('hidden'); + }); + search.enableQuickSearch({ + searchElements: { + inputEl: searchInputEl, + resultEl: $('.navbar-header .navbar-search .quick-search-container'), + }, + searchOptions: { + in: config.searchDefaultInQuick, + }, + }); + // add a checkbox in the user settings page // so users can swap the sides the menus appear on diff --git a/templates/partials/menu.tpl b/templates/partials/menu.tpl index a6fec91..0c0135b 100644 --- a/templates/partials/menu.tpl +++ b/templates/partials/menu.tpl @@ -18,6 +18,9 @@ + {{{ end }}}