Commit 30c33c89 authored by koniu's avatar koniu
Browse files

Merge pull request #10 from biolds/master

'Add to browser' option, sort by relevancy by default
parents 248b293d f74d7ea7
......@@ -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.");
}
}
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Recoll</ShortName>
<Description>Recoll</Description>
<Url type="text/html" template="{{url}}/results?query={searchTerms}"/>
<Image width="48" height="48">{{url}}/static/recoll.png</Image>
<InputEncoding>UTF-8</InputEncoding>
<moz:SearchForm>{{url}}/</moz:SearchForm>
</OpenSearchDescription>
......@@ -21,6 +21,10 @@
%for d in dirs:
<small>{{d}}</small><input name="mount_{{d}}" value={{mounts[d]}}>
%end
<hr>
<b>Add to browser</b>
<br>
<a href="#" onClick="addOpenSearch();return false">Register recoll into browser search engines</a>
<br><br><hr>
<input type="submit" value="Save">
<a href="./"><input type="button" value="Cancel"></a>
......
......@@ -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
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment