opensearch for firefox
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 8 Feb 2011 11:45:45 +0000 (12:45 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Tue, 8 Feb 2011 11:45:45 +0000 (12:45 +0100)
apps/catalogue/views.py
wolnelektury/static/img/favicon.ico [new file with mode: 0644]
wolnelektury/static/img/favicon.png
wolnelektury/static/img/wl_icon_64.png [new file with mode: 0644]
wolnelektury/static/opensearch.xml
wolnelektury/templates/base.html

index a6f394f..7f1de6d 100644 (file)
@@ -491,13 +491,14 @@ def json_tags_starting_with(request, callback=None):
     if len(prefix) < 2:
         return HttpResponse('')
     tags_list = []
-    result = ""   
     for tag in _tags_starting_with(prefix, request.user):
         if not tag.name in tags_list:
-            result += "\n" + tag.name
             tags_list.append(tag.name)
-    dict_result = {"matches": tags_list}
-    return JSONResponse(dict_result, callback)
+    if request.GET.get('mozhint', ''):
+        result = [prefix, tags_list]
+    else:
+        result = {"matches": tags_list}
+    return JSONResponse(result, callback)
 
 # ====================
 # = Shelf management =
diff --git a/wolnelektury/static/img/favicon.ico b/wolnelektury/static/img/favicon.ico
new file mode 100644 (file)
index 0000000..3f2aacc
Binary files /dev/null and b/wolnelektury/static/img/favicon.ico differ
index 6cffce8..9794f35 100644 (file)
Binary files a/wolnelektury/static/img/favicon.png and b/wolnelektury/static/img/favicon.png differ
diff --git a/wolnelektury/static/img/wl_icon_64.png b/wolnelektury/static/img/wl_icon_64.png
new file mode 100644 (file)
index 0000000..a9dded3
Binary files /dev/null and b/wolnelektury/static/img/wl_icon_64.png differ
index 7a319f1..9cc0565 100644 (file)
@@ -1,12 +1,19 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
+<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
+        xmlns:moz="http://www.mozilla.org/2006/browser/search/">
     <ShortName>Wolne Lektury</ShortName>
     <Description>WolneLektury.pl, szkolna biblioteka internetowa.</Description>
+    <InputEncoding>UTF-8</InputEncoding>
     <Tags>lektury</Tags>
     <Developer>Fundacja Nowoczesna Polska</Developer>
     <Language>pl</Language>
     <Contact>fundacja@nowoczesnapolska.org.pl</Contact>
+    <Image height="16" width="16" type="image/x-icon">http://www.wolnelektury.pl/static/img/favicon.ico</Image>
+    <Image height="64" width="64" type="image/png">http://www.wolnelektury.pl/static/img/wl_icon_64.png</Image>
     <Url type="application/atom+xml;profile=opds-catalog"
         template="http://www.wolnelektury.pl/opds/search/?q={searchTerms}" />
+    <Url type="text/html" method="GET" template="http://www.wolnelektury.pl/katalog/szukaj?q={searchTerms}" />
+    <Url type="application/x-suggestions+json" method="GET" template="http://www.wolnelektury.pl/katalog/jtags?mozhint=1&amp;q={searchTerms}" />
+    <moz:SearchForm>http://www.wolnelektury.pl/katalog/</moz:SearchForm>
     <Query role="example" searchTerms="sÅ‚owa" />
 </OpenSearchDescription>
index 3e2678d..8aaabf1 100644 (file)
@@ -6,7 +6,8 @@
         <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
         <meta http-equiv="Content-Style-Type" content="text/css">
         <title>{% block title %}WolneLektury.pl{% endblock %}</title>
-        <link rel="icon" href="{{ STATIC_URL }}img/favicon.png" type="image/x-icon" />
+        <link rel="icon" href="{{ STATIC_URL }}img/favicon.png" type="image/png" />
+        <link rel="search" type="application/opensearchdescription+xml" title="Wolne Lektury" href="{{ STATIC_URL }}opensearch.xml">
         {% compressed_css "all" %}
         <script type="text/javascript">var LANGUAGE_CODE = "{{ LANGUAGE_CODE }}";</script>
         {% compressed_js "jquery" %}