Updated to also look at the first 30 bytes in script blocks.
Code:
[Patterns]
Name = "Remove: Specific Functions on sel. Sites 9.06.04 [sd] (d.2)"
Active = TRUE
URL = "($TYPE(htm)|$TYPE(js)|$TYPE(vbs))$TST(sUserFn=*)"
Limit = 32766
Match = "function\s$TST(script=[1s]*)([^()"';]+{1,*})\4"
"$TST(sUserFn=§(\5§$TST(\4=(($TST(\5)($TST(sUserFnR=*=*)|*))\6|*)))+)$TST(\6=*)"
" $NEST(\(,\)) $NEST({,})"
"$SET(1=function \4() { return String())$SET(2=S-Spec Fn: $GET(sUserFnR))"
"|"
"if \( $TST(script=[1s]*)($INEST(\( ,\)))\4"
"$TST(sUserFn=§(\5§$TST(\4=(($TST(\5)($TST(sUserFnR=*=*)|*))\6|*)))+)$TST(\6=*)"
"\)( //[^\n]+| /\**\*/)+ ($NEST({,})|[^;]+;)"
"$SET(7=$TST(sUserFnR=*!*)!)$SET(1=if (\70) {)$SET(2=S-Spec If: $GET(sUserFnR))$SET(3= - (\4))"
"|"
"<script([^>]+>)\7( <!--[^\n]+)+ ([^<;\n]+{1,30})\4"
"$TST(sUserFn=§(\5§$TST(\4=(($TST(\5)($TST(sUserFnR=*=*)|*))\6|*)))+)$TST(\6=*)"
"$INEST(<script,</script)$SET(1=<script\7{)$SET(2=S-Spec Sc: $GET(sUserFnR))"
""
"&($TST(volat=*.log:2*)$ADDLST(Log-Main,[$DTM(d T)]\tWEB SiteSpec_JS \2 \t\4 \t\u)|)"
"($TYPE(htm)$SET(eAdJS=$GET(eAdJS)"
"%3Cspan class=%22ProxFly-Span%22%3E$GET(mHead) \2%3C/span%3E"
"$ESC(\4)%3Cbr class=%22ProxFly-Br%22 /%3E"
")|)"
Replace = "\1 /* PROX: \2 Removed\3 */ }"
Changed description in the IncludeExclude lists:
Code:
## block specific functions $SET(sUserFn=§MATCH1§MATCH2§)
##
## "MATCH" targets function names and IF conditions, as well as the initial
## code within script tags. Each string must be surrounded by section signs
## (§). You just need to match the beginning of the target string, unless you
## append "$SET(sUserFnR==)".
##
## Example:
## [^.]+.techtarget.com/ $SET(sUserFn=§HBX_§forMembersOnly§)
##
## Above entry would replace these code blocks on TechTarget sites:
## function HBX_STRING() {code}
## function HBX_ERROR() {code}
## if (forMembersOnly && something) {code}
## <script>forMembersOnly=true;/*...*/</script>
##
## If you append "$SET(sUserFnR=!)", replaced - hence empty - "if" blocks get
## executed instead of possible "else" blocks, which is the default.
##
## For above logic, plus exact string match only, append "$SET(sUserFnR=!=)".
## ----------------------------------------------------------------------------
Might come in handy, e.g. if someone finds The Onion hard to read lately.
edit June 4, 9 PM GMT: Replaced alpha config code with respective stable one. Upwards compatible. Minor.