From 975a408f15458bbf9daf492f4f9045576e8ba37e Mon Sep 17 00:00:00 2001 From: Dustin Diaz Date: Mon, 16 Apr 2012 18:54:24 -0700 Subject: [PATCH] - add touchpad support - upgrade graded support --- bowser.js | 8 ++++---- bowser.min.js | 4 ++-- package.json | 2 +- src/bowser.js | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bowser.js b/bowser.js index 44c2b9d..4636072 100644 --- a/bowser.js +++ b/bowser.js @@ -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) || diff --git a/bowser.min.js b/bowser.min.js index fde6978..61d37dd 100644 --- a/bowser.min.js +++ b/bowser.min.js @@ -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}); \ No newline at end of file + */ +!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}) \ No newline at end of file diff --git a/package.json b/package.json index aefa947..bee8c49 100644 --- a/package.json +++ b/package.json @@ -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 (http://dustindiaz.com)" , "main": "./bowser.js" diff --git a/src/bowser.js b/src/bowser.js index 9c376d5..3b81fc5 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -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) ||