Only crunches Content-Length header if applying RE filtering.
[privoxy.git] / re_filterfile
1 # Filterfile for the Regular Substitution Module
2 #
3 # Syntax: One Perl-Style substitution per line.
4 # For Details see the perlre, perlop and pcre manpages.
5 # Note that you are free to choose the delimter as you
6 # see fit.
7 #
8 # Note: in addidion to the Perl-options egimosx, U is supported
9 # and turns the default to ungreedy matching. Add ? to quantifiers
10 # to switch back to greedy.
11 #
12
13 # Kill OnUnload popups. Yummy.
14 # check it out on http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html
15 #
16 s/(<body .*?)onunload(.*?>)/$1never$2/i
17
18 # Kill refresh tags. I like to refresh myself. Manually.
19 # check it out on http://www.airport-cgn.de/ and go to the arrivals page.
20 #
21 s/<meta[^>]*http-equiv[^>]*refresh[^>]*>/<!--no refresh for me-->/i
22 s/<meta[^>]*http-equiv="?page-enter"?[^>]*content=[^>]*>/<!--no page enter for me-->/i
23
24 # If I allow popups, I want them to be rezizable and have a location and status bar:
25 # check it out on http://www.airport-cgn.de/ and go to the arrivals page.
26 #
27 s/resizable="?(no|0)"?/resizable=1/ig
28 s/noresize/yesresize/ig
29 s/location="?(no|0)"?/location=1/ig
30 s/status="?(no|0)"?/status=1/ig
31 s/scrolling="?(no|0|Auto)"?/scrolling=1/ig
32 s/menubar="?(no|0)"?/menubar=1/ig
33 #s/framespacing="?(no|0)"?//ig
34 #s/margin(height|width)=[0-9]*//gi
35
36 # Remove frameborder=0 and border=0 from framesets
37 #
38 s/(<frameset[^>]+?)border=['"]?(no|0)['"]?/$1/ig
39 s/(<frameset[^>]+?)frameborder=['"]?(no|0)['"]?/$1/ig
40
41 # The status bar is for displaying link targets, not pointless buzzwords.
42 # Again, check it out on http://www.airport-cgn.de/
43 #
44 s/status='.*?';*//ig
45
46 # Kill *all* popups a la popup.c. (But for *all* sites, so I wouldn't do that.)
47 #
48 # JavaScript: s/window\.open\(/who_wants_this_to.open(/ig
49 # HTML      : s/target=['"]?_blank['"]?/target_who/g
50
51 # Kill banners by size:
52 # (Sizes from http://www.iab.net/iab_banner_standards/bannersizes.html)
53 #
54 s|<img [^>]*?(width=['"]?468\D)[^>]*(height=['"]?60\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
55 s|<img [^>]*?(width=['"]?234\D)[^>]*(height=['"]?60\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
56 s|<img [^>]*?(width=['"]?88\D)[^>]*(height=['"]?31\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
57 s|<img [^>]*?(width=['"]?120\D)[^>]*(height=['"]?90\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
58 s|<img [^>]*?(width=['"]?120\D)[^>]*(height=['"]?60\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
59 s|<img [^>]*?(width=['"]?160\D)[^>]*(height=['"]?600\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
60 s|<img [^>]*?(width=['"]?120\D)[^>]*(height=['"]?600\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
61 s|<img [^>]*?(width=['"]?125\D)[^>]*(height=['"]?125\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
62 s|<img [^>]*?(width=['"]?120\D)[^>]*(height=['"]?240\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
63 s|<img [^>]*?(width=['"]?180\D)[^>]*(height=['"]?150\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
64 s|<img [^>]*?(width=['"]?300\D)[^>]*(height=['"]?250\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
65 s|<img [^>]*?(width=['"]?250\D)[^>]*(height=['"]?250\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
66 s|<img [^>]*?(width=['"]?240\D)[^>]*(height=['"]?400\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
67 s|<img [^>]*?(width=['"]?336\D)[^>]*(height=['"]?280\D).*?>|<img src=http://no.where/ijb-send-banner.gif $1 $2>|ig
68
69 # Squish WebBugs:
70 #
71 s/<img [^>]*?(width|height) *= *['"]?1\D[^>]*?(width|height) *= *['"]?1\D.*?>/<!-- Squished WebBug -->/ig
72
73 # Fun stuff:
74 #
75 s/microsoft(?!.com)/<b>MicroSuck<\/b>/ig
76
77 # Crude parental filtering?  (Use along with a suitable blocklist).
78 # Shows how to deny access to whole page based on a keyword.
79 #
80 # (Note: Middlesex, Sussex and Essex are counties in the UK, not rude words)
81 # (Note #2: Is 'sex' a rude word?!)
82 #
83 #s%^.*(?<!middle)(?<!sus)(?<!es)sex.*$%<html><head><title>Blocked</title></head><body><h3>Blocked due to possible adult content. Please see <a href="http://dmoz.org/Kids_and_Teens/">this site</a>.</h3></body></html>%is
84 #s+^.*warez.*$+<html><head><title>No Warez</title></head><body><h3>You're not searching for illegal stuff, are you?</h3></body></html>+is
85
86 # http://www.farscapezone.com/wwwboard/messages/1451.html
87 s/(\w+) was tired/<b>$1 needed more coffee<\/b>/ig
88
89 # I'm sure you'll find more uses.
90 # Please send your cool additions to junkbuster-users@yahoogroups.com