address bar: :! to add example command line file web.js & web.sh

This commit is contained in:
James Feng Cao 2023-01-08 19:59:57 +08:00
parent aeec3960f5
commit cd87cc793c
6 changed files with 63 additions and 31 deletions

15
en/searchurl/txt/web.js Normal file
View file

@ -0,0 +1,15 @@
let ess = {};
ess["g"]=["https://google.com/search?q=",];
ess["v"]=["https://www.youtube.com/results?search_query=",];
ess["b"]=["http://www.bing.com/search?q=",];
ess["w"]=["https://encyclopedia.thefreedictionary.com/",];
let url=arguments[1];
let iS1 = url.search(/ [^ ]/);
let iS2 = url.indexOf(' ',iS1+2);
let name = url.substring(iS1+1,iS2)
let keywords = url.substring(iS2+1);
let es = ess[name];
if(es){
location.href=es[0]+keywords;
}

35
en/searchurl/txt/web.sh Executable file
View file

@ -0,0 +1,35 @@
#!/usr/bin/dash
#usage: g [engine] word1 word2 ...
default=''
g="https://www.google.com.hk/search?q="
yt="https://www.youtube.com/results?search_query="
m="http://www.merriam-webster.com/dictionary/"
w="http://en.wikipedia.org/wiki/"
wd="https://en.wiktionary.org/wiki/"
b="http://www.bing.com/search?intlF=1&q="
ks="http://www.iciba.com/"
en="http://www.enacademic.com/searchall.php?SWord="
gen="http://gen.lib.rus.ec/search.php?req="
abb="http://audiobookbay.li/?s="
bd="https://www.baidu.com/s?wd="
gb="https://www.gigablast.com/search?q="
yd="http://dict.youdao.com/search?q="
a="http://www.amazon.com/s?url=search-alias%3Daps&field-keywords="
bdic="http://cn.bing.com/dict/search?q="
be="http://www.britannica.com/search?query="
u="http://www.urbandictionary.com/define.php?term="
o="http://en.oxforddictionaries.com/definition/"
eval engine=\$${1:-default} #engine=$(eval echo \${$1})
shift #concate second argument to the last one with +
string=$1
shift
for a in "$@"
do
string+="+$a"
done
echo $engine$string