1 # ********************************************************************
3 # File : $Source: /cvsroot/ijbswa/current/re_filterfile,v $
5 # Purpose : Rules to process the content of web pages
7 # Copyright : Written by and Copyright (C) 2001 the SourceForge
8 # IJBSWA team. http://ijbswa.sourceforge.net
10 # Based on the Internet Junkbuster originally written
11 # by and Copyright (C) 1997 Anonymous Coders and
12 # Junkbusters Corporation. http://www.junkbusters.com
14 # This program is free software; you can redistribute it
15 # and/or modify it under the terms of the GNU General
16 # Public License as published by the Free Software
17 # Foundation; either version 2 of the License, or (at
18 # your option) any later version.
20 # This program is distributed in the hope that it will
21 # be useful, but WITHOUT ANY WARRANTY; without even the
22 # implied warranty of MERCHANTABILITY or FITNESS FOR A
23 # PARTICULAR PURPOSE. See the GNU General Public
24 # License for more details.
26 # The GNU General Public License should be included with
27 # this file. If not, you can view it at
28 # http://www.gnu.org/copyleft/gpl.html
29 # or write to the Free Software Foundation, Inc., 59
30 # Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 # $Log: re_filterfile,v $
34 # Revision 1.6 2001/06/09 14:01:57 swa
35 # header. cosmetics. default: no messing ala microsuck.
39 # ********************************************************************/
41 # Syntax: One Perl-Style substitution per line.
42 # For Details see the perlre, perlop and pcre manpages.
43 # Note that you are free to choose the delimter as you see fit.
45 # Note: in addidion to the Perl-options egimosx, U is supported
46 # and turns the default to ungreedy matching. Add ? to quantifiers
47 # to switch back to greedy.
50 # ********************************************************************/
52 # Kill OnUnload popups. Yummy.
53 # check it out on http://www.zdnet.com/zdsubs/yahoo/tree/yfs.html
55 # ********************************************************************/
56 s/(<body .*?)onunload(.*?>)/$1never$2/i
58 # ********************************************************************/
60 # Kill refresh tags. I like to refresh myself. Manually.
61 # check it out on http://www.airport-cgn.de/ and go to the arrivals page.
63 # ********************************************************************/
64 s/<meta[^>]*http-equiv[^>]*refresh.*URL=([^>]*?)"?>/<link rev="x-refresh" href=$1>/i
65 s/<meta[^>]*http-equiv="?page-enter"?[^>]*content=[^>]*>/<!--no page enter for me-->/i
67 # ********************************************************************/
69 # If I allow popups, I want them to be resizeable and have a location
70 # and status bar: check it out on http://www.airport-cgn.de/ and go to
73 # ********************************************************************/
74 # s/resizable="?(no|0)"?/resizable=1/ig s/noresize/yesresize/ig
75 # s/location="?(no|0)"?/location=1/ig s/status="?(no|0)"?/status=1/ig
76 # s/scrolling="?(no|0|Auto)"?/scrolling=1/ig
77 # s/menubar="?(no|0)"?/menubar=1/ig #s/framespacing="?(no|0)"?//ig
78 # #s/margin(height|width)=[0-9]*//gi
80 # ********************************************************************/
82 # Remove frameborder=0 and border=0 from framesets
84 # ********************************************************************/
85 s/(<frameset[^>]+?)border=['"]?(no|0)['"]?/$1/ig
86 s/(<frameset[^>]+?)frameborder=['"]?(no|0)['"]?/$1/ig
88 # ********************************************************************/
90 # The status bar is for displaying link targets, not pointless buzzwords.
91 # Again, check it out on http://www.airport-cgn.de/
93 # ********************************************************************/
96 # ********************************************************************/
98 # Kill *all* popups a la popup.c. (But for *all* sites, so I wouldn't do that.)
100 # JavaScript: s/window\.open\(/who_wants_this_to.open(/ig
101 # HTML : s/target=['"]?_blank['"]?/target_who/g
103 # Kill banners by size:
104 # (Sizes from http://www.iab.net/iab_banner_standards/bannersizes.html)
106 # ********************************************************************/
107 s|<img\s+[^>]*?(width=['"]?468\D)[^>]*(height=['"]?60\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
108 s|<img\s+[^>]*?(width=['"]?234\D)[^>]*(height=['"]?60\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
109 s|<img\s+[^>]*?(width=['"]?88\D)[^>]*(height=['"]?31\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
110 s|<img\s+[^>]*?(width=['"]?120\D)[^>]*(height=['"]?90\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
111 s|<img\s+[^>]*?(width=['"]?120\D)[^>]*(height=['"]?60\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
112 s|<img\s+[^>]*?(width=['"]?160\D)[^>]*(height=['"]?600\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
113 s|<img\s+[^>]*?(width=['"]?120\D)[^>]*(height=['"]?600\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
114 s|<img\s+[^>]*?(width=['"]?125\D)[^>]*(height=['"]?125\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
115 s|<img\s+[^>]*?(width=['"]?120\D)[^>]*(height=['"]?240\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
116 s|<img\s+[^>]*?(width=['"]?180\D)[^>]*(height=['"]?150\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
117 s|<img\s+[^>]*?(width=['"]?300\D)[^>]*(height=['"]?250\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
118 s|<img\s+[^>]*?(width=['"]?250\D)[^>]*(height=['"]?250\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
119 s|<img\s+[^>]*?(width=['"]?240\D)[^>]*(height=['"]?400\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
120 s|<img\s+[^>]*?(width=['"]?336\D)[^>]*(height=['"]?280\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
122 s|<img\s+[^>]*?(width=['"]?200\D)[^>]*(height=['"]?50\D)[^>]*>|<img src=http://i.j.b/send-banner $1 $2>|sig
124 # ********************************************************************/
128 # ********************************************************************/
129 s/<img\s+[^>]*?(width|height)\s+=\s+['"]?1\D[^>]*?(width|height)\s+=\s+['"]?1\D[^>]*>/<!-- Squished WebBug -->/sig
131 # ********************************************************************/
135 # ********************************************************************/
136 s/microsoft(?!.com)/MicroSuck/ig
138 # ********************************************************************/
140 # Crude parental filtering? (Use along with a suitable blocklist).
141 # Shows how to deny access to whole page based on a keyword.
143 # (Note: Middlesex, Sussex and Essex are counties in the UK, not rude words)
144 # (Note #2: Is 'sex' a rude word?!)
146 #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
147 #s+^.*warez.*$+<html><head><title>No Warez</title></head><body><h3>You're not searching for illegal stuff, are you?</h3></body></html>+is
149 # ********************************************************************/
151 # http://www.farscapezone.com/wwwboard/messages/1451.html
153 # ********************************************************************/
154 s/(\w+) was tired/<b>$1 needed more coffee<\/b>/ig