1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 20:17:45 +01:00

Merge pull request #963 from MontyQI/mobile-bar

Mobile bar google-like
This commit is contained in:
Markus Heiser 2022-03-25 07:59:18 +01:00 committed by GitHub
commit cfd08055ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 94 additions and 82 deletions

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* (C) Copyright Contributors to the searx project (2014 - 2021). * (C) Copyright Contributors to the searx project (2014 - 2021).
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
window.searxng=function(t){"use strict";t.getElementsByTagName("html")[0].className="js";t=t.currentScript||(t=t.getElementsByTagName("script"))[t.length-1];return{autocompleter:"true"===t.getAttribute("data-autocompleter"),infinite_scroll:"true"===t.getAttribute("data-infinite-scroll"),method:t.getAttribute("data-method"),translations:JSON.parse(t.getAttribute("data-translations"))}}(document), window.searxng=function(t){"use strict";t.getElementsByTagName("html")[0].className="js";var e,e=t.currentScript||(e=t.getElementsByTagName("script"))[e.length-1];return{autocompleter:"true"===e.getAttribute("data-autocompleter"),infinite_scroll:"true"===e.getAttribute("data-infinite-scroll"),method:e.getAttribute("data-method"),translations:JSON.parse(e.getAttribute("data-translations"))}}(document),
/** /**
* @license * @license
* (C) Copyright Contributors to the SearXNG project. * (C) Copyright Contributors to the SearXNG project.
@ -20,7 +20,7 @@ $(document).ready(function(){var t,n="";searxng.autocompleter&&((t=new Bloodhoun
* (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at> * (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
$(document).ready(function(){$("#q.autofocus").focus(),$("#clear_search").click(function(){document.getElementById("q").value=""}),$(".select-all-on-click").click(function(){$(this).select()}),$(".btn-collapse").click(function(){var t=$(this).data("btn-text-collapsed"),e=$(this).data("btn-text-not-collapsed");""!==t&&""!==e&&(new_html=$(this).hasClass("collapsed")?$(this).html().replace(t,e):$(this).html().replace(e,t),$(this).html(new_html))}),$(".btn-toggle .btn").click(function(){var t="btn-"+$(this).data("btn-class"),e=$(this).data("btn-label-default"),n=$(this).data("btn-label-toggled");""!==n&&(new_html=$(this).hasClass("btn-default")?$(this).html().replace(e,n):$(this).html().replace(n,e),$(this).html(new_html)),$(this).toggleClass(t),$(this).toggleClass("btn-default")}),$(".media-loader").click(function(){var t=$(this).data("target"),t=$(t+" > iframe"),e=t.attr("src");void 0!==e&&!1!==e||t.attr("src",t.data("src"))}),$(".btn-sm").dblclick(function(){var t="btn-"+$(this).data("btn-class");$(this).hasClass("btn-default")?($(".btn-sm > input").attr("checked","checked"),$(".btn-sm > input").prop("checked",!0),$(".btn-sm").addClass(t),$(".btn-sm").addClass("active"),$(".btn-sm").removeClass("btn-default")):($(".btn-sm > input").attr("checked",""),$(".btn-sm > input").removeAttr("checked"),$(".btn-sm > input").checked=!1,$(".btn-sm").removeClass(t),$(".btn-sm").removeClass("active"),$(".btn-sm").addClass("btn-default"))}),$(".nav-tabs").click(function(t){$(t.target).parents("ul").children().attr("aria-selected","false"),$(t.target).parent().attr("aria-selected","true")}),searxng.image_thumbnail_layout=new searxng.ImageLayout("#main_results","#main_results .result-images","img.img-thumbnail",15,3,200),searxng.image_thumbnail_layout.watch()}), $(document).ready(function(){$("#q.autofocus").focus(),$("#clear_search").click(function(){document.getElementById("q").value=""}),$(".select-all-on-click").click(function(){$(this).select()}),$(".btn-collapse").click(function(){var t=$(this).data("btn-text-collapsed"),e=$(this).data("btn-text-not-collapsed");""!==t&&""!==e&&(new_html=$(this).hasClass("collapsed")?$(this).html().replace(t,e):$(this).html().replace(e,t),$(this).html(new_html))}),$(".btn-toggle .btn").click(function(){var t="btn-"+$(this).data("btn-class"),e=$(this).data("btn-label-default"),n=$(this).data("btn-label-toggled");""!==n&&(new_html=$(this).hasClass("btn-default")?$(this).html().replace(e,n):$(this).html().replace(n,e),$(this).html(new_html)),$(this).toggleClass(t),$(this).toggleClass("btn-default")}),$(".media-loader").click(function(){var t=$(this).data("target"),e=$(t+" > iframe"),t=e.attr("src");void 0!==t&&!1!==t||e.attr("src",e.data("src"))}),$(".btn-sm").dblclick(function(){var t="btn-"+$(this).data("btn-class");$(this).hasClass("btn-default")?($(".btn-sm > input").attr("checked","checked"),$(".btn-sm > input").prop("checked",!0),$(".btn-sm").addClass(t),$(".btn-sm").addClass("active"),$(".btn-sm").removeClass("btn-default")):($(".btn-sm > input").attr("checked",""),$(".btn-sm > input").removeAttr("checked"),$(".btn-sm > input").checked=!1,$(".btn-sm").removeClass(t),$(".btn-sm").removeClass("active"),$(".btn-sm").addClass("btn-default"))}),$(".nav-tabs").click(function(t){$(t.target).parents("ul").children().attr("aria-selected","false"),$(t.target).parent().attr("aria-selected","true")}),searxng.image_thumbnail_layout=new searxng.ImageLayout("#main_results","#main_results .result-images","img.img-thumbnail",15,3,200),searxng.image_thumbnail_layout.watch()}),
/** /**
* *
* Google Image Layout v0.0.1 * Google Image Layout v0.0.1
@ -42,7 +42,7 @@ $(document).ready(function(){$("#q.autofocus").focus(),$("#clear_search").click(
* ); * );
* searxng.image_thumbnail_layout.watch(); * searxng.image_thumbnail_layout.watch();
*/ */
function(s,c){function t(t,e,n,a,i,o){this.container_selector=t,this.results_selector=e,this.img_selector=n,this.verticalMargin=a,this.horizontalMargin=i,this.maxHeight=o,this.trottleCallToAlign=null,this.alignAfterThrotteling=!1}t.prototype._getHeigth=function(t,e){for(var n,a=0,i=0;i<t.length;i++)0<(n=t[i]).naturalWidth&&0<n.naturalHeight?a+=n.naturalWidth/n.naturalHeight:a+=1;return(e-t.length*this.verticalMargin)/a},t.prototype._setSize=function(t,e){for(var n,a,i=t.length,o=0;o<i;o++)a=0<(n=t[o]).naturalWidth&&0<n.naturalHeight?e*n.naturalWidth/n.naturalHeight:e,n.setAttribute("width",Math.round(a)),n.setAttribute("height",Math.round(e)),n.style.marginLeft=Math.round(this.horizontalMargin)+"px",n.style.marginTop=Math.round(this.horizontalMargin)+"px",n.style.marginRight=Math.round(this.verticalMargin-7)+"px",n.style.marginBottom=Math.round(this.verticalMargin-7)+"px",(a=n.parentNode.parentNode).classList.contains("js")||a.classList.add("js")},t.prototype._alignImgs=function(t){for(var e,n,a,i,o=c.querySelector(this.container_selector),s=window.getComputedStyle(o),r=parseInt(s.getPropertyValue("padding-left"),10),s=parseInt(s.getPropertyValue("padding-right"),10),l=o.clientWidth-r-s;0<t.length;){for(e=!0,a=1;a<=t.length&&e;a++)n=t.slice(0,a),(i=this._getHeigth(n,l))<this.maxHeight&&(this._setSize(n,i),t=t.slice(a),e=!1);if(e){this._setSize(n,Math.min(this.maxHeight,i));break}}},t.prototype.throttleAlign=function(){var t=this;t.trottleCallToAlign?t.alignAfterThrotteling=!0:(t.alignAfterThrotteling=!1,t.align(),t.trottleCallToAlign=setTimeout(function(){t.alignAfterThrotteling&&t.align(),t.alignAfterThrotteling=!1,t.trottleCallToAlign=null},20))},t.prototype.align=function(){for(var t=c.querySelectorAll(this.results_selector),e=t.length,n=null,a=null,i=[],o=0;o<e;o++)(a=t[o]).previousElementSibling!==n&&0<i.length&&(this._alignImgs(i),i=[]),i.push(a.querySelector(this.img_selector)),n=a;0<i.length&&this._alignImgs(i)},t.prototype._monitorImages=function(){var t,e,n=this.throttleAlign.bind(this),a=c.querySelectorAll(this.results_selector),i=a.length;function o(t){t.originalTarget.src=s.searxng.static_path+s.searxng.theme.img_load_error}for(t=0;t<i;t++)null==(e=a[t].querySelector(this.img_selector))||e.classList.contains("aligned")||(e.addEventListener("load",n),e.addEventListener("error",n),e.addEventListener("timeout",n),s.searxng.theme.img_load_error&&e.addEventListener("error",o,{once:!0}),e.classList.add("aligned"))},t.prototype.watch=function(){var t=this.throttleAlign.bind(this),a=(s.addEventListener("pageshow",t),s.addEventListener("load",t),s.addEventListener("resize",t),this._monitorImages(),this);let e=new MutationObserver(e=>{let n=!1;for(let t=0;t<e.length;t++)if(0<e[t].addedNodes.length&&e[t].addedNodes[0].classList.contains("result")){n=!0;break}n&&a._monitorImages()});e.observe(c.querySelector(this.container_selector),{childList:!0,subtree:!0,attributes:!1,characterData:!1})},s.searxng.ImageLayout=t}(window,document), function(s,c){function t(t,e,n,a,i,o){this.container_selector=t,this.results_selector=e,this.img_selector=n,this.verticalMargin=a,this.horizontalMargin=i,this.maxHeight=o,this.trottleCallToAlign=null,this.alignAfterThrotteling=!1}t.prototype._getHeigth=function(t,e){for(var n,a=0,i=0;i<t.length;i++)0<(n=t[i]).naturalWidth&&0<n.naturalHeight?a+=n.naturalWidth/n.naturalHeight:a+=1;return(e-t.length*this.verticalMargin)/a},t.prototype._setSize=function(t,e){for(var n,a,i=t.length,o=0;o<i;o++)n=0<(a=t[o]).naturalWidth&&0<a.naturalHeight?e*a.naturalWidth/a.naturalHeight:e,a.setAttribute("width",Math.round(n)),a.setAttribute("height",Math.round(e)),a.style.marginLeft=Math.round(this.horizontalMargin)+"px",a.style.marginTop=Math.round(this.horizontalMargin)+"px",a.style.marginRight=Math.round(this.verticalMargin-7)+"px",a.style.marginBottom=Math.round(this.verticalMargin-7)+"px",(a=a.parentNode.parentNode).classList.contains("js")||a.classList.add("js")},t.prototype._alignImgs=function(t){for(var e,n,a,i,o=c.querySelector(this.container_selector),s=window.getComputedStyle(o),r=parseInt(s.getPropertyValue("padding-left"),10),s=parseInt(s.getPropertyValue("padding-right"),10),l=o.clientWidth-r-s;0<t.length;){for(e=!0,a=1;a<=t.length&&e;a++)n=t.slice(0,a),(i=this._getHeigth(n,l))<this.maxHeight&&(this._setSize(n,i),t=t.slice(a),e=!1);if(e){this._setSize(n,Math.min(this.maxHeight,i));break}}},t.prototype.throttleAlign=function(){var t=this;t.trottleCallToAlign?t.alignAfterThrotteling=!0:(t.alignAfterThrotteling=!1,t.align(),t.trottleCallToAlign=setTimeout(function(){t.alignAfterThrotteling&&t.align(),t.alignAfterThrotteling=!1,t.trottleCallToAlign=null},20))},t.prototype.align=function(){for(var t=c.querySelectorAll(this.results_selector),e=t.length,n=null,a=null,i=[],o=0;o<e;o++)(a=t[o]).previousElementSibling!==n&&0<i.length&&(this._alignImgs(i),i=[]),i.push(a.querySelector(this.img_selector)),n=a;0<i.length&&this._alignImgs(i)},t.prototype._monitorImages=function(){var t,e,n=this.throttleAlign.bind(this),a=c.querySelectorAll(this.results_selector),i=a.length;function o(t){t.originalTarget.src=s.searxng.static_path+s.searxng.theme.img_load_error}for(t=0;t<i;t++)null==(e=a[t].querySelector(this.img_selector))||e.classList.contains("aligned")||(e.addEventListener("load",n),e.addEventListener("error",n),e.addEventListener("timeout",n),s.searxng.theme.img_load_error&&e.addEventListener("error",o,{once:!0}),e.classList.add("aligned"))},t.prototype.watch=function(){var t=this.throttleAlign.bind(this);s.addEventListener("pageshow",t),s.addEventListener("load",t),s.addEventListener("resize",t),this._monitorImages();var a=this;let e=new MutationObserver(e=>{let n=!1;for(let t=0;t<e.length;t++)if(0<e[t].addedNodes.length&&e[t].addedNodes[0].classList.contains("result")){n=!0;break}n&&a._monitorImages()});e.observe(c.querySelector(this.container_selector),{childList:!0,subtree:!0,attributes:!1,characterData:!1})},s.searxng.ImageLayout=t}(window,document),
/** /**
* @license * @license
* (C) Copyright Contributors to the SearXNG project. * (C) Copyright Contributors to the SearXNG project.
@ -64,7 +64,7 @@ window.addEventListener("load",function(){$(".infobox").each(function(){var t=$(
* (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at> * (C) 2014 by Thomas Pointhuber, <thomas.pointhuber@gmx.at>
* SPDX-License-Identifier: AGPL-3.0-or-later * SPDX-License-Identifier: AGPL-3.0-or-later
*/ */
$(document).ready(function(){$(".searxng_init_map").on("click",function(t){var e=$(this).data("leaflet-target"),n=$(this).data("map-lon"),a=$(this).data("map-lat"),i=$(this).data("map-zoom"),o=$(this).data("map-boundingbox"),s=$(this).data("map-geojson"),r=(o&&(southWest=L.latLng(o[0],o[2]),northEast=L.latLng(o[1],o[3]),map_bounds=L.latLngBounds(southWest,northEast)),L.Icon.Default.imagePath="./static/themes/oscar/css/images/",L.map(e)),o=new L.TileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{minZoom:1,maxZoom:19,attribution:'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors'}),e=(new L.TileLayer("https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png",{minZoom:1,maxZoom:19,attribution:'Wikimedia maps beta | Maps data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors'}),setTimeout(function(){map_bounds?r.fitBounds(map_bounds,{maxZoom:17}):n&&a&&(i?r.setView(new L.LatLng(a,n),i):r.setView(new L.LatLng(a,n),8))},0),r.addLayer(o),{"OSM Mapnik":o});L.control.layers(e).addTo(r),s&&L.geoJson(s).addTo(r),$(this).off(t)})}), $(document).ready(function(){$(".searxng_init_map").on("click",function(t){var e=$(this).data("leaflet-target"),n=$(this).data("map-lon"),a=$(this).data("map-lat"),i=$(this).data("map-zoom"),o=$(this).data("map-boundingbox"),s=$(this).data("map-geojson");o&&(southWest=L.latLng(o[0],o[2]),northEast=L.latLng(o[1],o[3]),map_bounds=L.latLngBounds(southWest,northEast)),L.Icon.Default.imagePath="./static/themes/oscar/css/images/";var r=L.map(e),e=new L.TileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{minZoom:1,maxZoom:19,attribution:'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors'});new L.TileLayer("https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png",{minZoom:1,maxZoom:19,attribution:'Wikimedia maps beta | Maps data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors'});setTimeout(function(){map_bounds?r.fitBounds(map_bounds,{maxZoom:17}):n&&a&&(i?r.setView(new L.LatLng(a,n),i):r.setView(new L.LatLng(a,n),8))},0),r.addLayer(e),L.control.layers({"OSM Mapnik":e}).addTo(r),s&&L.geoJson(s).addTo(r),$(this).off(t)})}),
/** /**
* @license * @license
* (C) Copyright Contributors to the SearXNG project. * (C) Copyright Contributors to the SearXNG project.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,8 @@
var firstFocus = true, qinput_id = "q", qinput; var firstFocus = true, qinput_id = "q", qinput;
const isMobile = window.matchMedia("only screen and (max-width: 50em)").matches;
function placeCursorAtEnd (element) { function placeCursorAtEnd (element) {
if (element.setSelectionRange) { if (element.setSelectionRange) {
var len = element.value.length; var len = element.value.length;
@ -68,12 +70,7 @@
}, },
MinChars: 4, MinChars: 4,
Delay: 300, Delay: 300,
_Position: function () { _Position: function () {},
this.DOMResults.setAttribute("class", "autocomplete");
this.DOMResults.style.top = (this.Input.offsetTop + this.Input.offsetHeight) + "px";
this.DOMResults.style.left = this.Input.offsetLeft + "px";
this.DOMResults.style.width = this.Input.clientWidth + "px";
},
_Open: function () { _Open: function () {
var params = this; var params = this;
Array.prototype.forEach.call(this.DOMResults.getElementsByTagName("li"), function (li) { Array.prototype.forEach.call(this.DOMResults.getElementsByTagName("li"), function (li) {
@ -85,17 +82,14 @@
}); });
}, },
}, "#" + qinput_id); }, "#" + 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); qinput.addEventListener('focus', placeCursorAtEndOnce, false);
if (!isMobile) {
qinput.focus(); qinput.focus();
} }
}
// vanilla js version of search_on_category_select.js // vanilla js version of search_on_category_select.js
if (qinput !== null && d.querySelector('.help') != null && searxng.search_on_category_select) { if (qinput !== null && d.querySelector('.help') != null && searxng.search_on_category_select) {

View File

@ -2,6 +2,7 @@
.autocomplete { .autocomplete {
position: absolute; position: absolute;
width: @search-width;
max-height: 0; max-height: 0;
overflow-y: hidden; overflow-y: hidden;
.ltr-text-align-left(); .ltr-text-align-left();
@ -25,7 +26,7 @@
> li { > li {
cursor: pointer; cursor: pointer;
padding: 0.5rem; padding: 0.5rem 1rem;
&.active, &.active,
&:active, &:active,
@ -51,9 +52,10 @@
background-color: var(--color-autocomplete-background); background-color: var(--color-autocomplete-background);
color: var(--color-autocomplete-font); color: var(--color-autocomplete-font);
border: 1px solid var(--color-autocomplete-border); border: 1px solid var(--color-autocomplete-border);
max-height: 500px; max-height: 32rem;
overflow-y: auto; overflow-y: auto;
z-index: 100; z-index: 100;
margin-top: 3.2rem;
&:empty { &:empty {
display: none; display: none;
@ -63,11 +65,10 @@
@media screen and (max-width: @phone) { @media screen and (max-width: @phone) {
.autocomplete { .autocomplete {
bottom: 0; width: 100%;
}
.autocomplete > ul > li { > ul > li {
border-bottom: 1px solid var(--color-result-top-border); padding: 1rem;
text-align: left; }
} }
} }

View File

@ -242,7 +242,7 @@
@result-padding: 1rem; @result-padding: 1rem;
@results-image-row-height: 12rem; @results-image-row-height: 12rem;
@results-image-row-height-phone: 6rem; @results-image-row-height-phone: 6rem;
@search-width: 40rem; @search-width: 44rem;
// heigh of #search, see detail.less // heigh of #search, see detail.less
@search-height: 7.6rem; @search-height: 7.6rem;

View File

@ -49,9 +49,3 @@
margin-top: 6em; margin-top: 6em;
} }
} }
@media screen and (max-width: @phone) {
#main_index {
margin-top: 0;
}
}

View File

@ -89,10 +89,14 @@
} }
} }
.search_box { #search_view {
margin: 0;
padding: 0;
grid-area: search; grid-area: search;
}
.search_box {
border: 1px solid var(--color-search-border);
border-radius: 0.8rem;
width: @search-width;
display: inline-flex; display: inline-flex;
flex-direction: row; flex-direction: row;
white-space: nowrap; white-space: nowrap;
@ -102,18 +106,14 @@
display: block; display: block;
border-collapse: separate; border-collapse: separate;
box-sizing: border-box; box-sizing: border-box;
width: 1.8em; width: 1.8rem;
margin: 0; margin: 0;
padding: 8px 2px; padding: 0.8rem 0.2rem;
background: none repeat scroll 0 0 var(--color-search-background); background: none repeat scroll 0 0 var(--color-search-background);
border-top: 1px solid var(--color-search-border); border: none;
border-bottom: 1px solid var(--color-search-border);
border-right: none;
border-left: none;
border-radius: 0;
outline: none; outline: none;
color: var(--color-search-font); color: var(--color-search-font);
font-size: 16px; font-size: 1.1rem;
z-index: 10000; z-index: 10000;
&:hover { &:hover {
@ -131,27 +131,22 @@ html.no-js #clear_search.hide_if_nojs {
#q, #q,
#send_search { #send_search {
display: block !important; display: block;
border-collapse: separate;
box-sizing: border-box;
margin: 0; margin: 0;
padding: 10px; padding: 0.8rem;
background: none repeat scroll 0 0 var(--color-search-background); background: none repeat scroll 0 0 var(--color-search-background);
border: 1px solid var(--color-search-border); border: none;
border-radius: 0;
outline: none; outline: none;
color: var(--color-search-font); color: var(--color-search-font);
font-size: 16px; font-size: 1.1rem;
z-index: 2; z-index: 2;
} }
#q { #q {
outline: medium none; width: 100%;
.ltr-padding-left(12px); .ltr-padding-left(1rem);
.ltr-padding-right(0) !important; .ltr-padding-right(0) !important;
.ltr-border-right(none); .ltr-rounded-left-corners(0.8rem);
width: @search-width;
.ltr-rounded-left-corners(10px);
} }
#q::-ms-clear, #q::-ms-clear,
@ -160,8 +155,7 @@ html.no-js #clear_search.hide_if_nojs {
} }
#send_search { #send_search {
.ltr-border-left(none); .ltr-rounded-right-corners(0.8rem);
.ltr-rounded-right-corners(10px);
&:hover { &:hover {
cursor: pointer; cursor: pointer;
@ -174,7 +168,6 @@ html.no-js #clear_search.hide_if_nojs {
.no-js #send_search { .no-js #send_search {
width: auto !important; width: auto !important;
.ltr-border-left(1px solid var(--color-search-border)); .ltr-border-left(1px solid var(--color-search-border));
padding: 10px;
} }
.search_filters { .search_filters {
@ -259,10 +252,9 @@ html.no-js #clear_search.hide_if_nojs {
} }
.search_box { .search_box {
// hack, should be 100% ? width: 98%;
width: 99%;
display: flex; display: flex;
flex-direction: row; margin: 0 auto;
} }
#q { #q {
@ -270,11 +262,6 @@ html.no-js #clear_search.hide_if_nojs {
flex: 1; flex: 1;
} }
#main_results #q:placeholder-shown ~ #send_search {
margin-right: 2.6rem;
transition: margin-right 0.1s; // FIX RTL
}
.search_filters { .search_filters {
margin: 0; margin: 0;
} }
@ -285,7 +272,7 @@ html.no-js #clear_search.hide_if_nojs {
margin: 0; margin: 0;
label { label {
padding: 0.8rem !important; padding: 1rem !important;
margin: 0 !important; margin: 0 !important;
svg { svg {
@ -293,6 +280,38 @@ html.no-js #clear_search.hide_if_nojs {
} }
} }
} }
#search_view:focus-within {
display: block;
background-color: var(--color-base-background);
position: absolute;
top: 0;
height: 100%;
width: 100%;
z-index: 10000;
.search_box {
border-top: none;
border-left: none;
border-right: none;
width: 100%;
border-radius: 0;
#send_search {
.ltr-margin-right(0) !important; // Delete when send_search button is disabled on mobile.
}
* {
border: none;
border-radius: 0;
}
}
}
#main_results #q:placeholder-shown ~ #send_search {
.ltr-margin-right(2.6rem);
transition: margin 0.1s;
}
} }
@media screen and (max-width: @ultra-small-phone) { @media screen and (max-width: @ultra-small-phone) {

View File

@ -4,11 +4,13 @@
<span hidden>SearXNG</span> <span hidden>SearXNG</span>
{% include '__common__/searxng-wordmark.min.svg' without context %} {% include '__common__/searxng-wordmark.min.svg' without context %}
</a> </a>
<div id="search_view">
<div class="search_box"> <div class="search_box">
<input id="q" autofocus name="q" type="text" placeholder="{{ _('Search for...') }}" autocomplete="off" spellcheck="false" dir="auto" value="{{ q or '' }}"> <input id="q" name="q" type="text" placeholder="{{ _('Search for...') }}" autocomplete="off" autocapitalize="none" spellcheck="false" autocorrect="off" dir="auto" value="{{ q or '' }}">
<button id="clear_search" type="reset" aria-label="{{ _('clear') }}" class="hide_if_nojs"><span>{{ icon_big('close') }}</span><span class="show_if_nojs">{{ _('clear') }}</span></button> <button id="clear_search" type="reset" aria-label="{{ _('clear') }}" class="hide_if_nojs"><span>{{ icon_big('close') }}</span><span class="show_if_nojs">{{ _('clear') }}</span></button>
<button id="send_search" type="submit" aria-label="{{ _('search') }}"><span class="hide_if_nojs">{{ icon_big('search-outline') }}</span><span class="show_if_nojs">{{ _('search') }}</span></button> <button id="send_search" type="submit" aria-label="{{ _('search') }}"><span class="hide_if_nojs">{{ icon_big('search-outline') }}</span><span class="show_if_nojs">{{ _('search') }}</span></button>
</div> </div>
</div>
{% set display_tooltip = true %} {% set display_tooltip = true %}
{% include 'simple/categories.html' %} {% include 'simple/categories.html' %}
</div> </div>

View File

@ -1,9 +1,11 @@
<form id="search" method="{{ method or 'POST' }}" action="{{ url_for('search') }}" role="search"> <form id="search" method="{{ method or 'POST' }}" action="{{ url_for('search') }}" role="search">
<div id="search_header"> <div id="search_header">
<div id="search_view">
<div class="search_box"> <div class="search_box">
<input id="q" autofocus name="q" type="text" placeholder="{{ _('Search for...') }}" autocomplete="off" spellcheck="false" dir="auto" value="{{ q or '' }}"> <input id="q" name="q" type="text" placeholder="{{ _('Search for...') }}" autocomplete="off" autocapitalize="none" spellcheck="false" autocorrect="off" dir="auto" value="{{ q or '' }}">
<button id="clear_search" type="reset" aria-label="{{ _('clear') }}"><span class="hide_if_nojs">{{ icon_big('close') }}</span><span class="show_if_nojs">{{ _('clear') }}</span></button> <button id="clear_search" type="reset" aria-label="{{ _('clear') }}"><span class="hide_if_nojs">{{ icon_big('close') }}</span><span class="show_if_nojs">{{ _('clear') }}</span></button>
<button id="send_search" type="submit" aria-label="{{ _('search') }}"><span class="hide_if_nojs">{{ icon_big('search-outline') }}</span><span class="show_if_nojs">{{ _('search') }}</span></button> <button id="send_search" type="submit" aria-label="{{ _('search') }}"><span class="hide_if_nojs">{{ icon_big('search-outline') }}</span><span class="show_if_nojs">{{ _('search') }}</span></button>
</div> </div>
</div> </div>
</div>
</form> </form>