ability to choose if query should (not) be urlencoded
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
11c515586d
commit
5ceffc07ce
|
@ -8,9 +8,9 @@ yt: https://www.youtube.com/results?search_query=%s
|
||||||
vimeo: https://vimeo.com/search?q=%s
|
vimeo: https://vimeo.com/search?q=%s
|
||||||
|
|
||||||
# Dictionaries
|
# Dictionaries
|
||||||
jisho: https://jisho.org/search/%s
|
jisho: https://jisho.org/search/%S
|
||||||
lide: https://de.linguee.com/deutsch-englisch/search?query=%s
|
lide: https://de.linguee.com/deutsch-englisch/search?query=%s
|
||||||
duden: https://www.duden.de/suchen/dudenonline/%s
|
duden: https://www.duden.de/suchen/dudenonline/%S
|
||||||
|
|
||||||
# Package search
|
# Package search
|
||||||
alpine: https://pkgs.alpinelinux.org/packages?name=%s&arch=x86_64
|
alpine: https://pkgs.alpinelinux.org/packages?name=%s&arch=x86_64
|
||||||
|
@ -34,7 +34,7 @@ ebay: https://www.ebay.com/sch/i.html?_nkw=%s
|
||||||
ebayde: https://www.ebay.de/sch/i.html?_nkw=%s
|
ebayde: https://www.ebay.de/sch/i.html?_nkw=%s
|
||||||
|
|
||||||
# Archive.org
|
# Archive.org
|
||||||
wayback: https://web.archive.org/web/*/%s
|
wayback: https://web.archive.org/web/*/%S
|
||||||
|
|
||||||
# Music
|
# Music
|
||||||
bc: https://bandcamp.com/search?q=%s
|
bc: https://bandcamp.com/search?q=%s
|
||||||
|
|
|
@ -46,7 +46,9 @@ func loadBangs() (bangs map[string]string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildSearchURL(template string, query string) (searchUrl string) {
|
func buildSearchURL(template string, query string) (searchUrl string) {
|
||||||
return strings.Replace(template, "%s", url.QueryEscape(query), 1)
|
searchUrl = strings.Replace(template, "%s", url.QueryEscape(query), 1)
|
||||||
|
searchUrl = strings.Replace(template, "%S", query, 1)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseBang(searchQuery string) (bang string, query string) {
|
func parseBang(searchQuery string) (bang string, query string) {
|
||||||
|
|
|
@ -32,7 +32,7 @@ fetch('https://s3.sbruder.de/cdn/bangs/bangs.json')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parsedBang !== null) {
|
if (parsedBang !== null) {
|
||||||
redirectURL = bangs[parsedBang.bang].replace('%s', parsedBang.query)
|
redirectURL = bangs[parsedBang.bang].replace('%s', encodeURI(parsedBang.query)).replace('%S', parsedBang.query)
|
||||||
window.location.replace(redirectURL);
|
window.location.replace(redirectURL);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue