mirror of https://github.com/searxng/searxng.git
Merge pull request #2131 from MarcAbonce/infobox_style
Make infobox shorter by default and add an expand toggle
This commit is contained in:
commit
43df251f3d
|
@ -60,6 +60,8 @@ def merge_two_infoboxes(infobox1, infobox2):
|
||||||
if weight2 > weight1:
|
if weight2 > weight1:
|
||||||
infobox1['engine'] = infobox2['engine']
|
infobox1['engine'] = infobox2['engine']
|
||||||
|
|
||||||
|
infobox1['engines'] |= infobox2['engines']
|
||||||
|
|
||||||
if 'urls' in infobox2:
|
if 'urls' in infobox2:
|
||||||
urls1 = infobox1.get('urls', None)
|
urls1 = infobox1.get('urls', None)
|
||||||
if urls1 is None:
|
if urls1 is None:
|
||||||
|
@ -189,6 +191,7 @@ class ResultContainer(object):
|
||||||
def _merge_infobox(self, infobox):
|
def _merge_infobox(self, infobox):
|
||||||
add_infobox = True
|
add_infobox = True
|
||||||
infobox_id = infobox.get('id', None)
|
infobox_id = infobox.get('id', None)
|
||||||
|
infobox['engines'] = set([infobox['engine']])
|
||||||
if infobox_id is not None:
|
if infobox_id is not None:
|
||||||
parsed_url_infobox_id = urlparse(infobox_id)
|
parsed_url_infobox_id = urlparse(infobox_id)
|
||||||
for existingIndex in self.infoboxes:
|
for existingIndex in self.infoboxes:
|
||||||
|
|
|
@ -295,10 +295,19 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not
|
||||||
.infobox .panel-heading .panel-title {
|
.infobox .panel-heading .panel-title {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
.infobox .header_url {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
.infobox p {
|
.infobox p {
|
||||||
font-family: "DejaVu Serif", Georgia, Cambria, "Times New Roman", Times, serif !important;
|
font-family: "DejaVu Serif", Georgia, Cambria, "Times New Roman", Times, serif !important;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
.infobox img {
|
||||||
|
max-height: "250px";
|
||||||
|
}
|
||||||
.infobox .btn {
|
.infobox .btn {
|
||||||
background-color: #007ab8;
|
background-color: #007ab8;
|
||||||
border: none;
|
border: none;
|
||||||
|
@ -315,6 +324,36 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not
|
||||||
.infobox .infobox_part:last-child {
|
.infobox .infobox_part:last-child {
|
||||||
margin-bottom: 0;
|
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,
|
.search_categories,
|
||||||
#categories {
|
#categories {
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -268,10 +268,19 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not
|
||||||
.infobox .panel-heading .panel-title {
|
.infobox .panel-heading .panel-title {
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
.infobox .header_url {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
.infobox p {
|
.infobox p {
|
||||||
font-family: "DejaVu Serif", Georgia, Cambria, "Times New Roman", Times, serif !important;
|
font-family: "DejaVu Serif", Georgia, Cambria, "Times New Roman", Times, serif !important;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
.infobox img {
|
||||||
|
max-height: "250px";
|
||||||
|
}
|
||||||
.infobox .btn {
|
.infobox .btn {
|
||||||
background-color: #007ab8;
|
background-color: #007ab8;
|
||||||
border: none;
|
border: none;
|
||||||
|
@ -288,6 +297,36 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not
|
||||||
.infobox .infobox_part:last-child {
|
.infobox .infobox_part:last-child {
|
||||||
margin-bottom: 0;
|
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,
|
.search_categories,
|
||||||
#categories {
|
#categories {
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -156,6 +156,9 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not
|
||||||
outline: 0 none;
|
outline: 0 none;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
.infobox img {
|
||||||
|
max-height: 250px;
|
||||||
|
}
|
||||||
.infobox .infobox_part {
|
.infobox .infobox_part {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
@ -164,6 +167,42 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not
|
||||||
.infobox .infobox_part:last-child {
|
.infobox .infobox_part:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
.infobox .header_url {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.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,
|
.search_categories,
|
||||||
#categories {
|
#categories {
|
||||||
text-transform: capitalize;
|
text-transform: capitalize;
|
||||||
|
@ -202,6 +241,17 @@ input[type=checkbox]:not(:checked) + .label_hide_if_checked + .label_hide_if_not
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background-color: #EEE;
|
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 {
|
#advanced-search-container {
|
||||||
display: none;
|
display: none;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -204,6 +204,17 @@ $(document).ready(function(){
|
||||||
$(a.target).parent().attr("aria-selected", "true");
|
$(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
|
* 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
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
|
@ -8,12 +8,23 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header_url {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
p{
|
p{
|
||||||
font-family: "DejaVu Serif", Georgia, Cambria, "Times New Roman", Times, serif !important;
|
font-family: "DejaVu Serif", Georgia, Cambria, "Times New Roman", Times, serif !important;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img{
|
||||||
|
max-height: "250px";
|
||||||
|
}
|
||||||
|
|
||||||
.btn{
|
.btn{
|
||||||
background-color: @dark-blue;
|
background-color: @dark-blue;
|
||||||
border: none;
|
border: none;
|
||||||
|
@ -34,4 +45,43 @@
|
||||||
.infobox_part:last-child {
|
.infobox_part:last-child {
|
||||||
margin-bottom: 0;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
.infobox {
|
.infobox {
|
||||||
|
|
||||||
|
img {
|
||||||
|
max-height: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
.infobox_part {
|
.infobox_part {
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
|
@ -8,4 +13,50 @@
|
||||||
.infobox_part:last-child {
|
.infobox_part:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.header_url {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,3 +31,13 @@
|
||||||
background-color: #EEE;
|
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 */
|
||||||
|
}
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
{% from 'oscar/macros.html' import result_link with context %}
|
{% from 'oscar/macros.html' import result_link with context %}
|
||||||
<div class="panel panel-default infobox">
|
<div class="panel panel-default infobox">
|
||||||
<div class="panel-heading">{{- "" -}}
|
<div class="panel-heading">{{- "" -}}
|
||||||
<h4 class="panel-title infobox_part"><bdi>{{ infobox.infobox }}</bdi></h4>{{- "" -}}
|
<div class="infobox_part">
|
||||||
{% for u in infobox.urls %}{% if u.official %} <a href="{{ u.url }}">{{ u.domain }}</a>{% endif %}{% endfor %}
|
<div class="{% if not rtl %}pull-right{% endif %}">
|
||||||
|
{% for engine in infobox.engines %}
|
||||||
|
<span class="label label-default">{{ engine }}</span>
|
||||||
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<h4 class="panel-title"><bdi>{{ infobox.infobox }}</bdi></h4>{{- "" -}}
|
||||||
|
{% for u in infobox.urls %}{% if u.official %} <a class="header_url" href="{{ u.url }}">{{ u.url }}</a>{% endif %}{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<input type="checkbox" class="infobox_checkbox" id="expand_infobox_{{ infobox.engine }}" hidden>
|
||||||
|
<div class="panel-body infobox_body">
|
||||||
{% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ image_proxify(infobox.img_src) }}" />{% endif %}
|
{% if infobox.img_src %}<img class="img-responsive center-block infobox_part" src="{{ image_proxify(infobox.img_src) }}" />{% endif %}
|
||||||
|
|
||||||
{% if infobox.content %}<bdi><p class="infobox_part">{{ infobox.content | safe }}</p></bdi>{% endif %}
|
{% if infobox.content %}<bdi><p class="infobox_part">{{ infobox.content | safe }}</p></bdi>{% endif %}
|
||||||
|
@ -38,4 +46,8 @@
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
<label for="expand_infobox_{{ infobox.engine }}" class="infobox_toggle panel-footer">
|
||||||
|
<span class="infobox_label_down glyphicon glyphicon-chevron-down"></span>
|
||||||
|
<span class="infobox_label_up glyphicon glyphicon-chevron-up"></span>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue