From 574e99c4de2e6a42a25bd2c984e729110a9efdd0 Mon Sep 17 00:00:00 2001 From: Marc Abonce Seguin Date: Sun, 26 Jul 2020 20:31:57 -0700 Subject: [PATCH 1/6] reduce space between title and url in infobox header --- searx/templates/oscar/infobox.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/searx/templates/oscar/infobox.html b/searx/templates/oscar/infobox.html index 6ae7965b6..9eeea2bfe 100644 --- a/searx/templates/oscar/infobox.html +++ b/searx/templates/oscar/infobox.html @@ -1,8 +1,10 @@ {% from 'oscar/macros.html' import result_link with context %}
{{- "" -}} -

{{ infobox.infobox }}

{{- "" -}} - {% for u in infobox.urls %}{% if u.official %} {{ u.domain }}{% endif %}{% endfor %} +
+

{{ infobox.infobox }}

{{- "" -}} + {% for u in infobox.urls %}{% if u.official %} {{ u.domain }}{% endif %}{% endfor %} +
{% if infobox.img_src %}{% endif %} From c9c39b3e79bfc24031ae1d352d290b9ec180e6ac Mon Sep 17 00:00:00 2001 From: Marc Abonce Seguin Date: Sun, 26 Jul 2020 23:26:30 -0700 Subject: [PATCH 2/6] add engine's name in infobox's header --- searx/results.py | 3 +++ searx/templates/oscar/infobox.html | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/searx/results.py b/searx/results.py index 4fed58e55..8673ec339 100644 --- a/searx/results.py +++ b/searx/results.py @@ -60,6 +60,8 @@ def merge_two_infoboxes(infobox1, infobox2): if weight2 > weight1: infobox1['engine'] = infobox2['engine'] + infobox1['engines'] |= infobox2['engines'] + if 'urls' in infobox2: urls1 = infobox1.get('urls', None) if urls1 is None: @@ -189,6 +191,7 @@ class ResultContainer(object): def _merge_infobox(self, infobox): add_infobox = True infobox_id = infobox.get('id', None) + infobox['engines'] = set([infobox['engine']]) if infobox_id is not None: parsed_url_infobox_id = urlparse(infobox_id) for existingIndex in self.infoboxes: diff --git a/searx/templates/oscar/infobox.html b/searx/templates/oscar/infobox.html index 9eeea2bfe..3e393b684 100644 --- a/searx/templates/oscar/infobox.html +++ b/searx/templates/oscar/infobox.html @@ -2,6 +2,11 @@
{{- "" -}}
+
+ {% for engine in infobox.engines %} + {{ engine }} + {% endfor %} +

{{ infobox.infobox }}

