浏览代码

[enh] chrome opensearch support

asciimoo 11 年前
父节点
当前提交
174daf703b
共有 4 个文件被更改,包括 10 次插入6 次删除
  1. 3
    2
      searx/static/css/style.css
  2. 1
    1
      searx/templates/base.html
  3. 1
    1
      searx/templates/search.html
  4. 5
    2
      searx/webapp.py

+ 3
- 2
searx/static/css/style.css 查看文件

@@ -12,7 +12,7 @@ input { border: 2px solid #666666; color: #444444;  padding: 8px; background-col
12 12
 
13 13
 input[type="checkbox"] { visibility: hidden; }
14 14
 
15
-.checkbox_container { display: inline-block; position: relative; margin: 0; padding-left: 3px; margin: 0 10px; }
15
+.checkbox_container { display: inline-block; position: relative; padding-left: 3px; margin: 0 10px; }
16 16
 .checkbox_container label {
17 17
     cursor: pointer;
18 18
 }
@@ -53,8 +53,9 @@ input[type="checkbox"] { visibility: hidden; }
53 53
 
54 54
 a { text-decoration: none; }
55 55
 
56
-.result_title { margin-bottom: 0; }
57 56
 
57
+.result { margin-bottom: 16px; }
58
+.result_title { margin-bottom: 0; }
58 59
 .result p { margin-top: 0; padding-top: 0; font-size: 0.8em; max-width: 50em; }
59 60
 .result h3 { font-size: 0.9em;}
60 61
 .result { max-width: 70em; }

+ 1
- 1
searx/templates/base.html 查看文件

@@ -3,7 +3,7 @@
3 3
 <head>
4 4
     <meta http-equiv="content-type" content="text/html; charset=utf-8" />
5 5
     <meta http-equiv="content-language" content="en" />
6
-    <meta name="description" content="Searx - a hackable metasearch engine respecting privacy" />
6
+    <meta name="description" content="Searx - a privacy-respecting, hackable metasearch engine" />
7 7
     <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
8 8
     <title>searx {% block title %}{% endblock %}</title>
9 9
     <link rel="stylesheet" href="/static/css/style.css" type="text/css" media="screen" charset="utf-8" />

+ 1
- 1
searx/templates/search.html 查看文件

@@ -1,4 +1,4 @@
1
-<form method="post" action="">
1
+<form method="post" action="/">
2 2
     <input type="text" class="q" name="q" tabindex="1" autocomplete="off" {% if q %}value="{{ q }}"{% endif %}/>
3 3
     <input type="submit" value="search" />
4 4
     <p>

+ 5
- 2
searx/webapp.py 查看文件

@@ -37,7 +37,7 @@ opensearch_xml = '''<?xml version="1.0" encoding="utf-8"?>
37 37
   <Description>Search searx</Description>
38 38
   <InputEncoding>UTF-8</InputEncoding>
39 39
   <LongName>searx meta search engine</LongName>
40
-  <Url type="text/html" method="post" template="{host}">
40
+  <Url type="text/html" method="{method}" template="{host}">
41 41
     <Param name="q" value="{{searchTerms}}" />
42 42
   </Url>
43 43
 </OpenSearchDescription>
@@ -105,7 +105,10 @@ def fav():
105 105
 @app.route('/opensearch.xml', methods=['GET'])
106 106
 def opensearch():
107 107
     global opensearch_xml
108
-    ret = opensearch_xml.format(host=url_for('index', _external=True))
108
+    method = 'post'
109
+    if request.headers.get('User-Agent', '').lower().find('webkit') >= 0:
110
+        method = 'get'
111
+    ret = opensearch_xml.format(method=method, host=url_for('index', _external=True))
109 112
     resp = Response(response=ret,
110 113
                 status=200,
111 114
                 mimetype="application/xml")