rebuild and new relase for IE, Opera, & Phantom

cut v0.3
pull/23/head
Dustin Diaz 11 years ago
parent eb7a857e5f
commit 541fab750e

@ -14,6 +14,7 @@
* Opera: "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.7; U; en) Presto/2.7.62 Version/11.01"
* Safari: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1"
* 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>=11: "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; Media Center PC 6.0; rv:11.0) like Gecko"
* 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"
* 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",
@ -24,7 +25,7 @@
var ua = navigator.userAgent
, t = true
, ie = /msie/i.test(ua)
, ie = /(msie|trident)/i.test(ua)
, chrome = /chrome/i.test(ua)
, phantom = /phantom/i.test(ua)
, safari = /safari/i.test(ua) && !chrome && !phantom
@ -32,7 +33,7 @@
, ipad = /ipad/i.test(ua)
, touchpad = /touchpad/i.test(ua)
, android = /android/i.test(ua)
, opera = /opera/i.test(ua)
, opera = /opera/i.test(ua) || /opr/i.test(ua)
, firefox = /firefox/i.test(ua)
, gecko = /gecko\//i.test(ua)
, seamonkey = /seamonkey\//i.test(ua)
@ -44,30 +45,34 @@
if (ie) return {
msie: t
, version: ua.match(/msie (\d+(\.\d+)?);/i)[1]
}
, version: ua.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]
}
if (opera) return {
opera: t
, version: ua.match(webkitVersion) ? ua.match(webkitVersion)[1] : ua.match(/opr\/(\d+(\.\d+)?)/i)
}
if (chrome) return {
webkit: t
, chrome: t
, version: ua.match(/chrome\/(\d+(\.\d+)?)/i)[1]
}
}
if (phantom) return {
webkit: t
, phantom: t
, version: ua.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]
}
}
if (touchpad) return {
webkit: t
, touchpad: t
, version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1]
}
}
if (iphone || ipad) {
o = {
webkit: t
, mobile: t
, ios: t
, iphone: iphone
, ipad: ipad
webkit: t
, mobile: t
, ios: t
, iphone: iphone
, ipad: ipad
}
// WTF: version is not part of user agent in web apps
if (webkitVersion.test(ua)) {
@ -80,21 +85,17 @@
, android: t
, mobile: t
, version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1]
}
}
if (safari) return {
webkit: t
, safari: t
, version: ua.match(webkitVersion)[1]
}
if (opera) return {
opera: t
, version: ua.match(webkitVersion)[1]
}
}
if (gecko) {
o = {
gecko: t
, mozilla: t
, version: ua.match(firefoxVersion)[1]
gecko: t
, mozilla: t
, version: ua.match(firefoxVersion)[1]
}
if (firefox) o.firefox = t
return o
@ -102,7 +103,8 @@
if (seamonkey) return {
seamonkey: t
, version: ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
}
}
return {}
}
var bowser = detect()

2
bowser.min.js vendored