{{- "" -}} {% for u in infobox.urls %}{% if u.official %} {{ u.domain }}{% endif %}{% endfor %}
From 001eb047cd0ea25091757a2fbcc333b4e4c99e69 Mon Sep 17 00:00:00 2001 From: Marc Abonce Seguin Date: Sun, 2 Aug 2020 17:11:24 -0700 Subject: [PATCH 3/6] set max-height on infobox's images --- .../themes/oscar/css/logicodev-dark.css | 3 +++ .../themes/oscar/css/logicodev-dark.min.css | Bin 14111 -> 14142 bytes searx/static/themes/oscar/css/logicodev.css | 3 +++ .../static/themes/oscar/css/logicodev.min.css | Bin 10671 -> 10702 bytes searx/static/themes/oscar/css/pointhi.css | 3 +++ searx/static/themes/oscar/css/pointhi.min.css | Bin 6918 -> 6949 bytes .../themes/oscar/less/logicodev/infobox.less | 4 ++++ .../themes/oscar/less/pointhi/infobox.less | 4 ++++ 8 files changed, 17 insertions(+) diff --git a/searx/static/themes/oscar/css/logicodev-dark.css b/searx/static/themes/oscar/css/logicodev-dark.css index c104dc061..75ca61e7e 100644 --- a/searx/static/themes/oscar/css/logicodev-dark.css +++ b/searx/static/themes/oscar/css/logicodev-dark.css @@ -299,6 +299,9 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not font-family: "DejaVu Serif", Georgia, Cambria, "Times New Roman", Times, serif !important; font-style: italic; } +.infobox img { + max-height: 250px; +} .infobox .btn { background-color: #007ab8; border: none; diff --git a/searx/static/themes/oscar/css/logicodev-dark.min.css b/searx/static/themes/oscar/css/logicodev-dark.min.css index 27a41cc84e0ab35a09a155b3dfc24438b9f4e09f..c67fc41be675c2b936c9e310c0ee922fa10c7b9f 100644 GIT binary patch delta 35 qcmbQAw=ZvlnSe-UZhCcYVufx-YG!&yiItJ5K|#f49f8kkj9dWu>I}31 delta 12 Tcmdm&H$QKKnZV`{ftP9kCKCl# diff --git a/searx/static/themes/oscar/css/logicodev.css b/searx/static/themes/oscar/css/logicodev.css index 94b162857..29af243d7 100644 --- a/searx/static/themes/oscar/css/logicodev.css +++ b/searx/static/themes/oscar/css/logicodev.css @@ -272,6 +272,9 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not font-family: "DejaVu Serif", Georgia, Cambria, "Times New Roman", Times, serif !important; font-style: italic; } +.infobox img { + max-height: 250px; +} .infobox .btn { background-color: #007ab8; border: none; diff --git a/searx/static/themes/oscar/css/logicodev.min.css b/searx/static/themes/oscar/css/logicodev.min.css index 586bda7fbd1d1005dc03497f29b1cd7dcad1b435..c6b7fb3d6d8e3344453b14f6176f707142f2aef6 100644 GIT binary patch delta 35 qcmZ1XygqotV!_P^1$iU@C`Sb` diff --git a/searx/static/themes/oscar/css/pointhi.css b/searx/static/themes/oscar/css/pointhi.css index 4e167687c..eaa1bdc17 100644 --- a/searx/static/themes/oscar/css/pointhi.css +++ b/searx/static/themes/oscar/css/pointhi.css @@ -156,6 +156,9 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not outline: 0 none; position: relative; } +.infobox img { + max-height: 250px; +} .infobox .infobox_part { margin-bottom: 20px; word-wrap: break-word; diff --git a/searx/static/themes/oscar/css/pointhi.min.css b/searx/static/themes/oscar/css/pointhi.min.css index c0ff52e97ac66ebca4b497f0587b26d8f1fa8060..ab479af1811a9517d5d7dd4bdc26130d0029b2a4 100644 GIT binary patch delta 35 qcmZoOTWYqUfKwzhH@!MHu|hW^H8VY<#LCFjprB%N8s`E*MlJyAg$xh? delta 12 TcmZ2#)@HV$fOB&n=QKe8ArS Date: Sun, 2 Aug 2020 18:18:30 -0700 Subject: [PATCH 4/6] add class for infobox's official url --- .../themes/oscar/css/logicodev-dark.css | 8 +++++++- .../themes/oscar/css/logicodev-dark.min.css | Bin 14142 -> 14236 bytes searx/static/themes/oscar/css/logicodev.css | 8 +++++++- .../static/themes/oscar/css/logicodev.min.css | Bin 10702 -> 10796 bytes searx/static/themes/oscar/css/pointhi.css | 6 ++++++ searx/static/themes/oscar/css/pointhi.min.css | Bin 6949 -> 7041 bytes .../themes/oscar/less/logicodev/infobox.less | 7 +++++++ .../themes/oscar/less/pointhi/infobox.less | 7 +++++++ searx/templates/oscar/infobox.html | 2 +- 9 files changed, 35 insertions(+), 3 deletions(-) diff --git a/searx/static/themes/oscar/css/logicodev-dark.css b/searx/static/themes/oscar/css/logicodev-dark.css index 75ca61e7e..732b70e64 100644 --- a/searx/static/themes/oscar/css/logicodev-dark.css +++ b/searx/static/themes/oscar/css/logicodev-dark.css @@ -295,12 +295,18 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not .infobox .panel-heading .panel-title { font-weight: 700; } +.infobox .header_url { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: block; +} .infobox p { font-family: "DejaVu Serif", Georgia, Cambria, "Times New Roman", Times, serif !important; font-style: italic; } .infobox img { - max-height: 250px; + max-height: "250px"; } .infobox .btn { background-color: #007ab8; diff --git a/searx/static/themes/oscar/css/logicodev-dark.min.css b/searx/static/themes/oscar/css/logicodev-dark.min.css index c67fc41be675c2b936c9e310c0ee922fa10c7b9f..bd5d00d0c7f13f5501a624f39c128a2d7b19d0e4 100644 GIT binary patch delta 108 zcmdm&Hz$9?G5%n^jMT)G)S~#(qMYjTjLec$-Qt48QN=Bvz1r0DnaZ761SM diff --git a/searx/static/themes/oscar/css/logicodev.css b/searx/static/themes/oscar/css/logicodev.css index 29af243d7..00dfe3e97 100644 --- a/searx/static/themes/oscar/css/logicodev.css +++ b/searx/static/themes/oscar/css/logicodev.css @@ -268,12 +268,18 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not .infobox .panel-heading .panel-title { font-weight: 700; } +.infobox .header_url { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: block; +} .infobox p { font-family: "DejaVu Serif", Georgia, Cambria, "Times New Roman", Times, serif !important; font-style: italic; } .infobox img { - max-height: 250px; + max-height: "250px"; } .infobox .btn { background-color: #007ab8; diff --git a/searx/static/themes/oscar/css/logicodev.min.css b/searx/static/themes/oscar/css/logicodev.min.css index c6b7fb3d6d8e3344453b14f6176f707142f2aef6..c1f03d8a23848a9a0ed1289e77ad581621e8a989 100644 GIT binary patch delta 108 zcmX>Xye4FWv0$)XMrvY8YEgV?QBHMvMrKK>ZgD|ka;jBcetA)1fpvaaYEfEFez{df zW=cwGo^?rTMTst4Ff}J9v!FP$*g7S%xF9F7(kdw@KRJ7{reG(#l98!FL50%h?Sf(w E04M?}EC2ui delta 24 fcmZ1zaxQp-vEbwhg7vIMrUnHSo5h60BpA5>a+L>R diff --git a/searx/static/themes/oscar/css/pointhi.css b/searx/static/themes/oscar/css/pointhi.css index eaa1bdc17..fb99c01e6 100644 --- a/searx/static/themes/oscar/css/pointhi.css +++ b/searx/static/themes/oscar/css/pointhi.css @@ -167,6 +167,12 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not .infobox .infobox_part:last-child { margin-bottom: 0; } +.infobox .header_url { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: block; +} .search_categories, #categories { text-transform: capitalize; diff --git a/searx/static/themes/oscar/css/pointhi.min.css b/searx/static/themes/oscar/css/pointhi.min.css index ab479af1811a9517d5d7dd4bdc26130d0029b2a4..75e6330554dcfa760fd44f9f145c6f1bc2b4e295 100644 GIT binary patch delta 104 zcmZ2#)@Z(giz_-aFD*YQzd}JTBQ-H4wJ5%{D5ttSBeNt`x40lNIn^pJzq}~1z&gJy zwJ0qozuYP#GbJT8&$=YFqC^)in3|K5Sx}r=Y@L!>T#%DkX_b_dpPap!gG)vb06iNg Av;Y7A delta 14 VcmZoPUuw32i)(W_my{qQ7XTxt1F`@B diff --git a/searx/static/themes/oscar/less/logicodev/infobox.less b/searx/static/themes/oscar/less/logicodev/infobox.less index efde04fe0..08a1d326e 100644 --- a/searx/static/themes/oscar/less/logicodev/infobox.less +++ b/searx/static/themes/oscar/less/logicodev/infobox.less @@ -8,6 +8,13 @@ } } + .header_url { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: block; + } + p{ font-family: "DejaVu Serif", Georgia, Cambria, "Times New Roman", Times, serif !important; diff --git a/searx/static/themes/oscar/less/pointhi/infobox.less b/searx/static/themes/oscar/less/pointhi/infobox.less index 4997466a8..226941706 100644 --- a/searx/static/themes/oscar/less/pointhi/infobox.less +++ b/searx/static/themes/oscar/less/pointhi/infobox.less @@ -12,4 +12,11 @@ .infobox_part:last-child { margin-bottom: 0; } + + .header_url { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + display: block; + } } diff --git a/searx/templates/oscar/infobox.html b/searx/templates/oscar/infobox.html index 3e393b684..0c7a2e0a0 100644 --- a/searx/templates/oscar/infobox.html +++ b/searx/templates/oscar/infobox.html @@ -8,7 +8,7 @@ {% endfor %}

{{ infobox.infobox }}

{{- "" -}} - {% for u in infobox.urls %}{% if u.official %} {{ u.domain }}{% endif %}{% endfor %} + {% for u in infobox.urls %}{% if u.official %} {{ u.url }}{% endif %}{% endfor %}
From 57bad502a698c3d337641ad700cefd0be344ddd6 Mon Sep 17 00:00:00 2001 From: Marc Abonce Seguin Date: Sun, 2 Aug 2020 20:37:54 -0700 Subject: [PATCH 5/6] add visually-hidden css class to pointhi style --- searx/static/themes/oscar/css/pointhi.css | 11 +++++++++++ searx/static/themes/oscar/css/pointhi.min.css | Bin 7041 -> 7196 bytes .../themes/oscar/less/pointhi/search.less | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/searx/static/themes/oscar/css/pointhi.css b/searx/static/themes/oscar/css/pointhi.css index fb99c01e6..073d2c4f0 100644 --- a/searx/static/themes/oscar/css/pointhi.css +++ b/searx/static/themes/oscar/css/pointhi.css @@ -211,6 +211,17 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not font-weight: bold; background-color: #EEE; } +.visually-hidden { + position: absolute !important; + height: 1px; + width: 1px; + overflow: hidden; + clip: rect(1px 1px 1px 1px); + /* IE6, IE7 */ + clip: rect(1px, 1px, 1px, 1px); + white-space: nowrap; + /* added line */ +} #advanced-search-container { display: none; text-align: center; diff --git a/searx/static/themes/oscar/css/pointhi.min.css b/searx/static/themes/oscar/css/pointhi.min.css index 75e6330554dcfa760fd44f9f145c6f1bc2b4e295..f6cc3d8d841ae45e0176b29702e3138d6f62fb60 100644 GIT binary patch delta 173 zcmZoPpJTD1g|}X>EVH;YF(;=|HzPA8B{i?QAip@XBr`wHDlw@zKc}=LRWUQSAit<2 zF|WirBQ-NUqr}Rvpu)O5Go>U0%*roIElSJDFSmjiV4a+kSzuL^np~m*RHuN1HBqH> qfKoa#AOeUrt;;hqOHy@<3lfu4t@85AixLZJC+iC+Z(h!Oix&WR$v{N_ delta 12 TcmbPZ(P+M*g?F<&-(Ow;AX5am diff --git a/searx/static/themes/oscar/less/pointhi/search.less b/searx/static/themes/oscar/less/pointhi/search.less index 5ff73360a..ac0a7a0c7 100644 --- a/searx/static/themes/oscar/less/pointhi/search.less +++ b/searx/static/themes/oscar/less/pointhi/search.less @@ -31,3 +31,13 @@ background-color: #EEE; } } + +.visually-hidden { + position: absolute !important; + height: 1px; + width: 1px; + overflow: hidden; + clip: rect(1px 1px 1px 1px); /* IE6, IE7 */ + clip: rect(1px, 1px, 1px, 1px); + white-space: nowrap; /* added line */ +} From 0601f2bb481758ed8e0e68f96a976063d9b229db Mon Sep 17 00:00:00 2001 From: Marc Abonce Seguin Date: Mon, 3 Aug 2020 00:15:54 -0700 Subject: [PATCH 6/6] add toggle to resize infobox --- .../themes/oscar/css/logicodev-dark.css | 30 +++++++++++++ .../themes/oscar/css/logicodev-dark.min.css | Bin 14236 -> 14914 bytes searx/static/themes/oscar/css/logicodev.css | 30 +++++++++++++ .../static/themes/oscar/css/logicodev.min.css | Bin 10796 -> 11474 bytes searx/static/themes/oscar/css/pointhi.css | 30 +++++++++++++ searx/static/themes/oscar/css/pointhi.min.css | Bin 7196 -> 7874 bytes searx/static/themes/oscar/js/searx.js | 11 +++++ searx/static/themes/oscar/js/searx.min.js | Bin 5367 -> 5636 bytes .../themes/oscar/js/searx_src/infobox.js | 11 +++++ .../themes/oscar/less/logicodev/infobox.less | 39 ++++++++++++++++ .../themes/oscar/less/pointhi/infobox.less | 42 +++++++++++++++++- searx/templates/oscar/infobox.html | 7 ++- 12 files changed, 198 insertions(+), 2 deletions(-) create mode 100644 searx/static/themes/oscar/js/searx_src/infobox.js diff --git a/searx/static/themes/oscar/css/logicodev-dark.css b/searx/static/themes/oscar/css/logicodev-dark.css index 732b70e64..99e9c2a22 100644 --- a/searx/static/themes/oscar/css/logicodev-dark.css +++ b/searx/static/themes/oscar/css/logicodev-dark.css @@ -324,6 +324,36 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not .infobox .infobox_part:last-child { margin-bottom: 0; } +.infobox .infobox_toggle { + width: 100%; + text-align: center; + margin-bottom: 0px; +} +.infobox .infobox_checkbox ~ .infobox_body { + max-height: 300px; + overflow: hidden; +} +.infobox .infobox_checkbox:checked ~ .infobox_body { + max-height: none; +} +.infobox .infobox_checkbox ~ .infobox_toggle .infobox_label_down { + display: block; +} +.infobox .infobox_checkbox ~ .infobox_toggle .infobox_label_up { + display: none; +} +.infobox .infobox_checkbox:checked ~ .infobox_toggle .infobox_label_up { + display: block; +} +.infobox .infobox_checkbox:checked ~ .infobox_toggle .infobox_label_down { + display: none; +} +.infobox .infobox_checkbox ~ .infobox_body img.infobox_part { + display: none; +} +.infobox .infobox_checkbox:checked ~ .infobox_body img.infobox_part { + display: block; +} .search_categories, #categories { text-transform: capitalize; diff --git a/searx/static/themes/oscar/css/logicodev-dark.min.css b/searx/static/themes/oscar/css/logicodev-dark.min.css index bd5d00d0c7f13f5501a624f39c128a2d7b19d0e4..04c3561b9a0fdc4e1083fe2e2b16bffa051bfc0d 100644 GIT binary patch delta 694 zcmb7?L2kk@5CGr6g)LYjr52CVm9E diff --git a/searx/static/themes/oscar/css/logicodev.css b/searx/static/themes/oscar/css/logicodev.css index 00dfe3e97..5d0a223a6 100644 --- a/searx/static/themes/oscar/css/logicodev.css +++ b/searx/static/themes/oscar/css/logicodev.css @@ -297,6 +297,36 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not .infobox .infobox_part:last-child { margin-bottom: 0; } +.infobox .infobox_toggle { + width: 100%; + text-align: center; + margin-bottom: 0px; +} +.infobox .infobox_checkbox ~ .infobox_body { + max-height: 300px; + overflow: hidden; +} +.infobox .infobox_checkbox:checked ~ .infobox_body { + max-height: none; +} +.infobox .infobox_checkbox ~ .infobox_toggle .infobox_label_down { + display: block; +} +.infobox .infobox_checkbox ~ .infobox_toggle .infobox_label_up { + display: none; +} +.infobox .infobox_checkbox:checked ~ .infobox_toggle .infobox_label_up { + display: block; +} +.infobox .infobox_checkbox:checked ~ .infobox_toggle .infobox_label_down { + display: none; +} +.infobox .infobox_checkbox ~ .infobox_body img.infobox_part { + display: none; +} +.infobox .infobox_checkbox:checked ~ .infobox_body img.infobox_part { + display: block; +} .search_categories, #categories { text-transform: capitalize; diff --git a/searx/static/themes/oscar/css/logicodev.min.css b/searx/static/themes/oscar/css/logicodev.min.css index c1f03d8a23848a9a0ed1289e77ad581621e8a989..8c2bcdc5b40d425b8380ca02e0823cce5450c9d3 100644 GIT binary patch delta 564 zcmb7=O=`kG6vxldbkVJwE+ZoriW3U<4&Attnap!$a568%R}%?%39sQo=n2Fd^eUzM z`oRQ(2I=lC-tYgl{rH~jexuDHdKeOF?Vv8LBEtuaJtqVe#ll(bc?zDONHS4q>tl&T zm~pn*M~|@SaInvop+?Yjeq719IVIPY42(@0p9;B(&`bS gyabi@U_G1ZW`VX8-^I delta 16 YcmcZwmXlv@m64f}lA4FdBrC9y zsVNvH*29g=%g;;2V*)}a#2*OP<|HPi=ESGum*-WdWEL0XBvx7_<>V)46J=OEcGF4= z;ARnU7pBh$nuzSWdgK^_g*&lkqWGDBI}zaric5ve+;ni{MgXHZz96xvgna*^m%=+|6u?C delta 12 TcmX?PJI7)}I@e}i-mQWFA+-dE diff --git a/searx/static/themes/oscar/js/searx.js b/searx/static/themes/oscar/js/searx.js index 040d57bb1..543c7775c 100644 --- a/searx/static/themes/oscar/js/searx.js +++ b/searx/static/themes/oscar/js/searx.js @@ -204,6 +204,17 @@ $(document).ready(function(){ $(a.target).parent().attr("aria-selected", "true"); }); }); +;$(document).ready(function() { + // Hide infobox toggle if shrunk size already fits all content. + $('.infobox').each(function() { + var infobox_body = $(this).find('.infobox_body'); + var total_height = infobox_body.prop('scrollHeight') + infobox_body.find('img.infobox_part').height(); + var max_height = infobox_body.css('max-height').replace('px', ''); + if (total_height <= max_height) { + $(this).find('.infobox_toggle').hide(); + } + }); +}); ;/** * searx is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by diff --git a/searx/static/themes/oscar/js/searx.min.js b/searx/static/themes/oscar/js/searx.min.js index a6ba8b336b28ba8f93cbe3f6579cfcc844def431..e2d751a19608e464a8deca7bd7d792271560c38f 100644 GIT binary patch delta 237 zcmeya*`hN+QqRyp*T6#8$iT=zp++I2q@4C(O@+;z#@>436G_4c$3X1XzG?a>y zi}G`FJW?~$GfI>+wG;Iq$}@A*;W`Qui-1yk8DKRUnl`qHddbDb8cMl|6}k{XplnfU zK~7?Fs)kZQg_4evlBSxPibhFBX0fIm)I_*(CHd*;IjJB6GgDGECW)wRzRxMa4FEz) BPb~ld delta 29 kcmZqC`K~!ZlGngY*T7uY$iT=zp+;e&`!3GSZ@I*|0fL_hwEzGB diff --git a/searx/static/themes/oscar/js/searx_src/infobox.js b/searx/static/themes/oscar/js/searx_src/infobox.js new file mode 100644 index 000000000..0c80bf37b --- /dev/null +++ b/searx/static/themes/oscar/js/searx_src/infobox.js @@ -0,0 +1,11 @@ +$(document).ready(function() { + // Hide infobox toggle if shrunk size already fits all content. + $('.infobox').each(function() { + var infobox_body = $(this).find('.infobox_body'); + var total_height = infobox_body.prop('scrollHeight') + infobox_body.find('img.infobox_part').height(); + var max_height = infobox_body.css('max-height').replace('px', ''); + if (total_height <= max_height) { + $(this).find('.infobox_toggle').hide(); + } + }); +}); diff --git a/searx/static/themes/oscar/less/logicodev/infobox.less b/searx/static/themes/oscar/less/logicodev/infobox.less index 08a1d326e..e3582dffc 100644 --- a/searx/static/themes/oscar/less/logicodev/infobox.less +++ b/searx/static/themes/oscar/less/logicodev/infobox.less @@ -45,4 +45,43 @@ .infobox_part:last-child { margin-bottom: 0; } + + .infobox_toggle { + width: 100%; + text-align: center; + margin-bottom: 0px; + } + + // Shrink infobox size when toggle is off + .infobox_checkbox ~ .infobox_body { + max-height: 300px; + overflow: hidden; + } + .infobox_checkbox:checked ~ .infobox_body { + max-height: none; + } + + // Show toggle button as down when infobox is shrunk + .infobox_checkbox ~ .infobox_toggle .infobox_label_down { + display: block; + } + .infobox_checkbox ~ .infobox_toggle .infobox_label_up { + display: none; + } + + // Show toggle button as up when infobox is expanded + .infobox_checkbox:checked ~ .infobox_toggle .infobox_label_up { + display: block; + } + .infobox_checkbox:checked ~ .infobox_toggle .infobox_label_down { + display: none; + } + + // Hide main image when toggle is off + .infobox_checkbox ~ .infobox_body img.infobox_part { + display: none; + } + .infobox_checkbox:checked ~ .infobox_body img.infobox_part { + display: block; + } } diff --git a/searx/static/themes/oscar/less/pointhi/infobox.less b/searx/static/themes/oscar/less/pointhi/infobox.less index 226941706..e6a55e944 100644 --- a/searx/static/themes/oscar/less/pointhi/infobox.less +++ b/searx/static/themes/oscar/less/pointhi/infobox.less @@ -1,5 +1,6 @@ .infobox { - img{ + + img { max-height: 250px; } @@ -19,4 +20,43 @@ text-overflow: ellipsis; display: block; } + + .infobox_toggle { + width: 100%; + text-align: center; + margin-bottom: 0px; + } + + // Shrink infobox size when toggle is off + .infobox_checkbox ~ .infobox_body { + max-height: 300px; + overflow: hidden; + } + .infobox_checkbox:checked ~ .infobox_body { + max-height: none; + } + + // Show toggle button as down when infobox is shrunk + .infobox_checkbox ~ .infobox_toggle .infobox_label_down { + display: block; + } + .infobox_checkbox ~ .infobox_toggle .infobox_label_up { + display: none; + } + + // Show toggle button as up when infobox is expanded + .infobox_checkbox:checked ~ .infobox_toggle .infobox_label_up { + display: block; + } + .infobox_checkbox:checked ~ .infobox_toggle .infobox_label_down { + display: none; + } + + // Hide main image when toggle is off + .infobox_checkbox ~ .infobox_body img.infobox_part { + display: none; + } + .infobox_checkbox:checked ~ .infobox_body img.infobox_part { + display: block; + } } diff --git a/searx/templates/oscar/infobox.html b/searx/templates/oscar/infobox.html index 0c7a2e0a0..5ba4aa5f0 100644 --- a/searx/templates/oscar/infobox.html +++ b/searx/templates/oscar/infobox.html @@ -11,7 +11,8 @@ {% for u in infobox.urls %}{% if u.official %} {{ u.url }}{% endif %}{% endfor %}
-
+ +
{% if infobox.img_src %}{% endif %} {% if infobox.content %}

{{ infobox.content | safe }}

{% endif %} @@ -45,4 +46,8 @@
{% endif %}
+