diff --git a/static/extra.js b/static/extra.js index 255b01a..f9beb04 100644 --- a/static/extra.js +++ b/static/extra.js @@ -8,3 +8,15 @@ $(document).ready(function(){ $('input[name="after"]').jdPicker({}); $('input[name="before"]').jdPicker(); }) + +function addOpenSearch() +{ + if (window.external && ("AddSearchProvider" in window.external)) { + /* Build the url of the form http://host/osd.xml */ + var url = document.URL; + var prefix = RegExp("^https\?://[^/]*/").exec(url); + window.external.AddSearchProvider(prefix + "osd.xml"); + } else { + alert("Your browser does not support OpenSearch search plugins."); + } +} diff --git a/views/osd.tpl b/views/osd.tpl new file mode 100644 index 0000000..6581a5c --- /dev/null +++ b/views/osd.tpl @@ -0,0 +1,10 @@ + + + Recoll + Recoll + + {{url}}/static/recoll.png + UTF-8 + {{url}}/ + diff --git a/views/settings.tpl b/views/settings.tpl index 7c77c3f..3d24214 100644 --- a/views/settings.tpl +++ b/views/settings.tpl @@ -21,6 +21,10 @@ %for d in dirs: {{d}} %end +
+ Add to browser +
+ Register recoll into browser search engines


diff --git a/webui.py b/webui.py index 078ffea..fa29dc5 100755 --- a/webui.py +++ b/webui.py @@ -42,10 +42,10 @@ DEFAULTS = { # sort fields/labels SORTS = [ + ("relevancyrating", "Relevancy"), ("mtime", "Date",), ("url", "Path"), ("filename", "Filename"), - ("relevancyrating", "Relevancy"), ("fbytes", "Size"), ("author", "Author"), ] @@ -357,5 +357,13 @@ def set(): bottle.response.set_cookie(cookie_name, str(bottle.request.query.get('mount_%s' % d)), max_age=3153600000) bottle.redirect('./') #}}} +#{{{ osd +@bottle.route('/osd.xml') +@bottle.view('osd') +def main(): + #config = get_config() + url = bottle.request.urlparts + url = '%s://%s' % (url.scheme, url.netloc) + return {'url': url} #}}} # vim: fdm=marker:tw=80:ts=4:sw=4:sts=4:et