@ -3,4 +3,4 @@
* https://github.com/ded/bowser
* MIT License | (c) Dustin Diaz 2011
*/
!function(e,t){typeof define=="function"?define(t):typeof module!="undefined"&&module.exports?module.exports.browser=t():this[e]=t()}("bowser",function(){function g(){if(n)return{msie:t,version:e.match(/msie (\d+(\.\d+)?);/i)[1]};if(r)return{webkit:t,chrome:t,version:e.match(/chrome\/(\d+(\.\d+)?)/i)[1]};if(i)return{webkit:t,phantom:t,version:e.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]};if(a)return{webkit:t,touchpad:t,version:e.match(/touchpad\/(\d+(\.\d+)?)/i)[1]};if(o||u)return m={webkit:t,mobile:t,ios:t,iphone:o,ipad:u},d.test(e)&&(m.version=e.match(d)[1]),m;if(f)return{webkit:t,android:t,mobile:t,version:(e.match(d)||e.match(v))[1]};if(s)return{webkit:t,safari:t,version:e.match(d)[1]};if(l)return{opera:t,version:e.match(d)[1]};if(h)return m={gecko:t,mozilla:t,version:e.match(v)[1]},c&&(m.firefox=t),m;if(p)return{seamonkey:t,version:e.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]}}var e=navigator.userAgent,t=!0,n=/msie/i.test(e),r=/chrome/i.test(e),i=/phantom/i.test(e),s=/safari/i.test(e)&&!r&&!i,o=/iphone/i.test(e),u=/ipad/i.test(e),a=/touchpad/i.test(e),f=/android/i.test(e),l=/opera/i.test(e),c=/firefox/i.test(e),h=/gecko\//i.test(e),p=/seamonkey\//i.test(e),d=/version\/(\d+(\.\d+)?)/i,v=/firefox\/(\d+(\.\d+)?)/i,m,y=g();return y.msie&&y.version>=7||y.chrome&&y.version>=10||y.firefox&&y.version>=4||y.safari&&y.version>=5||y.opera&&y.version>=10?y.a=t:y.msie&&y.version<7||y.chrome&&y.version<10||y.firefox&&y.version<4||y.safari&&y.version<5||y.opera&&y.version<10?y.c=t:y.x=t,y})
!function(e,t){typeof define=="function"?define(t):typeof module!="undefined"&&module.exports?module.exports.browser=t():this[e]=t()}("bowser",function(){function g(){return n?{msie:t,version:e.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]}:l?{opera:t,version:e.match(d)?e.match(d)[1]:e.match(/opr\/(\d+(\.\d+)?)/i)}:r?{webkit:t,chrome:t,version:e.match(/chrome\/(\d+(\.\d+)?)/i)[1]}:i?{webkit:t,phantom:t,version:e.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]}:a?{webkit:t,touchpad:t,version:e.match(/touchpad\/(\d+(\.\d+)?)/i)[1]}:o||u?(m={webkit:t,mobile:t,ios:t,iphone:o,ipad:u},d.test(e)&&(m.version=e.match(d)[1]),m):f?{webkit:t,android:t,mobile:t,version:(e.match(d)||e.match(v))[1]}:s?{webkit:t,safari:t,version:e.match(d)[1]}:h?(m={gecko:t,mozilla:t,version:e.match(v)[1]},c&&(m.firefox=t),m):p?{seamonkey:t,version:e.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]}:{}}var e=navigator.userAgent,t=!0,n=/(msie|trident)/i.test(e),r=/chrome/i.test(e),i=/phantom/i.test(e),s=/safari/i.test(e)&&!r&&!i,o=/iphone/i.test(e),u=/ipad/i.test(e),a=/touchpad/i.test(e),f=/android/i.test(e),l=/opera/i.test(e)||/opr/i.test(e),c=/firefox/i.test(e),h=/gecko\//i.test(e),p=/seamonkey\//i.test(e),d=/version\/(\d+(\.\d+)?)/i,v=/firefox\/(\d+(\.\d+)?)/i,m,y=g();return y.msie&&y.version>=7||y.chrome&&y.version>=10||y.firefox&&y.version>=4||y.safari&&y.version>=5||y.opera&&y.version>=10?y.a=t:y.msie&&y.version<7||y.chrome&&y.version<10||y.firefox&&y.version<4||y.safari&&y.version<5||y.opera&&y.version<10?y.c=t:y.x=t,y})

@ -18,9 +18,8 @@ require('smoosh').config({
, "sub": true
, "white": false
, "indent": 2
, "whitespace": true
, "asi": true
, "laxbreak": true
, "laxcomma": true
}
}).run().build().analyze()
}).run().build().analyze()

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

@ -41,33 +41,33 @@
if (ie) return {
msie: t
, version: ua.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]
}
}
if (opera) return {
opera: t
, version: ua.match(webkitVersion) ? ua.match(webkitVersion)[1] : ua.match(/opr\/(\d+(\.\d+)?)/i)
}
}
if (chrome) return {
webkit: t
, chrome: t
, version: ua.match(/chrome\/(\d+(\.\d+)?)/i)[1]
}
}
if (phantom) return {
webkit: t
, phantom: t
, version: ua.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]
}
}
if (touchpad) return {
webkit: t
, touchpad: t
, version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1]
}
}
if (iphone || ipad) {
o = {
webkit: t
, mobile: t
, ios: t
, iphone: iphone
, ipad: ipad
webkit: t
, mobile: t
, ios: t
, iphone: iphone
, ipad: ipad
}
// WTF: version is not part of user agent in web apps
if (webkitVersion.test(ua)) {
@ -80,17 +80,17 @@
, android: t
, mobile: t
, version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1]
}
}
if (safari) return {
webkit: t
, safari: t
, version: ua.match(webkitVersion)[1]
}
}
if (gecko) {
o = {
gecko: t
, mozilla: t
, version: ua.match(firefoxVersion)[1]
gecko: t
, mozilla: t
, version: ua.match(firefoxVersion)[1]
}
if (firefox) o.firefox = t
return o
@ -98,7 +98,7 @@
if (seamonkey) return {
seamonkey: t
, version: ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
}
}
return {}
}

@ -1,5 +1,5 @@
/*!
* Bowser - a browser detector
* https://github.com/ded/bowser
* MIT License | (c) Dustin Diaz 2011
*/
* MIT License | (c) Dustin Diaz 2013
*/

Loading…
Cancel
Save