summaryrefslogtreecommitdiff
path: root/searx
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2014-05-09 02:04:20 +0200
committerAdam Tauber <asciimoo@gmail.com>2014-05-09 02:04:20 +0200
commit5d9d04a16e0becad65b55351503b8a015551847b (patch)
tree316e4b586ba34f3d344b92397d73f5643ef0e486 /searx
parent58de2801ce83c0ec7d6f52405254c776c4b68fb3 (diff)
downloadsearxng-5d9d04a16e0becad65b55351503b8a015551847b.tar.gz
searxng-5d9d04a16e0becad65b55351503b8a015551847b.zip
[enh] better highlighting
Diffstat (limited to 'searx')
-rw-r--r--searx/static/css/style.css2
-rw-r--r--searx/static/less/definitions.less3
-rw-r--r--searx/static/less/style.less8
-rw-r--r--searx/utils.py4
4 files changed, 14 insertions, 3 deletions
diff --git a/searx/static/css/style.css b/searx/static/css/style.css
index 89d55b229..64ea51947 100644
--- a/searx/static/css/style.css
+++ b/searx/static/css/style.css
@@ -48,6 +48,8 @@ a{text-decoration:none;color:#1a11be}a:visited{color:#8e44ad}
.right{float:right}
.invisible{display:none}
.left{float:left}
+.highlight{color:#094089}
+.content .highlight{color:#000}
.image_result{float:left;margin:10px 10px;position:relative;height:160px}.image_result img{border:0;height:160px}
.image_result p{margin:0;padding:0}.image_result p span a{display:none;color:#fff}
.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:.7em}
diff --git a/searx/static/less/definitions.less b/searx/static/less/definitions.less
index d957422d7..3e0b6579d 100644
--- a/searx/static/less/definitions.less
+++ b/searx/static/less/definitions.less
@@ -9,7 +9,8 @@
@color-base: #3498DB;
@color-base-dark: #2980B9;
@color-base-light: #ECF0F1;
-
+@color-highlight: #094089;
+@color-black: #000000;
/// General
diff --git a/searx/static/less/style.less b/searx/static/less/style.less
index 62f3899ec..469c6fc12 100644
--- a/searx/static/less/style.less
+++ b/searx/static/less/style.less
@@ -273,6 +273,14 @@ a {
float: left;
}
+.highlight {
+ color: @color-highlight;
+}
+
+.content .highlight {
+ color: @color-black;
+}
+
.image_result {
float: left;
margin: 10px 10px;
diff --git a/searx/utils.py b/searx/utils.py
index 1e48e37ee..e881a8b14 100644
--- a/searx/utils.py
+++ b/searx/utils.py
@@ -28,7 +28,7 @@ def highlight_content(content, query):
query = query.decode('utf-8')
if content.lower().find(query.lower()) > -1:
query_regex = u'({0})'.format(re.escape(query))
- content = re.sub(query_regex, '<b>\\1</b>', content, flags=re.I | re.U)
+ content = re.sub(query_regex, '<span class="highlight">\\1</span>', content, flags=re.I | re.U)
else:
regex_parts = []
for chunk in query.split():
@@ -37,7 +37,7 @@ def highlight_content(content, query):
else:
regex_parts.append(u'{0}'.format(re.escape(chunk)))
query_regex = u'({0})'.format('|'.join(regex_parts))
- content = re.sub(query_regex, '<b>\\1</b>', content, flags=re.I | re.U)
+ content = re.sub(query_regex, '<span class="highlight">\\1</span>', content, flags=re.I | re.U)
return content