Sep. 28, 2008, 11:23 PM
I noticed that using only $TYPE(htm) i had proxomitron very slow, the reason was proxomitron was searching in other files with a extension different to htm, maybe php or javascript files without .js extension.
So looking for a speed improvement i decided to divide my filters in various groups depending if they match before <html>, between <html> and </html> or after </html>. This is a work in progress, so i post them here for suggests. Here are the filters to define the zones.
What each filter does is now autoexplained in its title. The format is 0: to clean a variable and 1: to enable it
_____________________________________________
After that, i made 2 big groups of filters:
-filters that match before <html> or after </html>
The filters added to this group needs to have added $TST(V_PreHtml=1) or $TST(V_PostHtml=1)
-filters that match between <html> and </html>
Adding $TST(V_Html=1)
To not make your filters slower, it's better if the filter fails before the $TST. So dont put the $TST() at the beginning, put it later and not after an asterisc. The reason is because the $TST() is slow.
If your filter is not very complex you can put the test just at the end. But if the filter is more complex and searchs in lists maybe would be better to put the $TST before the $LST.
You can read about it in the help:
http://www.proxomitron.info/45/help/Matc...s.html#TST
I'm testing it for a while and it gives me very good results. If you use them, remember to remove the test for the zone when you go to the test window, or it will never match there :/
I don't know if maybe sidky already uses that in his filters. If yes please tell me.
Hope you like them ;)
For testing purposes i post here my filters for offsite scripts and noscripts placed in pre-html and post-html zones.
You can test in geocities, for example in the web of sidki
http://www.geocities.com/sidki3003/prox-news.html
Note: I need to improve the test for offsite cause it fails in other sites...
So looking for a speed improvement i decided to divide my filters in various groups depending if they match before <html>, between <html> and </html> or after </html>. This is a work in progress, so i post them here for suggests. Here are the filters to define the zones.
Code:
[Patterns]
Name = "############## DEFINE PARTS OF HTML ###########################################"
Active = FALSE
URL = "^?"
Limit = 256
Match = "<never>"
Replace = "Be careful here. When you comment a line, don't use extrange caracters like - inside."
"The <start> filters break some webs, so we will use </head>"
Name = "/¯¯¯¯¯Begin HTML file¯¯¯¯¯ [1:V_PreHtml] {ln}080929"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 50
Match = "<start>"
Replace = "$SET(V_PreHtml=1)$SET(V_Html=)"
"$STOP()"
Name = "| /¯¯¯<html>¯¯¯¯¯SaveFrom[1:V_Html; ?&0:V_PreHtml] {ln}081010"
Active = TRUE
URL = "$TYPE(htm)"
Bounds = "$NEST(<,>)"
Limit = 300
Match = "(<(!DOCTYPE |)html*>)\1"
"$TST(V_PreHtml=1)"
Replace = "$SET(V_PreHtml=)$SET(V_Html=1)"
"<! Saved the $DTM(d) from \u > \r\n"
"\1$STOP()"
Name = "| /¯¯¯head [1:V_Head] {ln}081209"
Active = TRUE
Multi = TRUE
URL = "$TYPE(htm)"
Bounds = "$NEST(<,>)"
Limit = 150
Match = "((<head*>)\1|($NEST(<link,*rel="stylesheet"*,/>))\2|(</head>)\2)"
"(^$TST(Inside_Script=1))"
"($TST(V_Html=1)|$SET(V_PreHtml=1))"
"$SET(V_Head=1)"
Replace = "\1"
"<!-- PROXOMITRON_STARTFILTERS_WILL_BE_PLACED_HERE -->"
"$STOP()"
Name = "| /¯¯¯<body> [0:V_PreHtml,V_Head; 1:V_Html,V_Postbody] {ln}081216"
Active = TRUE
Multi = TRUE
URL = "$TYPE(htm)"
Bounds = "$NEST(<body,>)"
Limit = 1000
Match = "(<body*>)\1"
"(^$TST(Inside_Script=1))"
"($TST(V_PreHtml=1)|$TST(V_Html=1))"
"$SET(V_Head=)"
Replace = "$SET(V_PreHtml=)$SET(V_Html=1)$SET(V_PostBody=1)"
"\1<!-- PROXOMITRON_BODY -->\n"
"$STOP(Comments=V_PreHtml instead of V_Html because <html> is optional)"
Name = "| \___</html>_____ [1:V_PostHtml; 0:V_Html] {ln}080930b"
Active = TRUE
Multi = TRUE
Limit = 100
Match = "(</html>)\1"
"(^$TST(Inside_Script=1))"
"$TST(V_Html=1)"
Replace = "$SET(V_Html=)$SET(V_PostHtml=1)"
"\1\n"
"<!-- PROXOMITRON_ENDFILTERS_WILL_BE_PLACED_HERE -->\n"
"$STOP()"
Name = "\_____End HTML file_______________ {ln}081004"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 50
Match = "<end>"
Replace = "$SET(V_PostHtml=)$SET(V_Html=)$SET(V_PostBody=)$SET(Comments=)"
"$STOP()"
Name = "."
Active = FALSE
URL = "^?"
Limit = 256
Match = "<never>"
Name = "> --- < START filters {ln}081216"
Active = TRUE
URL = "$TYPE(htm)"
Bounds = "$NEST(<!--,-->)"
Limit = 60
Match = "<!-- PROXOMITRON_STARTFILTERS_WILL_BE_PLACED_HERE -->"
Replace = "\1"
"<!-- ____________________________________ -->\r\n"
""
"<!-- Inserting Style Sheet -->\r\n"
"<link rel="stylesheet" type="text/css" href="http://Local.ptron/Proxomitron.css" />\r\n"
""
"<!-- Inserting javascript -->\r\n"
"<script type="text/javascript" src="http://local.ptron/base_start.js"></script>\r\n"
""
"<!-- ____________________________________ -->\r\n"
"\2"
"$STOP(Using extrange simbols here could break some sites, so be careful. Not use multi if possible)"
Name = "> --- < END filters {ln}081022"
Active = TRUE
URL = "$TYPE(htm)"
Bounds = "$NEST(<!--,-->)"
Limit = 55
Match = "<!-- PROXOMITRON_ENDFILTERS_WILL_BE_PLACED_HERE -->"
Replace = "<!-- _____________ Con: $DTM(c) _____________ -->\r\n"
"<!-- Inserting javascript -->\r\n"
"<script type="text/javascript" src="http://local.ptron/base_end.js"></script>\r\n"
"<!-- _____________ _____________ -->\r\n"
"$STOP()"
Name = "Defining [Inside_Script/Link] {ln}081124 (Read!)"
Active = TRUE
URL = "$TYPE(htm)"
Limit = 256
Match = "< ("
"script(\s|>)$SET(Inside_Script=1)|"
"/script >$SET(Inside_Script=)|"
"a\s$SET(Inside_Link=1)|"
"/a >$SET(Inside_Link=)"
")PrxFail$TST()"
Replace = "Place this filter always at the end of the list."
What each filter does is now autoexplained in its title. The format is 0: to clean a variable and 1: to enable it
_____________________________________________
After that, i made 2 big groups of filters:
-filters that match before <html> or after </html>
The filters added to this group needs to have added $TST(V_PreHtml=1) or $TST(V_PostHtml=1)
-filters that match between <html> and </html>
Adding $TST(V_Html=1)
To not make your filters slower, it's better if the filter fails before the $TST. So dont put the $TST() at the beginning, put it later and not after an asterisc. The reason is because the $TST() is slow.
If your filter is not very complex you can put the test just at the end. But if the filter is more complex and searchs in lists maybe would be better to put the $TST before the $LST.
You can read about it in the help:
http://www.proxomitron.info/45/help/Matc...s.html#TST
I'm testing it for a while and it gives me very good results. If you use them, remember to remove the test for the zone when you go to the test window, or it will never match there :/
I don't know if maybe sidky already uses that in his filters. If yes please tell me.
Hope you like them ;)
For testing purposes i post here my filters for offsite scripts and noscripts placed in pre-html and post-html zones.
Code:
[Patterns]
Name = "############## (PRE|POST)HTML FILTERS (read)###################################"
Active = FALSE
URL = "^?"
Limit = 256
Match = "The filters of this section needs to test for true in at least one of the next global variables:"
"V_PreHtml"
"V_PostHtml "
Name = "<Pre|Post Script1> Prefer Noscripts than scripts <multi>081015"
Active = TRUE
Multi = TRUE
URL = "$TYPE(htm)"
Bounds = "$NEST(<script,</script>) <noscript*>"
Limit = 9000
Match = "<script"
"(($TST(V_PreHtml=1)$SET(5=Pre-))|($TST(V_PostHtml=1)$SET(5=Post-)))"
"*<noscript*>"
"$SET(DELETE_NEXT_END=noscript)"
Replace = "<center><span class=prox style=display:none; title="\5Script changed by his NoScript">[$]</span></center>"
Name = "<Pre|Post Script2 offsite> Kill {ln}081009"
Active = TRUE
URL = "$TYPE(htm)"
Bounds = "$NEST(<script,</script>)"
Limit = 4000
Match = "("
"($NEST(<(script)\3,*src=$AVQ("(*.js)\2")*,</script>)$SET(4=<a href=\2>[\5.js]</a>)"
"$TST(\2=($AV((http|ftp)(s|)://(^\h)*))))"
")"
"(($TST(V_PreHtml=1)$SET(5=pre-))|($TST(V_PostHtml=1)$SET(5=post-)))"
Replace = "<span class=prox2 style=display:none; title="\5html \3 killed \2">\4</span>"
You can test in geocities, for example in the web of sidki
http://www.geocities.com/sidki3003/prox-news.html
Note: I need to improve the test for offsite cause it fails in other sites...