Post Reply 
Need help with Sidki filter causing problem
Dec. 26, 2008, 12:30 PM
Post: #5
RE: Need help with Sidki filter causing problem
I think it's not that the code itself is difficult to understand. It's the subroutines which make the core difficult to spot. When i don't understand my own code, i decompose the respective filter.

Code:
// Comment: Only check these three containers
<(div|td|center)\0

// Comment: Don't match within scripts, comments, noscript blocks
(^$TST(script=*)|$TST(comment=1)|$TST(tNoscript=1))

// Comment: Subroutine 1 start -- Where to apply the Core RegExp
[^>]+(

// Comment: Skip certain tags
(> <(font|br+|img|h[1-6]|p|s(mall|pan|trong)|!--[^\n]++--)\6[^>]+)

+>

// Comment: Now test the code after the first tag
// Comment: And the second tag, unless it's a comment or our container is closing
( (^<(!-|/+(div|td|center)))[^>]+(>)\4)++{0,1}

// Comment: Fail on opening tags -- Skip HTML entities and non-characters
(^<)(\&[a-z]+; |[^a-z])+

)\8
// Comment: Subroutine 1 end

// Comment: Core RegExp
(
(a(d(vert(isers|s|)|s|)(^-) |n(nunci|zeigen+ ))|marketplace )
(^[a-z0-9ä_+])
|
(
ad(s\sby\s|vert(enti|isem))
|pubb+lici(dad|t[? eé&])
|(\w |)sponsor(^ed[a-z])
|(from|visit) our (advertiser|partner|sponsor)
)
[a-z0-9 ]+{0,23} (^[a-z0-9])
)\2

// Comment: Subroutine 2 start -- Either write back all open tags, or just hide the matched tag
(
// Comment: Hide-or-remove switch
$TST(keyword=(^*.i_adtag:[#*:0].)\7)

// Comment: Remove
$INEST(<$TST(\0),(*(

// Comment: Push unclosed tags into stack
<(t(able|body|foot|d|r|h)|div)\5$INEST(<$TST(\5),</$TST(\5))</$TST(\5) >
|(<(/|)(t(able|body|foot|d|r|h)|div)*> )\#

))+*,</$TST(\0))</$TST(\0) >$TST(\0=td$SET(#=<td style="height:0;padding:0">)$SET(3=</td>)|*)
|

// Comment: Hide
(^$TST(\7=*)&$TST(\4=>)|$TST(\6=span)|$TST(\7=*.i_adtag:[12].*))
$SET(1=-hide)$SET(3=<\0 style="display:none!important"\8\2)
)
// Comment: Subroutine 2 end

// Comment: Log line
($TST(volat=*.log:2*)$ADDLST(Log-Main,[$DTM(d T)]\tWEB Ad-Head\1 \0 \t\6 \4\2 \t\u)|)
Add Thank You Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Need help with Sidki filter causing problem - sidki3003 - Dec. 26, 2008 12:30 PM

Forum Jump: