on master help sign in
[enh] remove repeating codeparts inside the oscar template
d810763Thomas Pointhuber
searx/static/oscar/css/oscar.min.css+1−1
@@ -1 +1 @@
1−html{position:relative;min-height:100%}body{margin-bottom:80px}.footer{position:absolute;bottom:0;width:100%;height:60px}input[type=checkbox]:checked~.label_hide_if_checked{display:none}input[type=checkbox]:not(:checked)~.label_hide_if_not_checked{display:none}.result_header{margin-bottom:5px;margin-top:20px}.result_header .favicon{margin-bottom:-3px}.result_header a{vertical-align:bottom}.result_header a .highlight{font-weight:700}.result-content{margin-top:5px}.result-content .highlight{font-weight:700}.result-default{clear:both}.result-images{float:left!important}.img-thumbnail{margin:5px;max-height:128px;min-height:128px}.result-videos{clear:both}.result-torrents{clear:both}.result-map{clear:both}.suggestion_item{margin:2px 5px}.result_download{margin-right:5px}#pagination{margin-top:30px;padding-bottom:50px}.infobox .infobox_part{margin-bottom:20px}.infobox .infobox_part:last-child{margin-bottom:0}.search_categories{margin:10px 0;text-transform:capitalize}.cursor-text{cursor:text!important}.cursor-pointer{cursor:pointer!important}.highlight .hll{background-color:#ffc}.highlight{background:#f8f8f8}.highlight .c{color:#408080;font-style:italic}.highlight .err{border:1px solid red}.highlight .k{color:green;font-weight:700}.highlight .o{color:#666}.highlight .cm{color:#408080;font-style:italic}.highlight .cp{color:#bc7a00}.highlight .c1{color:#408080;font-style:italic}.highlight .cs{color:#408080;font-style:italic}.highlight .gd{color:#a00000}.highlight .ge{font-style:italic}.highlight .gr{color:red}.highlight .gh{color:navy;font-weight:700}.highlight .gi{color:#00a000}.highlight .go{color:#888}.highlight .gp{color:navy;font-weight:700}.highlight .gs{font-weight:700}.highlight .gu{color:purple;font-weight:700}.highlight .gt{color:#04d}.highlight .kc{color:green;font-weight:700}.highlight .kd{color:green;font-weight:700}.highlight .kn{color:green;font-weight:700}.highlight .kp{color:green}.highlight .kr{color:green;font-weight:700}.highlight .kt{color:#b00040}.highlight .m{color:#666}.highlight .s{color:#ba2121}.highlight .na{color:#7d9029}.highlight .nb{color:green}.highlight .nc{color:#00F;font-weight:700}.highlight .no{color:#800}.highlight .nd{color:#a2f}.highlight .ni{color:#999;font-weight:700}.highlight .ne{color:#D2413A;font-weight:700}.highlight .nf{color:#00f}.highlight .nl{color:#a0a000}.highlight .nn{color:#00F;font-weight:700}.highlight .nt{color:green;font-weight:700}.highlight .nv{color:#19177c}.highlight .ow{color:#A2F;font-weight:700}.highlight .w{color:#bbb}.highlight .mf{color:#666}.highlight .mh{color:#666}.highlight .mi{color:#666}.highlight .mo{color:#666}.highlight .sb{color:#ba2121}.highlight .sc{color:#ba2121}.highlight .sd{color:#BA2121;font-style:italic}.highlight .s2{color:#ba2121}.highlight .se{color:#B62;font-weight:700}.highlight .sh{color:#ba2121}.highlight .si{color:#B68;font-weight:700}.highlight .sx{color:green}.highlight .sr{color:#b68}.highlight .s1{color:#ba2121}.highlight .ss{color:#19177c}.highlight .bp{color:green}.highlight .vc{color:#19177c}.highlight .vg{color:#19177c}.highlight .vi{color:#19177c}.highlight .il{color:#666}.highlight .lineno{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.highlight .lineno::selection{background:0 0}.highlight .lineno::-moz-selection{background:0 0}
1+html{position:relative;min-height:100%}body{margin-bottom:80px}.footer{position:absolute;bottom:0;width:100%;height:60px}input[type=checkbox]:checked~.label_hide_if_checked{display:none}input[type=checkbox]:not(:checked)~.label_hide_if_not_checked{display:none}.result_header{margin-bottom:5px;margin-top:20px}.result_header .favicon{margin-bottom:-3px}.result_header a{vertical-align:bottom}.result_header a .highlight{font-weight:700}.result-content{margin-top:5px}.result-content .highlight{font-weight:700}.result-default{clear:both}.result-images{float:left!important}.img-thumbnail{margin:5px;max-height:128px;min-height:128px}.result-videos{clear:both}.result-torrents{clear:both}.result-map{clear:both}.result-code{clear:both}.suggestion_item{margin:2px 5px}.result_download{margin-right:5px}#pagination{margin-top:30px;padding-bottom:50px}.infobox .infobox_part{margin-bottom:20px}.infobox .infobox_part:last-child{margin-bottom:0}.search_categories{margin:10px 0;text-transform:capitalize}.cursor-text{cursor:text!important}.cursor-pointer{cursor:pointer!important}.highlight .hll{background-color:#ffc}.highlight{background:#f8f8f8}.highlight .c{color:#408080;font-style:italic}.highlight .err{border:1px solid red}.highlight .k{color:green;font-weight:700}.highlight .o{color:#666}.highlight .cm{color:#408080;font-style:italic}.highlight .cp{color:#bc7a00}.highlight .c1{color:#408080;font-style:italic}.highlight .cs{color:#408080;font-style:italic}.highlight .gd{color:#a00000}.highlight .ge{font-style:italic}.highlight .gr{color:red}.highlight .gh{color:navy;font-weight:700}.highlight .gi{color:#00a000}.highlight .go{color:#888}.highlight .gp{color:navy;font-weight:700}.highlight .gs{font-weight:700}.highlight .gu{color:purple;font-weight:700}.highlight .gt{color:#04d}.highlight .kc{color:green;font-weight:700}.highlight .kd{color:green;font-weight:700}.highlight .kn{color:green;font-weight:700}.highlight .kp{color:green}.highlight .kr{color:green;font-weight:700}.highlight .kt{color:#b00040}.highlight .m{color:#666}.highlight .s{color:#ba2121}.highlight .na{color:#7d9029}.highlight .nb{color:green}.highlight .nc{color:#00F;font-weight:700}.highlight .no{color:#800}.highlight .nd{color:#a2f}.highlight .ni{color:#999;font-weight:700}.highlight .ne{color:#D2413A;font-weight:700}.highlight .nf{color:#00f}.highlight .nl{color:#a0a000}.highlight .nn{color:#00F;font-weight:700}.highlight .nt{color:green;font-weight:700}.highlight .nv{color:#19177c}.highlight .ow{color:#A2F;font-weight:700}.highlight .w{color:#bbb}.highlight .mf{color:#666}.highlight .mh{color:#666}.highlight .mi{color:#666}.highlight .mo{color:#666}.highlight .sb{color:#ba2121}.highlight .sc{color:#ba2121}.highlight .sd{color:#BA2121;font-style:italic}.highlight .s2{color:#ba2121}.highlight .se{color:#B62;font-weight:700}.highlight .sh{color:#ba2121}.highlight .si{color:#B68;font-weight:700}.highlight .sx{color:green}.highlight .sr{color:#b68}.highlight .s1{color:#ba2121}.highlight .ss{color:#19177c}.highlight .bp{color:green}.highlight .vc{color:#19177c}.highlight .vg{color:#19177c}.highlight .vi{color:#19177c}.highlight .il{color:#666}.highlight .lineno{-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.highlight .lineno::selection{background:0 0}.highlight .lineno::-moz-selection{background:0 0}
searx/static/oscar/less/oscar/results.less+5
@@ -55,6 +55,11 @@
55 clear: both;
55 clear: both;
56}
56}
57
57
58+// code formating of results
59+.result-code {
60+ clear: both;
61+}
62+
58// suggestion
63// suggestion
59.suggestion_item {
64.suggestion_item {
60 margin: 2px 5px;
65 margin: 2px 5px;
searx/templates/oscar/macros.html+25
@@ -1,3 +1,28 @@
1+<!-- Draw glyphicon icon from bootstrap-theme -->
1{% macro icon(action) -%}
2{% macro icon(action) -%}
2 <span class="glyphicon glyphicon-{{ action }}"></span>
3 <span class="glyphicon glyphicon-{{ action }}"></span>
3{%- endmacro %}
4{%- endmacro %}
5+
6+<!-- Draw favicon -->
7+<!-- TODO: using url_for methode -->
8+{% macro draw_favicon(favicon) -%}
9+ <img width="32" height="32" class="favicon" src="static/oscar/img/icons/{{ favicon }}.png" alt="{{ favicon }}" />
10+{%- endmacro %}
11+
12+<!-- Draw result header -->
13+{% macro result_header(result) -%}
14+ <h4 class="result_header">{% if result.favicon %}{{ draw_favicon(result.favicon) }} {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
15+{%- endmacro %}
16+
17+<!-- Draw result sub header -->
18+{% macro result_sub_header(result) -%}
19+ {% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
20+ <small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
21+{%- endmacro %}
22+
23+<!-- Draw result footer -->
24+{% macro result_footer(result) -%}
25+ <div class="clearfix"></div>
26+ <span class="label label-default pull-right">{{ result.engine }}</span>
27+ <p class="text-muted">{{ result.pretty_url }}</p>
28+{%- endmacro %}
searx/templates/oscar/result_templates/code.html+4−9
@@ -1,9 +1,7 @@
1−{% from 'oscar/macros.html' import icon %}
1+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
2
2
3−<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3+{{ result_header(result) }}
4−
4+{{ result_sub_header(result) }}
5−{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6−<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
7
5
8{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
6{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
9
7
@@ -11,7 +9,4 @@
11
9
12{{ result.codelines|code_highlighter(result.code_language)|safe }}
10{{ result.codelines|code_highlighter(result.code_language)|safe }}
13
11
14−<div class="clearfix"></div>
12+{{ result_footer(result) }}
15−
16−<span class="label label-default pull-right">{{ result.engine }}</span>
17−<p class="text-muted">{{ result.pretty_url }}</p>
searx/templates/oscar/result_templates/default.html+4−9
@@ -1,13 +1,8 @@
1−{% from 'oscar/macros.html' import icon %}
1+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer %}
2
2
3−<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3+{{ result_header(result) }}
4−
4+{{ result_sub_header(result) }}
5−{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6−<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
7
5
8{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
6{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
9
7
10−<div class="clearfix"></div>
8+{{ result_footer(result) }}
11−
12−<span class="label label-default pull-right">{{ result.engine }}</span>
13−<p class="text-muted">{{ result.pretty_url }}</p>
searx/templates/oscar/result_templates/images.html+3−1
@@ -1,3 +1,5 @@
1+{% from 'oscar/macros.html' import draw_favicon %}
2+
1<a href="{{ result.img_src }}" data-toggle="modal" data-target="#modal-{{ index }}">
3<a href="{{ result.img_src }}" data-toggle="modal" data-target="#modal-{{ index }}">
2 <img src="{{ result.img_src }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="img-thumbnail">
4 <img src="{{ result.img_src }}" alt="{{ result.title|striptags }}" title="{{ result.title|striptags }}" class="img-thumbnail">
3</a>
5</a>
@@ -7,7 +9,7 @@
7 <div class="modal-content">
9 <div class="modal-content">
8 <div class="modal-header">
10 <div class="modal-header">
9 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
11 <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
10− <h4 class="modal-title">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}{{ result.title|striptags }}</h4>
12+ <h4 class="modal-title">{% if result['favicon'] %}{{ draw_favicon(result['favicon']) }} {% endif %}{{ result.title|striptags }}</h4>
11 </div>
13 </div>
12 <div class="modal-body">
14 <div class="modal-body">
13 <img class="img-responsive center-block" src="{{ result.img_src }}" alt="{{ result.title }}">
15 <img class="img-responsive center-block" src="{{ result.img_src }}" alt="{{ result.title }}">
searx/templates/oscar/result_templates/map.html+4−10
@@ -1,10 +1,7 @@
1−{% from 'oscar/macros.html' import icon %}
1+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
2
2
3−<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3+{{ result_header(result) }}
4−
4+{{ result_sub_header(result) }}
5−{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6−
7−<small><a class="text-info" href="https://web.archive.org/web/{{ result.pretty_url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
8
5
9{% if (result.latitude and result.longitude) or result.boundingbox %}
6{% if (result.latitude and result.longitude) or result.boundingbox %}
10 <small> &bull; <a class="text-info btn-collapse collapsed searx_init_map cursor-pointer" data-toggle="collapse" data-target="#result-map-{{ index }}" data-leaflet-target="osm-map-{{ index }}" data-map-lon="{{ result.longitude }}" data-map-lat="{{ result.latitude }}" {% if result.boundingbox %}data-map-boundingbox='{{ result.boundingbox|tojson|safe }}'{% endif %} {% if result.geojson %}data-map-geojson='{{ result.geojson|tojson|safe }}'{% endif %} data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}">{{ icon('globe') }} {{ _('show map') }}</a></small>
7 <small> &bull; <a class="text-info btn-collapse collapsed searx_init_map cursor-pointer" data-toggle="collapse" data-target="#result-map-{{ index }}" data-leaflet-target="osm-map-{{ index }}" data-map-lon="{{ result.longitude }}" data-map-lat="{{ result.latitude }}" {% if result.boundingbox %}data-map-boundingbox='{{ result.boundingbox|tojson|safe }}'{% endif %} {% if result.geojson %}data-map-geojson='{{ result.geojson|tojson|safe }}'{% endif %} data-btn-text-collapsed="{{ _('show map') }}" data-btn-text-not-collapsed="{{ _('hide map') }}">{{ icon('globe') }} {{ _('show map') }}</a></small>
@@ -68,7 +65,4 @@
68 </div>
65 </div>
69{% endif %}
66{% endif %}
70
67
71−<div class="clearfix"></div>
68+{{ result_footer(result) }}
72−
73−<span class="label label-default pull-right">{{ result.engine }}</span>
74−<p class="text-muted">{{ result.pretty_url }}</p>
searx/templates/oscar/result_templates/torrent.html+4−9
@@ -1,9 +1,7 @@
1−{% from 'oscar/macros.html' import icon %}
1+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer, icon %}
2
2
3−<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3+{{ result_header(result) }}
4−
4+{{ result_sub_header(result) }}
5−{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6−<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
7
5
8<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span>, {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>
6<p class="result-content">{{ icon('transfer') }} {{ _('Seeder') }} <span class="badge">{{ result.seed }}</span>, {{ _('Leecher') }} <span class="badge">{{ result.leech }}</span>
9<br/>
7<br/>
@@ -11,7 +9,4 @@
11
9
12{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
10{% if result.content %}<p class="result-content">{{ result.content|safe }}</p>{% endif %}
13
11
14−<div class="clearfix"></div>
12+{{ result_footer(result) }}
15−
16−<span class="label label-default pull-right">{{ result.engine }}</span>
17−<p class="text-muted">{{ result.pretty_url }}</p>
searx/templates/oscar/result_templates/videos.html+4−9
@@ -1,9 +1,7 @@
1−{% from 'oscar/macros.html' import icon %}
1+{% from 'oscar/macros.html' import result_header, result_sub_header, result_footer %}
2
2
3−<h4 class="result_header">{% if result['favicon'] %}<img width="32" height="32" class="favicon" src="static/{{ theme }}/img/icons/{{ result['favicon'] }}.png" alt="{{ result['favicon'] }}" /> {% endif %}<a href="{{ result.url }}">{{ result.title|safe }}</a></h4>
3+{{ result_header(result) }}
4−
4+{{ result_sub_header(result) }}
5−{% if result.publishedDate %}<time class="text-muted" datetime="{{ result.pubdate }}" >{{ result.publishedDate }}</time>{% endif %}
6−<small><a class="text-info" href="https://web.archive.org/web/{{ result.url }}">{{ icon('link') }} {{ _('cached') }}</a></small>
7
5
8<div class="container-fluid">
6<div class="container-fluid">
9 <div class="row">
7 <div class="row">
@@ -12,7 +10,4 @@
12 </div>
10 </div>
13</div>
11</div>
14
12
15−<div class="clearfix"></div>
13+{{ result_footer(result) }}
16−
17−<span class="label label-default pull-right">{{ result.engine }}</span>
18−<p class="text-muted">{{ result.pretty_url }}</p>