Hi all,
Here is another pair of JavaScript filters, they are for faking certain object properties.
I wrote an extra one for HTML files, since i don't want to have any accidental replacements outside the script bounds.
The comments on these filters are in JSProperties.txt
(Thanks, JD for testing and pointing me to the docs

)
[Blocklists]
List.JSProperties = "..ListsJSProperties.txt"
[Patterns]
Name = "JS Properties HTM"
Active = TRUE
Multi = TRUE
URL = "$TYPE(htm)"
Bounds = "<script*</script*>"
Limit = 8000
Match = "(#.$LST(JSProperties))+#"
Replace = "@"
Name = "JS Properties JS"
Active = TRUE
URL = "($TYPE(js)|$TYPE(oth))"
Limit = 32
Match = ".$LST(JSProperties)"
Replace = "@"
------------ JSProperties.txt ------------
# List for "JS Properties" filters: Fake listed object properties.
# For HTML files search for strings within <script> tags only,
# for JS files search everywhere.
# The list is hashable, that's why no regexp is used.
#
# The filters are quite aggressive, some ways to tame them:
# Replace "($TYPE(js)|$TYPE(oth))" by "$TYPE(js)"
#
# Make an exception list and append it to the URL match:
# URL = "($TYPE(js)|$TYPE(oth))(^$LST(Bypass_JS_Props))"
#
# Comment out the offending property.
# If "appName" and "platform" causes too much trouble you might try this.
# It's for sites that do an indexOf() check:
#
#appName$SET(#=.appName.substr(0,0)+'XMSIE')
#platform$SET(#=.platform.substr(0,0)+'XWin')
#
# Some notes on the "JS Properties HTM" filter:
# It matches *all* script bounds. Adding something like
# "<script*(.$LST(JSProperties))*</script*>" will make it slower.
#
# ?NEST or $INEST in the filter bounds match will fail sometimes, e.g. here:
# hea-www.harvard.edu/~fine/CFA/browser_type.html
#
# sidki 2002-6-28
# "navigator" object, property attributes readonly for IE,
# it needs this hard way to change them.
#
#userAgent$SET(#=.userAgent.substr(0,0)+"NOYB")
#userAgent$SET(#=.userAgent.substr(0,0)+"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)")
userAgent$SET(#=.userAgent.substr(0,0)+"Opera/6.03 (Linux 2.4.34 i886) [en]")
#appName$SET(#=.appName.substr(0,0)+"NOYB")
#appName$SET(#=.appName.substr(0,0)+"Microsoft Internet Explorer")
appName$SET(#=.appName.substr(0,0)+"Opera")
#appVersion$SET(#=.appVersion.substr(0,0)+"NOYB")
#appVersion$SET(#=.appVersion.substr(0,0)+"4.0 (compatible; MSIE 6.0; Windows NT 5.1; Q312461)")
appVersion$SET(#=.appVersion.substr(0,0)+"6.03 (Linux 2.4.34 i886) [en]")
#platform$SET(#=.platform.substr(0,0)+"NOYB")
#platform$SET(#=.platform.substr(0,0)+"Win32")
platform$SET(#=.platform.substr(0,0)+"Linux")
#appMinorVersion$SET(#=.appMinorVersion.substr(0,0)+"NOYB")
appMinorVersion$SET(#=.appMinorVersion.substr(0,0)+"undefined")
appCodeName$SET(#=.appCodeName.substr(0,0)+"NOYB")
#appCodeName$SET(#=.appCodeName.substr(0,0)+"Mozilla")
#language$SET(#=.language.substr(0,0)+"NOYB")
language$SET(#=.language.substr(0,0)+"en")
#browserLanguage$SET(#=.browserLanguage.substr(0,0)+"NOYB")
browserLanguage$SET(#=.browserLanguage.substr(0,0)+"en")
#systemLanguage$SET(#=.systemLanguage.substr(0,0)+"NOYB")
systemLanguage$SET(#=.systemLanguage.substr(0,0)+"en")
#userLanguage$SET(#=.userLanguage.substr(0,0)+"NOYB")
userLanguage$SET(#=.userLanguage.substr(0,0)+"en")
#cpuClass$SET(#=.cpuClass.substr(0,0)+"NOYB")
#cpuClass$SET(#=.cpuClass.substr(0,0)+"x86")
#cpuClass$SET(#=.cpuClass.substr(0,0)+"other")
cpuClass$SET(#=.cpuClass.substr(0,0)+"alpha")
#cookieEnabled$SET(#=.cookieEnabled.substr(0,0)+"false")
cookieEnabled$SET(#=.plugins.length)
#javaEnabled()$SET(#=.javaEnabled.substr(0,0)+"false")
javaEnabled()$SET(#=.plugins.length)
# rarely used, IE only.
#
connectionType$SET(#=.connectionType.substr(0,0)+"offline")
userProfile$SET(#=.cpuClass)
onLine$SET(#=.onLine.substr(0,0)+"false")
# "document" object
#
referrer$SET(#=.referrer.substr(0,0)+"http://h/")
cookie(^[a-z0-9])$SET(#=.cookieGFN)
-----------------------------------------
regards, sidki
Edited by - sidki3003 on 02 Jul 2002 17:41:37