Unification. Removed trailing '\n' from last line.
[elinks/kon.git] / contrib / python / hooks.py
blob03e4585ef294c3ef74372e212580df316e2f5ae4
1 import re
3 dumbprefixes = {
4 "7th" : "http://7thguard.net/",
5 "b" : "http://babelfish.altavista.com/babelfish/tr",
6 "bz" : "http://bugzilla.elinks.cz",
7 "bug" : "http://bugzilla.elinks.cz",
8 "d" : "http://www.dict.org",
9 "g" : "http://www.google.com/",
10 "gg" : "http://www.google.com/",
11 "go" : "http://www.google.com/",
12 "fm" : "http://www.freshmeat.net/",
13 "sf" : "http://www.sourceforge.net/",
14 "dbug" : "http://bugs.debian.org/",
15 "dpkg" : "http://packages.debian.org/",
16 "pycur" : "http://www.python.org/doc/current/",
17 "pydev" : "http://www.python.org/dev/doc/devel/",
18 "pyhelp" : "http://starship.python.net/crew/theller/pyhelp.cgi",
19 "pyvault" : "http://www.vex.net/parnassus/",
20 "e2" : "http://www.everything2.org/",
21 "sd" : "http://www.slashdot.org/"
24 def goto_url_hook(url, current_url):
25 global dumbprefixes
27 if dumbprefixes.has_key(url):
28 return dumbprefixes[url];
29 else:
30 return None
32 def follow_url_hook(url):
33 return None
35 def pre_format_html_hook(url, html):
36 if re.search("cygwin\.com", url):
37 html2 = re.sub("<body bgcolor=\"#000000\" color=\"#000000\"", "<body bgcolor=\"#ffffff\" color=\"#000000\"", html)
38 return html2
39 if re.search("https://www.mbank.com.pl/ib_navibar_3.asp", url):
40 html2 = re.sub("<td valign=\"top\"><img", "<tr><td valign=\"top\"><img", html)
41 return html2
42 return None
44 def proxy_for_hook(url):
45 return None
47 def quit_hook():
48 return None