1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

- update browser grades.

- grade A now requires (minimum) Chrome 10, Firefox 4, and Opera 10
- bump minor package version
This commit is contained in:
Dustin Diaz 2011-10-11 10:02:07 +02:00
parent ba36636fb9
commit 62a55250f8
4 changed files with 24 additions and 14 deletions

View File

@ -16,6 +16,7 @@
* IE: "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)" * IE: "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)"
* Firefox: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0) Gecko/20100101 Firefox/4.0" * Firefox: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0) Gecko/20100101 Firefox/4.0"
* iPhone: "Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5" * iPhone: "Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5"
* iPad: "Mozilla/5.0 (iPad; U; CPU OS 4_3_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8H7 Safari/6533.18.5",
* Android: "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; T-Mobile G2 Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1" * Android: "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; T-Mobile G2 Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
*/ */
@ -25,6 +26,7 @@
, chrome = /chrome/i.test(ua) , chrome = /chrome/i.test(ua)
, safari = /safari/i.test(ua) && !chrome , safari = /safari/i.test(ua) && !chrome
, iphone = /iphone/i.test(ua) , iphone = /iphone/i.test(ua)
, ipad = /ipad/i.test(ua)
, android = /android/i.test(ua) , android = /android/i.test(ua)
, opera = /opera/i.test(ua) , opera = /opera/i.test(ua)
, firefox = /firefox/i.test(ua) , firefox = /firefox/i.test(ua)
@ -46,6 +48,14 @@
webkit: t webkit: t
, iphone: t , iphone: t
, mobile: t , mobile: t
, ios: t
, version: ua.match(webkitVersion)[1]
}
if (ipad) return {
webkit: t
, ipad: t
, mobile: t
, ios: t
, version: ua.match(webkitVersion)[1] , version: ua.match(webkitVersion)[1]
} }
if (android) return { if (android) return {
@ -79,18 +89,18 @@
// Graded Browser Support // Graded Browser Support
// http://developer.yahoo.com/yui/articles/gbs // http://developer.yahoo.com/yui/articles/gbs
if ((bowser.msie && bowser.version >= 6) || if ((bowser.msie && bowser.version >= 6) ||
(bowser.chrome && bowser.version >= 8) || (bowser.chrome && bowser.version >= 10) ||
(bowser.firefox && bowser.version >= 3.6) || (bowser.firefox && bowser.version >= 4.0) ||
(bowser.safari && bowser.version >= 5) || (bowser.safari && bowser.version >= 5) ||
(bowser.opera && bowser.version >= 9.5)) { (bowser.opera && bowser.version >= 10.0)) {
bowser.a = t; bowser.a = t;
} }
else if ((bowser.msie && bowser.version < 6) || else if ((bowser.msie && bowser.version < 6) ||
(bowser.chrome && bowser.version < 8) || (bowser.chrome && bowser.version < 10) ||
(bowser.firefox && bowser.version < 3.6) || (bowser.firefox && bowser.version < 4.0) ||
(bowser.safari && bowser.version < 5) || (bowser.safari && bowser.version < 5) ||
(bowser.opera && bowser.version < 9.5)) { (bowser.opera && bowser.version < 10.0)) {
bowser.c = t bowser.c = t
} else bowser.x = t } else bowser.x = t

2
bowser.min.js vendored
View File

@ -3,4 +3,4 @@
* https://github.com/ded/bowser * https://github.com/ded/bowser
* MIT License | (c) Dustin Diaz 2011 * MIT License | (c) Dustin Diaz 2011
*/ */
!function(a,b){typeof define=="function"?define(b):typeof module!="undefined"&&module.exports?module.exports.browser=b():this[a]=b()}("bowser",function(){function l(){if(c)return{msie:b,version:a.match(/msie (\d+(\.\d+)?);/i)[1]};if(d)return{webkit:b,chrome:b,version:a.match(/chrome\/(\d+(\.\d+)?)/i)[1]};if(f)return{webkit:b,iphone:b,mobile:b,version:a.match(k)[1]};if(g)return{webkit:b,android:b,mobile:b,version:a.match(k)[1]};if(e)return{webkit:b,safari:b,version:a.match(k)[1]};if(h)return{opera:b,version:a.match(k)[1]};if(j){var l={gecko:b,version:a.match(/firefox\/(\d+(\.\d+)?)/i)[1]};return i&&(l.firefox=b),l}}var a=navigator.userAgent,b=!0,c=/msie/i.test(a),d=/chrome/i.test(a),e=/safari/i.test(a)&&!d,f=/iphone/i.test(a),g=/android/i.test(a),h=/opera/i.test(a),i=/firefox/i.test(a),j=/gecko\//i.test(a),k=/version\/(\d+(\.\d+)?)/i,m=l();return m.msie&&m.version>=6||m.chrome&&m.version>=8||m.firefox&&m.version>=3.6||m.safari&&m.version>=5||m.opera&&m.version>=9.5?m.a=b:m.msie&&m.version<6||m.chrome&&m.version<8||m.firefox&&m.version<3.6||m.safari&&m.version<5||m.opera&&m.version<9.5?m.c=b:m.x=b,m}) !function(a,b){typeof define=="function"?define(b):typeof module!="undefined"&&module.exports?module.exports.browser=b():this[a]=b()}("bowser",function(){function m(){if(c)return{msie:b,version:a.match(/msie (\d+(\.\d+)?);/i)[1]};if(d)return{webkit:b,chrome:b,version:a.match(/chrome\/(\d+(\.\d+)?)/i)[1]};if(f)return{webkit:b,iphone:b,mobile:b,ios:b,version:a.match(l)[1]};if(g)return{webkit:b,ipad:b,mobile:b,ios:b,version:a.match(l)[1]};if(h)return{webkit:b,android:b,mobile:b,version:a.match(l)[1]};if(e)return{webkit:b,safari:b,version:a.match(l)[1]};if(i)return{opera:b,version:a.match(l)[1]};if(k){var m={gecko:b,version:a.match(/firefox\/(\d+(\.\d+)?)/i)[1]};return j&&(m.firefox=b),m}}var a=navigator.userAgent,b=!0,c=/msie/i.test(a),d=/chrome/i.test(a),e=/safari/i.test(a)&&!d,f=/iphone/i.test(a),g=/ipad/i.test(a),h=/android/i.test(a),i=/opera/i.test(a),j=/firefox/i.test(a),k=/gecko\//i.test(a),l=/version\/(\d+(\.\d+)?)/i,n=m();return n.msie&&n.version>=6||n.chrome&&n.version>=10||n.firefox&&n.version>=4||n.safari&&n.version>=5||n.opera&&n.version>=10?n.a=b:n.msie&&n.version<6||n.chrome&&n.version<10||n.firefox&&n.version<4||n.safari&&n.version<5||n.opera&&n.version<10?n.c=b:n.x=b,n})

View File

@ -2,7 +2,7 @@
"name": "bowser" "name": "bowser"
, "description": "a browser detector" , "description": "a browser detector"
, "keywords": ["ender", "browser", "sniff", "detection"] , "keywords": ["ender", "browser", "sniff", "detection"]
, "version": "0.0.7" , "version": "0.0.8"
, "homepage": "https://github.com/ded/bowser" , "homepage": "https://github.com/ded/bowser"
, "author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)" , "author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)"
, "main": "./bowser.js" , "main": "./bowser.js"

View File

@ -84,18 +84,18 @@
// Graded Browser Support // Graded Browser Support
// http://developer.yahoo.com/yui/articles/gbs // http://developer.yahoo.com/yui/articles/gbs
if ((bowser.msie && bowser.version >= 6) || if ((bowser.msie && bowser.version >= 6) ||
(bowser.chrome && bowser.version >= 8) || (bowser.chrome && bowser.version >= 10) ||
(bowser.firefox && bowser.version >= 3.6) || (bowser.firefox && bowser.version >= 4.0) ||
(bowser.safari && bowser.version >= 5) || (bowser.safari && bowser.version >= 5) ||
(bowser.opera && bowser.version >= 9.5)) { (bowser.opera && bowser.version >= 10.0)) {
bowser.a = t; bowser.a = t;
} }
else if ((bowser.msie && bowser.version < 6) || else if ((bowser.msie && bowser.version < 6) ||
(bowser.chrome && bowser.version < 8) || (bowser.chrome && bowser.version < 10) ||
(bowser.firefox && bowser.version < 3.6) || (bowser.firefox && bowser.version < 4.0) ||
(bowser.safari && bowser.version < 5) || (bowser.safari && bowser.version < 5) ||
(bowser.opera && bowser.version < 9.5)) { (bowser.opera && bowser.version < 10.0)) {
bowser.c = t bowser.c = t
} else bowser.x = t } else bowser.x = t