Proxomitron Filters - Discussions welcome > Feature-Block

Strip Pre-HTML JavaScripts

(1/1)

sidki3003:
Hi all,

This one is a pendant to Scott's Post-HTML JS filter:

[Patterns]
Name = "Remove: Pre-HTML JavaScripts"
Active = TRUE
URL = "$TYPE(htm)(^$LST(Bypass_Ads))"
Bounds = "<script*</script>*<html>"
Limit = 1024
Match = "(#<script$INEST(<script,</script>)</script>)+#"
Replace = "@
<span class=prox style=display:none;>[PreScript killed]</span>$STOP()"

or without CSS and a Bypass Ads list:
URL = "$TYPE(htm)"
Replace = "@
[PreScript killed]$STOP()"

I haven't seen any ill effects yet but maybe i just missed the problematic sites .

edit: Bounds updated.

regards, sidki


Edited by - sidki3003 on 05 Jul 2002  22:18:54

sidki3003:
Updated, matches more often now.

[Patterns]
Name = "Remove: Pre-HTML JavaScripts (FBI)"
Active = TRUE
URL = "$TYPE(htm)(^$LST(Bypass_Ads))"
Bounds = "<script*</script*>*<html*>"
Limit = 2048
Match = "(#$NEST(<script,</script*>))+#"
Replace = "@
<span class=prox style=display:inline;>[PreScript killed]</span>$STOP()"

sidki


 

altosax:
hi all,
i've modified the sidki filter "Remove Pre-HTML JavaScripts" as follow:

Name = "Remove Pre-HTML JavaScripts"
Active = TRUE
URL = "$TYPE(htm)"
Bounds = "*<html*>"
Limit = 2048
Match = "(#$NEST(<script,</script*>))+#"
Replace = "@$STOP()"

this way the filter always matches, then always stops and will not be checked for the rest of page.

previous version of bounds did it match every time the <script> tag was encountered, but if it was not before the <html> tag the filter not stopped and its bounds continued to be checked for every <script> in the page.

also, modifying the bounds and making the filter always match, we have to renounce to the info [PreScript killed], but who cares ;)

if you apply this modify, you can also remove the line:

<!doctype*>$SET(1=)

from my managedtags.txt list, because everything is not a script before the <html> tag will be preserved by the new version of "Remove Pre-HTML JavaScripts".
this causes also a little improvement in filtering speed because every time the managedtags.txt list is scanned there will be a line in less to check.

NOTE: you have to place "Remove Pre-HTML JavaScripts" as your FIRST web filter following the ones matching <start>. For this filter that is the optimal position because it will match as soon as possible then it will be disabled.

let me know your comments and suggestions,
altosax.

 

sidki3003:
Altosax,

I like the idea of *<html*> bounds and use it in my current set (link below).
I don't like to protect the whole Pre-HTML code, since there can be more than scripts that's worth being filtered.

I leave this thread as is, since the filter is harmless and tested for quite a long while.
The successor is here, it's not harmless .

quote:
... we have to renounce to the info [PreScript killed], but who cares ;)
Me


Edited by - sidki3003 on 19 Aug 2002  17:17:56

Navigation

[0] Message Index

Go to full version