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

- add touchpad support

- upgrade graded support
This commit is contained in:
Dustin Diaz 2012-04-16 18:54:24 -07:00
parent f381b9373b
commit 975a408f15
4 changed files with 10 additions and 10 deletions

View File

@ -19,7 +19,7 @@
* 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"
* Touchpad: "Mozilla/5.0 (hp-tabled;Linux;hpwOS/3.0.5; U; en-US)) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/234.83 Safari/534.6 TouchPad/1.0"
*/
*/
var ua = navigator.userAgent
, t = true
@ -27,7 +27,7 @@
, chrome = /chrome/i.test(ua)
, safari = /safari/i.test(ua) && !chrome
, iphone = /iphone/i.test(ua)
, ipad = /ipad/i.test(ua)
, ipad = /ipad/i.test(ua)
, touchpad = /touchpad/i.test(ua)
, android = /android/i.test(ua)
, opera = /opera/i.test(ua)
@ -101,7 +101,7 @@
// Graded Browser Support
// http://developer.yahoo.com/yui/articles/gbs
if ((bowser.msie && bowser.version >= 6) ||
if ((bowser.msie && bowser.version >= 7) ||
(bowser.chrome && bowser.version >= 10) ||
(bowser.firefox && bowser.version >= 4.0) ||
(bowser.safari && bowser.version >= 5) ||
@ -109,7 +109,7 @@
bowser.a = t;
}
else if ((bowser.msie && bowser.version < 6) ||
else if ((bowser.msie && bowser.version < 7) ||
(bowser.chrome && bowser.version < 10) ||
(bowser.firefox && bowser.version < 4.0) ||
(bowser.safari && bowser.version < 5) ||

4
bowser.min.js vendored
View File

@ -2,5 +2,5 @@
* Bowser - a browser detector
* https://github.com/ded/bowser
* MIT License | (c) Dustin Diaz 2011
*/
!function(a,b){if(typeof define=="function"){define(b)}else{if(typeof module!="undefined"&&module.exports){module.exports.browser=b()}else{this[a]=b()}}}("bowser",function(){var d=navigator.userAgent,r=true,b=/msie/i.test(d),l=/chrome/i.test(d),c=/safari/i.test(d)&&!l,p=/iphone/i.test(d),q=/ipad/i.test(d),n=/touchpad/i.test(d),i=/android/i.test(d),j=/opera/i.test(d),m=/firefox/i.test(d),h=/gecko\//i.test(d),f=/seamonkey\//i.test(d),a=/version\/(\d+(\.\d+)?)/i,g;function e(){if(b){return{msie:r,version:d.match(/msie (\d+(\.\d+)?);/i)[1]}}if(l){return{webkit:r,chrome:r,version:d.match(/chrome\/(\d+(\.\d+)?)/i)[1]}}if(n){return{webkit:r,touchpad:r,version:d.match(/touchpad\/(\d+(\.\d+)?)/i)[1]}}if(p||q){g={webkit:r,mobile:r,ios:r,iphone:p,ipad:q};if(a.test(d)){g.version=d.match(a)[1]}return g}if(i){return{webkit:r,android:r,mobile:r,version:d.match(a)[1]}}if(c){return{webkit:r,safari:r,version:d.match(a)[1]}}if(j){return{opera:r,version:d.match(a)[1]}}if(h){g={gecko:r,mozilla:r,version:d.match(/firefox\/(\d+(\.\d+)?)/i)[1]};if(m){g.firefox=r}return g}if(f){return{seamonkey:r,version:d.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]}}}var k=e();if((k.msie&&k.version>=6)||(k.chrome&&k.version>=10)||(k.firefox&&k.version>=4)||(k.safari&&k.version>=5)||(k.opera&&k.version>=10)){k.a=r}else{if((k.msie&&k.version<6)||(k.chrome&&k.version<10)||(k.firefox&&k.version<4)||(k.safari&&k.version<5)||(k.opera&&k.version<10)){k.c=r}else{k.x=r}}return k});
*/
!function(a,b){typeof define=="function"?define(b):typeof module!="undefined"&&module.exports?module.exports.browser=b():this[a]=b()}("bowser",function(){function p(){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(h)return{webkit:b,touchpad:b,version:a.match(/touchpad\/(\d+(\.\d+)?)/i)[1]};if(f||g){o={webkit:b,mobile:b,ios:b,iphone:f,ipad:g},n.test(a)&&(o.version=a.match(n)[1]);return o}if(i)return{webkit:b,android:b,mobile:b,version:a.match(n)[1]};if(e)return{webkit:b,safari:b,version:a.match(n)[1]};if(j)return{opera:b,version:a.match(n)[1]};if(l){o={gecko:b,mozilla:b,version:a.match(/firefox\/(\d+(\.\d+)?)/i)[1]},k&&(o.firefox=b);return o}if(m)return{seamonkey:b,version:a.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]}}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=/touchpad/i.test(a),i=/android/i.test(a),j=/opera/i.test(a),k=/firefox/i.test(a),l=/gecko\//i.test(a),m=/seamonkey\//i.test(a),n=/version\/(\d+(\.\d+)?)/i,o,q=p();q.msie&&q.version>=7||q.chrome&&q.version>=10||q.firefox&&q.version>=4||q.safari&&q.version>=5||q.opera&&q.version>=10?q.a=b:q.msie&&q.version<7||q.chrome&&q.version<10||q.firefox&&q.version<4||q.safari&&q.version<5||q.opera&&q.version<10?q.c=b:q.x=b;return q})

View File

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

View File

@ -14,7 +14,7 @@
* 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"
* Touchpad: "Mozilla/5.0 (hp-tabled;Linux;hpwOS/3.0.5; U; en-US)) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/234.83 Safari/534.6 TouchPad/1.0"
*/
*/
var ua = navigator.userAgent
, t = true
@ -96,7 +96,7 @@
// Graded Browser Support
// http://developer.yahoo.com/yui/articles/gbs
if ((bowser.msie && bowser.version >= 6) ||
if ((bowser.msie && bowser.version >= 7) ||
(bowser.chrome && bowser.version >= 10) ||
(bowser.firefox && bowser.version >= 4.0) ||
(bowser.safari && bowser.version >= 5) ||
@ -104,7 +104,7 @@
bowser.a = t;
}
else if ((bowser.msie && bowser.version < 6) ||
else if ((bowser.msie && bowser.version < 7) ||
(bowser.chrome && bowser.version < 10) ||
(bowser.firefox && bowser.version < 4.0) ||
(bowser.safari && bowser.version < 5) ||