Skip to content

Loading…

Added suport to firefox 5 #7

Closed
wants to merge 1 commit into from

1 participant

@dukex

No description provided.

@dukex dukex closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 4, 2011
  1. @dukex

    added firefox 5 support

    dukex committed
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 9 deletions.
  1. +1 −1 css_browser_selector.js
  2. +9 −8 tests/tester.html
View
2 css_browser_selector.js
@@ -5,4 +5,4 @@ http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
-function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g='gecko',w='webkit',s='safari',o='opera',m='mobile',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('blackberry')?m+' blackberry':is('android')?m+' android':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?m+' j2me':is('iphone')?m+' iphone':is('ipod')?m+' ipod':is('ipad')?m+' ipad':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win'+(is('windows nt 6.0')?' vista':''):is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);
+function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g='gecko',w='webkit',s='safari',o='opera',m='mobile',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('firefox/5')?g+' ff5':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('blackberry')?m+' blackberry':is('android')?m+' android':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?m+' j2me':is('iphone')?m+' iphone':is('ipod')?m+' ipod':is('ipad')?m+' ipad':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win'+(is('windows nt 6.0')?' vista':''):is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);
View
17 tests/tester.html
@@ -11,7 +11,7 @@
<script type="text/javascript" charset="utf-8">
- var user_agent_strings = [
+ var user_agent_strings = [
[""," "],
["unprocessable navigator string"," "],
// Iron
@@ -26,6 +26,7 @@
["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.A.B.C Safari/525.13", "webkit chrome win"],
["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13", "webkit chrome win"],
// Firefox
+ ["mozilla/5.0 (macintosh; intel mac os x 10.6; rv:5.0) gecko/20100101 firefox/5.0", "gecko ff5 mac"], // firefox 5.0 mac
["mozilla/5.0 (macintosh; u; intel mac os x 10.6; en-us; rv:1.9.2.3) gecko/20100401 firefox/3.6.3 gtb7.0", "gecko ff3 ff3_6 mac"], //firefox 3.6 mac
["mozilla/5.0 (macintosh; u; intel mac os x 10.5; en-gb; rv:1.9.1) gecko/20090624 firefox/3.5" , "gecko ff3 ff3_5 mac"], // firefox 3.5 mac
["Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6" , "gecko ff2 mac"], // firefox 2 mac
@@ -37,13 +38,13 @@
["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.13) Gecko/20060410 Firefox/1.0.8" , "gecko win"], // firefox 1 xp
["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.3) Gecko/20041002 Firefox/0.10.1" , "gecko win"], // firefox pre v1
["Mozilla/5.0 (X11; U; SunOS sun4m; en-US; rv:1.4b) Gecko/20030517 Mozilla Firebird/0.6" , "gecko linux"], // firefox firebird
- ["Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5" , "gecko win"], // firefox phoenix
+ ["Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.3a) Gecko/20021207 Phoenix/0.5" , "gecko win"], // firefox phoenix
["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2b) Gecko/20020923 Phoenix/0.1" , "gecko win"], // firefox phoenix xp
["Mozilla/3.0 (x86 [en] Windows NT 5.1; Sun)" , "gecko win"], // hotjava
// Navigator
["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.8pre) Gecko/20071019 Firefox/2.0.0.8 Navigator/9.0.0.1" , "gecko ff2 win"], // Navigator 9 with Firefox fixes
["Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.5) Gecko/20050519 Netscape/8.0.1" , "gecko win"], // A real Firefox based Netscape 8 with a security patch (already) on Win 2K
- ["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)" , "gecko win"], // Netscape 7.2 and still we're wondering what's the (ax)?
+ ["Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)" , "gecko win"], // Netscape 7.2 and still we're wondering what's the (ax)?
["Mozilla/5.0 (Windows; U; WinNT4.0; en-CA; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1" , "gecko win"], // NS 6.2.1 on NT4.0.
["Mozilla/4.8 [en] (X11; U; Linux 2.4.20-8 i686)" , "gecko linux"], // NS 4.8 on Redhat 9
["Mozilla/3.01 (WinNT; I) [AXP]" , "gecko win"], // NS 3.01 on DEC ALPHA under NT
@@ -105,10 +106,10 @@
["Opera/7.50 (X11; Linux i686; U) [en]" , "opera opera7 linux"], // Opera 7.50 running on Mandrake Linux
["Mozilla/5.0 (X11; Linux i686; U) Opera 7.50 [en]" , "opera opera7 linux"], // Opera 7.50 running on Mandrake Linux
["Mozilla/4.0 (compatible; MSIE 6.0; X11; Linux i686) Opera 7.20 [en]" , "opera opera7 linux"], // Opera 7.20 running on Linux and pretending to be MSIE 6.0
- ["Opera/7.11 (Windows NT 5.1; U) [en]" , "opera opera7 win"], // On Windows XP.
+ ["Opera/7.11 (Windows NT 5.1; U) [en]" , "opera opera7 win"], // On Windows XP.
["Mozilla/4.0 (compatible; MSIE 6.0; Windows ME) Opera 7.11 [en]" , "opera opera7 win"], // Opera 7.11 running on WME
["Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 5.0) Opera 7.02 Bork-edition [en]" , "opera opera7 win"], // The infamous MSN version of Opera 7.02 on W2K
- ["Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 4.0) Opera 7.0 [en]" , "opera opera7 win"], // Opera 7.0 on NT 4.0.
+ ["Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows NT 4.0) Opera 7.0 [en]" , "opera opera7 win"], // Opera 7.0 on NT 4.0.
["Mozilla/4.0 (compatible; MSIE 5.0; Windows 2000) Opera 6.0 [en]" , "opera opera6 win"], // Opera 6.0 on Windows 2000.
["Mozilla/4.0 (compatible; MSIE 5.0; Windows 95) Opera 6.01 [en]" , "opera opera6 win"], // Opera 6.01 on Windows 95.
["Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC) Opera 5.0 [en]" , "opera opera5 mac"], // Opera 5.0 on the Mac (OS8.6)
@@ -139,7 +140,7 @@
["Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0" , "ie ie7 win vista"],
["Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; Media Center PC 5.0; .NET CLR 1.1.4322; Windows-Media-Player/10.00.00.3990; InfoPath.2" , "ie ie7 win vista"], // MSIE 7 running on Windows Vista 64-bit with a ton of 'stuff'
["Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; Dealio Deskball 3.0)" , "ie ie7 win"], // MSIE 7 on XP and every version of .NET known to mankind
- ["Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; NeosBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)" , "ie ie6 win"], // Explanation: MSIE 6.x on XP with a skin from neos.tv who seem to specialize in the hospitality (read hotel) industry.
+ ["Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; NeosBrowser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)" , "ie ie6 win"], // Explanation: MSIE 6.x on XP with a skin from neos.tv who seem to specialize in the hospitality (read hotel) industry.
["Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)" , "ie ie5 win"], // MSIE 5.5 on Windows 98
["Mozilla/4.0 (compatible; MSIE 5.22; Mac_PowerPC)" , "ie ie5 mac"], // Latest MAC OS X version of MSIE
["Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)" , "ie ie5 win"], // MSIE 5.0 on MS NT 4.0
@@ -162,7 +163,7 @@
["Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/412 (KHTML, like Gecko) Safari/412" , "webkit safari mac"], // Safari browser 2.0 for MAC OS X (10.4.1 build 8B15)
["Mozilla/5.0 (Macintosh; U; PPC Mac OS X; fr-fr) AppleWebKit/312.5.1 (KHTML, like Gecko) Safari/312.3.1" , "webkit safari mac"], // Safari 1.3.1 on 1.3.9 after after Security update 2005-008
["Mozilla/5.0 (Macintosh; U; PPC Mac OS X; fr-fr) AppleWebKit/312.5 (KHTML, like Gecko) Safari/312.3" , "webkit safari mac"], // Safari 1.3.1 (v312.3) 10.3.9 = last update on last version of Panther
- ["Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/124 (KHTML, like Gecko) Safari/125.1" , "webkit safari mac"], // Safari browser 1.25.1 for MAC OS
+ ["Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/124 (KHTML, like Gecko) Safari/125.1" , "webkit safari mac"], // Safari browser 1.25.1 for MAC OS
["Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/106.2 (KHTML, like Gecko) Safari/100.1" , "webkit safari mac"], // Safari browser 1.0 for MAC OS X
["Mozilla/5.0 (Macintosh; U; PPC Mac OS X; es) AppleWebKit/85 (KHTML, like Gecko) Safari/85" , "webkit safari mac"], // Safari browser 1.0 for MAC OS X with spanish language variant
["Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-us) AppleWebKit/74 (KHTML, like Gecko) Safari/74" , "webkit safari mac"], // Safari browser build 74 for MAC OS X
@@ -174,7 +175,7 @@
]
document.writeln('<h1>Current Browser</h1>');
- document.writeln('<p>'+navigator.userAgent+' - '+document.getElementsByTagName('html')[0].className+'</p>');
+ document.writeln('<p>'+navigator.userAgent+' - '+document.getElementsByTagName('html')[0].className+'</p>');
passed = 0;
Something went wrong with that request. Please try again.