1
/* Classic, table-based smartprefixes. */
3
var loaded_smartprefixes_common_code;
4
if (!loaded_smartprefixes_common_code) {
5
do_file(elinks.home + "smartprefixes_common.js");
6
loaded_smartprefixes_common_code = 1;
10
arc: "http://web.archive.org/web/*/%s",
11
binsearch: "http://binsearch.info/?q=%s",
12
bug: function (url) { return bugzilla('http://bugzilla.elinks.cz/', url) },
13
cambridge: "http://dictionary.cambridge.org/results.asp?searchword=%s",
14
cliki: "http://www.cliki.net/admin/search?words=%s",
15
// If you want to add a smartprefix for another project's CVSweb,
16
// just create a lambda like this. Aren't high-level languages fun?
17
cvs: function (x) { return cvsweb ("http://cvsweb.elinks.cz/cvsweb.cgi/", "elinks", x) },
18
gitweb: function (x) { return gitweb("http://pasky.or.cz/gitweb.cgi", "elinks.git", x) },
19
d: "http://www.dict.org/bin/Dict?Query=%s&Form=Dict1&Strategy=*&Database=*&submit=Submit+query",
20
debcontents: debian_contents,
22
dix: "http://dix.osola.com/?search=%s",
23
dmoz: "http://search.dmoz.org/cgi-bin/search?search=%s",
24
foldoc: "http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?%s",
25
g: "http://www.google.com/search?q=%s&btnG=Google+Search",
26
gd: "http://www.google.com/search?q=%s&cat=gwd/Top",
27
// Whose idea was it to use 'gg' for websearches? -- Miciah
28
//gg: "http://groups.google.com/groups?q=%s",
29
gi: "http://images.google.com/images?q=%s",
31
gn: "http://news.google.com/news?q=%s",
32
go: "http://www.google.com/search?q=%s&btnG=Google+Search",
33
gwho: "http://www.googlism.com/?ism=%s&name=1",
34
gwhat: "http://www.googlism.com/?ism=%s&name=2",
35
gwhere: "http://www.googlism.com/?ism=%s&name=3",
36
gwhen: "http://www.googlism.com/?ism=%s&name=4",
37
fm: "http://www.freshmeat.net/search/?q=%s",
38
savannah: "http://savannah.nongnu.org/search/?words=%s&type_of_search=soft&exact=1",
39
sf: "http://sourceforge.net/search/?q=%s",
40
sfp: "http://sourceforge.net/projects/%s",
41
sd: "http://www.slashdot.org/search.pl?query=%s",
42
sdc: "http://www.slashdot.org/search.pl?query=%s&op=comments",
43
sdu: "http://www.slashdot.org/search.pl?query=%s&op=users",
44
sdp: "http://www.slashdot.org/search.pl?query=%s&op=polls",
45
sdj: "http://www.slashdot.org/search.pl?query=%s&op=journals",
46
dbug: "http://bugs.debian.org/%s",
47
dix: "http://dix.osola.com/index.de.php?trans=1&search=%s",
48
dixgram: "http://dix.osola.com/v.php?language=german&search=%s",
49
dpkg: "http://packages.debian.org/%s",
50
emacs: "http://www.emacswiki.org/cgi-bin/wiki.pl?search=%s",
51
lyrics: "http://music.lycos.com/lyrics/results.asp?QT=L&QW=%s",
52
lxr: "http://lxr.linux.no/ident?i=%s",
53
leo: "http://dict.leo.org/?search=%s",
54
nclaw: "http://www.ncleg.net/gascripts/Statutes/StatutesSearch.asp?searchScope=All&searchCriteria=%s&returnType=Section",
55
onelook: "http://onelook.com/?w=%s&ls=a",
56
py: "http://starship.python.net/crew/theller/pyhelp.cgi?keyword=%s&version=current",
57
pydev: "http://starship.python.net/crew/theller/pyhelp.cgi?keyword=%s&version=devel",
58
pyvault: "http://py.vaults.ca/apyllo.py?find=%s",
59
e2: "http://www.everything2.org/?node=%s",
60
encz: "http://www.slovnik.cz/bin/ecd?ecd_il=1&ecd_vcb=%s&ecd_trn=translate&ecd_trn_dir=0&ecd_lines=15&ecd_hptxt=0",
61
czen: "http://www.slovnik.cz/bin/ecd?ecd_il=1&ecd_vcb=%s&ecd_trn=translate&ecd_trn_dir=1&ecd_lines=15&ecd_hptxt=0",
62
dict: "http://dictionary.reference.com/search?q=%s",
63
thes: "http://thesaurus.reference.com/search?q=%s",
64
a: "http://acronymfinder.com/af-query.asp?String=exact&Acronym=%s",
65
imdb: "http://imdb.com/Find?%s",
66
mw: "http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=%s",
67
mwt: "http://www.m-w.com/cgi-bin/thesaurus?book=Thesaurus&va=%s",
68
whatis: "http://uptime.netcraft.com/up/graph/?host=%s",
69
wiki: "http://en.wikipedia.org/w/wiki.phtml?search=%s",
70
wikide: "http://de.wikipedia.org/w/wiki.phtml?search=%s",
71
wn: "http://www.cogsci.princeton.edu/cgi-bin/webwn1.7.1?stage=1&word=%s",
73
rfc: "http://www.rfc-editor.org/rfc/rfc%s.txt",
75
rfcs: "http://www.rfc-editor.org/cgi-bin/rfcsearch.pl?searchwords=%s&format=http&abstract=abson&keywords=keyon&num=25",
76
cr: "http://www.rfc-editor.org/cgi-bin/rfcsearch.pl?searchwords=%s&format=http&abstract=abson&keywords=keyon&num=25",
77
// Internet Draft search
78
rfcid: "http://www.rfc-editor.org/cgi-bin/idsearch.pl?searchwords=%s&format=http&abstract=abson&keywords=keyon&num=25",
79
urbandict: "http://www.urbandictionary.com/define.php?term=%s",
80
id: "http://www.rfc-editor.org/cgi-bin/idsearch.pl?searchwords=%s&format=http&abstract=abson&keywords=keyon&num=25",
81
draft: "http://www.rfc-editor.org/cgi-bin/idsearch.pl?searchwords=%s&format=http&abstract=abson&keywords=keyon&num=25",
84
function rewrite_uri_classic(uri) {
85
var parts = uri.split(" ");
86
var prefix = parts[0];
87
var rest = parts.slice(1).join(" ");
88
var rule = smartprefixes[prefix];
91
if (typeof(rule) == 'string')
92
return rule.replace(/%s/, escape(rest));
94
if (typeof(rule) == 'function')
97
elinks.alert('smartprefix[' + prefix + ']'
98
+ ' has unsupported type "' + t + '".');
102
elinks.goto_url_hooks.push(rewrite_uri_classic);