Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jean-Francois Dockes
recoll-webui
Commits
10809d70
Commit
10809d70
authored
Jul 14, 2013
by
Laurent Defert
Browse files
Add an 'Add to browser' option
parent
248b293d
Changes
4
Hide whitespace changes
Inline
Side-by-side
static/extra.js
View file @
10809d70
...
...
@@ -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.
"
);
}
}
views/osd.tpl
0 → 100644
View file @
10809d70
<?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>
views/settings.tpl
View file @
10809d70
...
...
@@ -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>
...
...
webui.py
View file @
10809d70
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment