From 87d1106414b9ea93adbed218ec89f1af19cc4094 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Thu, 21 Oct 2021 19:36:10 +0200 Subject: [PATCH] [mod] simple theme: autocompletion doesn't use the style attribute. close #352 --- .../themes/simple/src/js/main/search.js | 9 +++------ .../themes/simple/src/less/autocomplete.less | 19 ++++++++++++++++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/searx/static/themes/simple/src/js/main/search.js b/searx/static/themes/simple/src/js/main/search.js index 0244a90ea..1b58cdd0f 100644 --- a/searx/static/themes/simple/src/js/main/search.js +++ b/searx/static/themes/simple/src/js/main/search.js @@ -67,13 +67,10 @@ }, MinChars: 4, Delay: 300, + _Position:function() { + this.DOMResults.setAttribute("class", "autocomplete"); + }, }, "#" + qinput_id); - - // hack, see : https://github.com/autocompletejs/autocomplete.js/issues/37 - w.addEventListener('resize', function() { - var event = new CustomEvent("position"); - qinput.dispatchEvent(event); - }); } qinput.addEventListener('focus', placeCursorAtEndOnce, false); diff --git a/searx/static/themes/simple/src/less/autocomplete.less b/searx/static/themes/simple/src/less/autocomplete.less index 5f5745388..01d40f133 100644 --- a/searx/static/themes/simple/src/less/autocomplete.less +++ b/searx/static/themes/simple/src/less/autocomplete.less @@ -2,10 +2,13 @@ .autocomplete { position: absolute; + width: 44.7rem; + margin-top: 2.4rem; max-height: 0; overflow-y: hidden; text-align: left; - .rounded-corners; + border-bottom-left-radius: 10px; + border-bottom-right-radius: 10px; &:active, &:focus, @@ -24,7 +27,7 @@ > li { cursor: pointer; - padding: 8px 0 8px 8px; + padding: 8px 0 8px 0.75rem; &.active, &:active, @@ -50,9 +53,15 @@ background-color: var(--color-autocomplete-background); color: var(--color-autocomplete-font); border: 1px solid var(--color-autocomplete-border); + border-top: none; max-height: 500px; overflow-y: auto; - z-index: 100; + z-index: 100000000; + + li:first-child { + margin-top: 0.475rem; + border-top: 1px solid var(--color-autocomplete-border); + } &:empty { display: none; @@ -62,7 +71,11 @@ @media screen and (max-width: @phone) { .autocomplete { + position: absolute; + width: calc(100% - 0.5rem); + top: 2.9rem; bottom: 0; + margin-top: 0; } .autocomplete > ul > li {