mirror of
https://github.com/searxng/searxng.git
synced 2024-11-19 19:00:10 +01:00
Merge pull request #18 from rsdy/master
highlight different search results differently
This commit is contained in:
commit
6f8daea724
@ -13,9 +13,10 @@ def response(resp):
|
|||||||
results = []
|
results = []
|
||||||
if 'Definition' in search_res:
|
if 'Definition' in search_res:
|
||||||
if search_res.get('AbstractURL'):
|
if search_res.get('AbstractURL'):
|
||||||
res = {'title' : search_res.get('Heading', '')
|
res = {'title' : search_res.get('Heading', '')
|
||||||
,'content' : search_res.get('Definition', '')
|
,'content' : search_res.get('Definition', '')
|
||||||
,'url' : search_res.get('AbstractURL', '')
|
,'url' : search_res.get('AbstractURL', '')
|
||||||
|
,'class' : 'definition_result'
|
||||||
}
|
}
|
||||||
results.append(res)
|
results.append(res)
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ def response(resp):
|
|||||||
title = ' '.join(link.xpath('.//text()'))
|
title = ' '.join(link.xpath('.//text()'))
|
||||||
content = escape(' '.join(result.xpath('.//font[@class="detDesc"]//text()')))
|
content = escape(' '.join(result.xpath('.//font[@class="detDesc"]//text()')))
|
||||||
seed, leech = result.xpath('.//td[@align="right"]/text()')[:2]
|
seed, leech = result.xpath('.//td[@align="right"]/text()')[:2]
|
||||||
content += '<br />Seed: %s, Leech: %s' % (seed, leech)
|
|
||||||
magnetlink = result.xpath('.//a[@title="Download this torrent using magnet"]')[0]
|
magnetlink = result.xpath('.//a[@title="Download this torrent using magnet"]')[0]
|
||||||
content += '<br /><a href="%s">magnet link</a>' % urljoin(url, magnetlink.attrib['href'])
|
results.append({'url': href, 'title': title, 'content': content,
|
||||||
results.append({'url': href, 'title': title, 'content': content})
|
'seed': seed, 'leech': leech, 'magnetlink': magnetlink.attrib['href'],
|
||||||
|
'template': 'torrent.html'})
|
||||||
return results
|
return results
|
||||||
|
@ -97,6 +97,11 @@ a:visited { color: #7b11be; }
|
|||||||
.image_result p span a { color: #FFFFFF; }
|
.image_result p span a { color: #FFFFFF; }
|
||||||
.image_result p:hover span a { display: block; position: absolute; bottom: 0; right: 0; padding: 4px; background-color: rgba(0, 0, 0, 0.6); font-size: 0.7em; }
|
.image_result p:hover span a { display: block; position: absolute; bottom: 0; right: 0; padding: 4px; background-color: rgba(0, 0, 0, 0.6); font-size: 0.7em; }
|
||||||
|
|
||||||
|
.torrent_result { border-left: 10px solid lightgray; padding-left: 3px; }
|
||||||
|
.torrent_result p { margin: 3px; font-size: 0.8em; }
|
||||||
|
|
||||||
|
.definition_result { border-left: 10px solid gray; padding-left: 3px; }
|
||||||
|
|
||||||
.percentage { position: relative; width: 300px; }
|
.percentage { position: relative; width: 300px; }
|
||||||
.percentage div { background: #444444; }
|
.percentage div { background: #444444; }
|
||||||
td { padding: 0 4px; }
|
td { padding: 0 4px; }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<div class="result">
|
<div class="result {{ result.class }}">
|
||||||
<h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
|
<h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
|
||||||
<p class="content">{% if result.content %}{{ result.content|safe }}<br />{% endif %}</p>
|
<p class="content">{% if result.content %}{{ result.content|safe }}<br />{% endif %}</p>
|
||||||
<p class="url">{{ result.pretty_url }}</p>
|
<p class="url">{{ result.pretty_url }}</p>
|
||||||
|
7
searx/templates/result_templates/torrent.html
Normal file
7
searx/templates/result_templates/torrent.html
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<div class="result torrent_result">
|
||||||
|
<h3 class="result_title"><a href="{{ result.url }}">{{ result.title|safe }}</a></h3>
|
||||||
|
<p class="content">{% if result.content %}{{ result.content|safe }}<br />{% endif %}</p>
|
||||||
|
<p class="stats">Seed: {{ result.seed }}, Leech: {{ result.leech }}</p>
|
||||||
|
<p><a href="{{ result.magnetlink }}" class="magnetlink">magnet link</a></p>
|
||||||
|
<p class="url">{{ result.pretty_url }}</p>
|
||||||
|
</div>
|
Loading…
Reference in New Issue
Block a user