Post Reply 
Update: Remove - Specific Functions
Apr. 28, 2009, 04:01 PM
Post: #1
Update: Remove - Specific Functions
This update adds an "exact match only" modifier: $SET(sUserFnR==)

Code:
[Patterns]
Name = "Remove: Specific Functions on sel. Sites     9.04.28 [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 prxVoidV)$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))"
        ""
        "&($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>$GET(mHead) \2%3C/span>"
        "$ESC(\4)%3Cbr class=%22ProxFly-Br%22 />"
        ")|)"
Replace = "\1 /* PROX: \2 Removed\3 */ }"


Changed description in the IncludeExclude lists:
Code:
## block ad functions                $SET(sUserFn=§MATCH1§MATCH2§)
##
## "MATCH" targets function names and IF conditions.  Each string must be
## surrounded by section signs (§).  You just need to match the beginning of
## the target, 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}
##
## 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=!=)".
## ----------------------------------------------------------------------------


By the way, does anyone have concerns, comments, thoughts about renaming the IncludeExcude Lists to "Exceptions"?
Add Thank You Quote this message in a reply
Apr. 28, 2009, 04:21 PM
Post: #2
RE: Update: Remove - Specific Functions
(Apr. 28, 2009 04:01 PM)sidki3003 Wrote:  By the way, does anyone have concerns, comments, thoughts about renaming the IncludeExcude Lists to "Exceptions"?

sounds like an awesome idea...
Add Thank You Quote this message in a reply
Apr. 28, 2009, 04:30 PM
Post: #3
RE: Update: Remove - Specific Functions
Great! Smile!
Add Thank You Quote this message in a reply
Apr. 28, 2009, 10:27 PM
Post: #4
RE: Update: Remove - Specific Functions
The name is more descriptive Smile!

I never got what IncludeExclude means
Add Thank You Quote this message in a reply
Jun. 04, 2009, 06:48 PM (This post was last modified: Jun. 05, 2009 06:27 PM by sidki3003.)
Post: #5
RE: Update: Remove - Specific Functions
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. Wink

edit June 4, 9 PM GMT: Replaced alpha config code with respective stable one. Upwards compatible. Minor.
Add Thank You Quote this message in a reply
Post Reply 


Forum Jump: