I agree that it would be more comfortable to have the Flash filter always matching. However, i have to weigh the pros and cons. From the coding perspective, we are dealing with a generic filter, which is supposed to work *quickly* and should be resistant to code changes.
Below are modified filters, the first one for the release config, the other for alpha4. They are just a proof of concept, and i'm not comfortable with them, due to the compromises solely implemented for YouTube.
Code:
[Patterns]
Name = "<object>...: Toggle Flash 10.08.29 (ccw! !nn) [jd sd] (o.2 l.2) POC-RL"
Active = FALSE
URL = "($TYPE(htm)|$TYPE(js)|$TYPE(vbs))(^$TST(keyword=*.(a_flash|a_code|i_level:1).*)|$TST(hOrigUA=mozilla/4.[1-9](^*opera)*))"
Limit = 10000
Match = "<(\" \+ \"o|\' \+ \'o|o)b(" \+ ')+j(" \+ ')+ect(\s|"|\\n|>)(("
"(*<)\0(/embe(d)\4 >(^(^ </(^object)))|(" \+ ')+(\\+/)\4ob(" \+ ')+j(" \+ ')+ect[^>]+>)"
"(^$TST(\0=*<object*))$SET(#=$SET(tObject=))"
"&&*(s(hockwave|wf)|flash(.|_|vars)|d27cdb6e-|obj(Attrs|Str)|.push\(" >)*"
")|(*>&&*(s(hockwave|wf)|d27cdb6e-)*))"
""
"|<(\" \+ \"e|\' \+ \'e|e)mbed(\s[^/]|"|\\n)(^$TST(tObject=1))"
"(*>(^ [0-9=])&&*(s(hockwave|wf)|flash|embedAttrs|.push\(" /(^(^>)))(>|*[^-]>)(^?))"
"((*<)\0(\\+/)\4embed >(^$TST(\0=*<(embe(d)\5|/script)*))|)(^$TST(\5=*)&$TST(script=*))"
""
"&&(^$TST(comment=1)|$TST(tNoscript=1)|$TST(tNoframes=1)|*function\s[^()"'; ]+ \()*"
"&$SET(2= style=\1)<(("
"*>&&*width(=(\\+("|\")+{0,1})\1| : "+)( ([#*:*]%+)\8|")*"
"&&*height(=\\+("|\")+| : "+)( ([#*:*]%+)\9|")*"
")|)"
""
"&<((" \+ ')+ob(" \+ ')+j(" \+ ')+ect)\0"
"("
"$TST(\4=/(^$TST(script=[1s]*))|d$SET(4=/object></))$SET(7=span)$SET(#=\1><\0)(\#&$SET(#=</span>))"
"|$SET(7=\0)(([^>]++\sstyle=\\+("|\")+{0,1})\2(([^"'\\&]++)\#display : [a-z-]+;+)+|$SET(#=\1))"
"(\#))"
"|<((" \+ ')+embed)\0$SET(7=span)$SET(#=\1><\0)(\#&$SET(#=</span>))"
""
"&$SET(4=$TST(hOrigUA=*msie(^*opera)*)(function(a,b){"
"while(b.firstChild&&!b.Movie&&!b.SRC&&!b.src)b=b.firstChild;"
"while(b.nextSibling&&!b.Movie&&!b.SRC&&!b.src)b=b.nextSibling;"
"b.rmov=b.Movie||b.SRC||b.src;"
"if(b.ReadyState!=4)b.Movie?b.Movie=a.alt:b.SRC?b.SRC=a.alt:b.src=a.alt;"
"})(this,this.parentNode.nextSibling);)"
"($TST(script=1*)(*</script)+{1,*}(^*<script)$SET(script=)|)$SET(3=$TST(script=[1s]*)JS)"
"("
"$TST(script=*)($TST(\1=\")$SET(1=\\x22)|$TST(\1=\')$SET(1=\\x27))"
"|(^$TST(script=*))(^$TST(\1="))$SET(1=")"
"|)"
"($TST(displayM=none)$SET(5=inline)|$SET(5=none))"
"($TST(tAnc=1*|j)$SET(tAnc=)$SET(6=</a>)|$TST(script=*)$SET(6=<a></a>)|)"
"($TST(volat=*.log:2*)$ADDLST(Log-Main,[$DTM(d T)]\tWEB Flash\t\0 \3 \t\u)|)"
Replace = "\6<span class=\1ProxFlash ProxToggle\1 style=\1display:\5\1>"
"<img class=\1ProxBcn-Img\1 alt=\1about:blank\1 src=\1http://local.ptron/killed.gif\1"
" onload=\1prxO.oiFlash=!prxO.oiFlash?1:++prxO.oiFlash;\4prxO.oInt.inGetFlash(this);\1 />"
"<a class=\1ProxToggle ProxTogO-A\1 href=\1javascript://\1"
" onclick=\1prxO.oInt.inToggleD(this.parentNode,true);prxO.oInt.inStopEv(event);\1"
" title=\1\0 \3 \8x\9\1 target=\1_self\1>Toggle</a>"
"<a class=\1ProxToggle ProxTogO-A\1 href=\1about:blank\1"
" title=\1Direct Link\1 target=\1_top\1>Flash</a>"
" </span><\7 class=\1ProxFlash\1\2display:$GET(displayM)\;\@"
Code:
[Patterns]
Name = "<object>...: Toggle Flash 10.08.28 (ccw! !nn) [jd sd] (o.2 l.2) POC-A4"
Active = FALSE
URL = "($TST(hCT=*html)|$TYPE(js)|$TYPE(vbs))(^$TST(keyword=*.(a_flash|a_code|i_level:1).*)|$TST(hOrigUA=mozilla/4.[1-9](^*opera)*))"
Limit = 10000
Match = "<(\" \+ \"o|\' \+ \'o|o)b(" \+ ')+j(" \+ ')+ect(\s|"|\\n|>)(("
"(*<)\0("
"/embe(d)\4 >(^(^ </(^object)))|(" \+ ')+(\\+/)\4(" \+ ')+ob(" \+ ')+j(" \+ ')+ec(" \+ ')+t(*>)+{1}"
")"
"(^$TST(\0=*<object*))$SET(#=$SET(tObject=))"
"&&*(s(hockwave|wf)|flash(.|_|id|vars)|d27cdb6e-|obj(Attrs|Str)|.push\(" >)*"
")|(*>&&*(s(hockwave|wf)|d27cdb6e-)*))"
""
"|<(\" \+ \"e|\' \+ \'e|e)mbed(\s[^/]|"|\\n)(^$TST(tObject=1))"
"(*>(^ [0-9=])&&*(s(hockwave|wf)|flash|embedAttrs|.push\(" /(^(^>)))(>|*[^-]>)(^?))"
"((*<)\0(\\+/)\4embed >(^$TST(\0=*<(objec(t)\5|embe(d)\5|/script)*))|)(^$TST(\5=d)&$TST(script=*))"
""
"&&(^$TST(comment=1)|$TST(tNoscript=1)|$TST(tNoframes=1)|*function\s[^()"'; ]+ \()*"
"&$SET(2= style=\1)<(*>&&("
"*width(=(\\+("|\")+{0,1})\1| : "+)( ([#*:*]%+)\8|")*"
"&&*height(=\\+("|\")+| : "+)( ([#*:*]%+)\9|")*"
")|*&&(*\s(classid|data|id|type)=(\\+("|\"))\1)+{0,1}*)"
""
"&<((" \+ ')+ob(" \+ ')+j(" \+ ')+ect)\0"
"("
"$TST(\4=/|d$SET(4=/object></))$SET(7=span)$SET(#=\1><\0)(\#&$SET(#=</span>))"
"|$SET(7=\0)(("
"([^>]++\sstyle=)\4$AVQ(\\+("|\")+{0,1}(\#display : [a-z-]+;+)+\#)"
"&&($TST(\4)\\+("|\")+{0,1})\2*"
")|$SET(#=\1))(\#)"
")"
"|<((" \+ ')+embed)\0$SET(7=span)$SET(#=\1><\0)(\#&$SET(#=</span>))"
""
"&$SET(4=$TST(hOrigUA=*msie(^*opera)*)(function(a,b){"
"while(b.firstChild&&!b.Movie&&!b.SRC&&!b.src)b=b.firstChild;"
"while(b.nextSibling&&!b.Movie&&!b.SRC&&!b.src)b=b.nextSibling;"
"b.rmov=b.Movie||b.SRC||b.src;"
"if(b.ReadyState!=4)b.Movie?b.Movie=a.alt:b.SRC?b.SRC=a.alt:b.src=a.alt;"
"})(this,this.parentNode.nextSibling);)"
""
"($TST(script=1*)(*</script)+{1,*}(^*<script)$SET(script=)"
"|$TST(script=*)($TST(\1=\")$SET(1=\\x22)|$TST(\1=\')$SET(1=\\x27))"
"|(^$TST(script=*))(^$TST(\1=*))$SET(1=")"
"|)$SET(3=$TST(script=[1s]*)JS)"
"($TST(displayM=none)$SET(5=inline)|$SET(5=none))"
"($TST(tAnc=1*|j)$SET(tAnc=)$SET(6=</a>)|$TST(script=*)$SET(6=<a></a>)|)"
"($TST(volat=*.log:2*)$ADDLST(Log-Main,[$DTM(d T)]\tWEB Flash\t\0 \3 \t\u)|)"
Replace = "\6<span class=\1Pr0xFlash Pr0xToggle\1 style=\1display:\5\1>"
"<img class=\1Pr0xBcn-Img\1 alt=\1about:blank\1 src=\1http://local.ptron/killed.gif\1"
" onload=\1prxO.oiFlash=!prxO.oiFlash?1:++prxO.oiFlash;\4prxO.oInt.inGetFlash(this);\1$GET(mType)>"
"<a class=\1Pr0xToggle Pr0xTogO-A\1 href=\1javascript://\1"
" onclick=\1prxO.oInt.inToggleD(this.parentNode,true);prxO.oInt.inStopEv(event);\1"
" title=\1\0 \3 \8x\9\1 target=\1_self\1>Toggle</a>"
"<a class=\1Pr0xToggle Pr0xTogO-A\1 href=\1about:blank\1"
" title=\1Direct Link\1 target=\1_top\1>Flash</a>"
" </span><\7 class=\1Pr0xFlash\1\2display:$GET(displayM)\;\@"
The best idea is probably that someone writes a site-specific filter (which might need to be updated regularly).
If i understood the code correctly:
- The object/embed tags for standard compliant browsers are in the inline script.
- The fallback code currently is in
http://s.ytimg.com/yt/jsbin/www-core-vfl186132.js
-> object code for IE 6/7/8
-> embed code for other browsers
Test link:
http://www.youtube.com/watch?v=zlfKdbWwruY