mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Merge branch 'expand-browser-support' of https://github.com/Jimdo/bowser into make-testable-and-add-tests
Conflicts: src/bowser.js src/useragents.js
This commit is contained in:
commit
ebfaba07e5
14
README.md
14
README.md
@ -13,11 +13,21 @@ if (bowser.msie && bowser.version <= 6) {
|
||||
Detected Browsers
|
||||
-----
|
||||
|
||||
* msie
|
||||
* safari[webkit]
|
||||
* android
|
||||
* blackberry
|
||||
* chrome[webkit]
|
||||
* firefox[gecko]
|
||||
* ipad
|
||||
* iphone
|
||||
* ipod
|
||||
* msie
|
||||
* opera
|
||||
* phantomjs
|
||||
* safari[webkit]
|
||||
* seamonkey
|
||||
* touchpad
|
||||
* webos
|
||||
* windows phone
|
||||
|
||||
Notes
|
||||
----
|
||||
|
@ -1,9 +1,9 @@
|
||||
!function (name, definition) {
|
||||
if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition()
|
||||
else if (typeof define == 'function') define(definition)
|
||||
if (typeof define == 'function') define(definition)
|
||||
else if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition()
|
||||
else this[name] = definition()
|
||||
}('bowser', function () {
|
||||
/**
|
||||
/**
|
||||
* See useragents.js for examples of navigator.userAgent
|
||||
*/
|
||||
|
||||
@ -26,13 +26,21 @@
|
||||
, firefox = /firefox/i.test(ua)
|
||||
, gecko = /gecko\//i.test(ua)
|
||||
, seamonkey = /seamonkey\//i.test(ua)
|
||||
, webos = /webos/i.test(ua)
|
||||
, windowsphone = /windows phone/i.test(ua)
|
||||
, blackberry = /blackberry/i.test(ua)
|
||||
, webkitVersion = /version\/(\d+(\.\d+)?)/i
|
||||
// , firefoxVersion = /firefox\/(\d+(\.\d+)?)/i
|
||||
, firefoxVersion = /firefox[ \/](\d+(\.\d+)?)/i
|
||||
, mobile = /mobile/i.test(ua)
|
||||
, o = {}
|
||||
|
||||
if (opera) {
|
||||
if (windowsphone) o = {
|
||||
name: 'Windows Phone'
|
||||
, windowsphone: t
|
||||
, mobile: t
|
||||
, version: ua.match(/iemobile\/(\d+(\.\d+)?)/i)[1]
|
||||
}
|
||||
else if (opera) {
|
||||
if ((v = ua.match(webkitVersion)) && v.length > 1) v = v[1]
|
||||
else if ((v = ua.match(/opr\/(\d+(\.\d+)?)/i)) && v.length > 1) v = v[1]
|
||||
else if ((v = ua.match(/opera[ \/](\d+(\.\d+)?)/i)) && v.length > 1) v = v[1]
|
||||
@ -84,10 +92,11 @@
|
||||
, version : ua.match(/silk\/(\d+(\.\d+)?)/i)[1]
|
||||
}
|
||||
else if (iphone || ipad || ipod) {
|
||||
if (ipod) iphone = false
|
||||
o = {
|
||||
name : iphone ? 'iPhone' : ipad ? 'iPad' : 'iPod'
|
||||
, webkit: t
|
||||
, mobile: iphone
|
||||
, mobile: t
|
||||
, ios: t
|
||||
, iphone: iphone
|
||||
, ipad: ipad
|
||||
@ -98,6 +107,26 @@
|
||||
o.version = ua.match(webkitVersion)[1]
|
||||
}
|
||||
}
|
||||
else if (blackberry) {
|
||||
o = {
|
||||
name: 'BlackBerry'
|
||||
, blackberry: t
|
||||
, mobile: t
|
||||
}
|
||||
if ((v = ua.match(webkitVersion))) {
|
||||
o.version = v[1]
|
||||
o.webkit = t
|
||||
} else {
|
||||
o.version = ua.match(/blackberry[\d]+\/(\d+(\.\d+)?)/i)[1]
|
||||
}
|
||||
}
|
||||
else if (webos) o = {
|
||||
name: 'WebOS'
|
||||
, mobile: t
|
||||
, webkit: t
|
||||
, webos: t
|
||||
, version: (ua.match(webkitVersion) || ua.match(/wosbrowser\/(\d+(\.\d+)?)/i))[1]
|
||||
}
|
||||
else if (android) o = {
|
||||
name: 'Android'
|
||||
, webkit: t
|
||||
|
@ -386,7 +386,7 @@ module.exports.useragents = {
|
||||
, iphone: false
|
||||
, ipad: true
|
||||
, ipod: false
|
||||
, mobile: false
|
||||
, mobile: true
|
||||
, webkit: true
|
||||
, x: true
|
||||
}
|
||||
@ -397,7 +397,7 @@ module.exports.useragents = {
|
||||
, iphone: false
|
||||
, ipad: true
|
||||
, ipod: false
|
||||
, mobile: false
|
||||
, mobile: true
|
||||
, webkit: true
|
||||
, x: true
|
||||
}
|
||||
@ -408,7 +408,7 @@ module.exports.useragents = {
|
||||
, iphone: false
|
||||
, ipad: true
|
||||
, ipod: false
|
||||
, mobile: false
|
||||
, mobile: true
|
||||
, webkit: true
|
||||
, x: true
|
||||
}
|
||||
@ -419,11 +419,90 @@ module.exports.useragents = {
|
||||
, iphone: false
|
||||
, ipad: true
|
||||
, ipod: false
|
||||
, mobile: false
|
||||
, mobile: true
|
||||
, webkit: true
|
||||
, x: true
|
||||
}
|
||||
}
|
||||
, iPod: {
|
||||
'Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5': {
|
||||
ios: true
|
||||
, version: '5.0'
|
||||
, iphone: false
|
||||
, ipad: false
|
||||
, ipod: true
|
||||
, mobile: true
|
||||
, webkit: true
|
||||
, x: true
|
||||
}
|
||||
, 'Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A93 Safari/419.3': {
|
||||
ios: true
|
||||
, version: '3.0'
|
||||
, iphone: false
|
||||
, ipad: false
|
||||
, ipod: true
|
||||
, mobile: true
|
||||
, webkit: true
|
||||
, x: true
|
||||
}
|
||||
}
|
||||
, BlackBerry: {
|
||||
'Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+': {
|
||||
blackberry: true
|
||||
, version: '7.1'
|
||||
, webkit: true
|
||||
, mobile: true
|
||||
, x: true
|
||||
}
|
||||
, 'Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en-US) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.0.0.450 Mobile Safari/534.8+': {
|
||||
blackberry: true
|
||||
, version: '6.0'
|
||||
, webkit: true
|
||||
, mobile: true
|
||||
, x: true
|
||||
}
|
||||
, 'BlackBerry9800/5.0.0.862 Profile/MIDP-2.1 Configuration/CLDC-1.1 VendorID/331 UNTRUSTED/1.0 3gpp-gba': {
|
||||
blackberry: true
|
||||
, version: '5.0'
|
||||
, mobile: true
|
||||
, x: true
|
||||
}
|
||||
, 'BlackBerry8320/4.5.0.52 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/179': {
|
||||
blackberry: true
|
||||
, version: '4.5'
|
||||
, mobile: true
|
||||
, x: true
|
||||
}
|
||||
}
|
||||
, 'Windows Phone': {
|
||||
'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)': {
|
||||
windowsphone: true
|
||||
, version: '10.0'
|
||||
, mobile: true
|
||||
, x: true
|
||||
}
|
||||
, 'Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0)': {
|
||||
windowsphone: true
|
||||
, version: '9.0'
|
||||
, mobile: true
|
||||
, x: true
|
||||
}
|
||||
, 'Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0; Nokia;N70)': {
|
||||
windowsphone: true
|
||||
, version: '7.0'
|
||||
, mobile: true
|
||||
, x: true
|
||||
}
|
||||
}
|
||||
, WebOS: {
|
||||
'Mozilla/5.0 (webOS/1.0; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pre/1.0': {
|
||||
webos: true
|
||||
, webkit: true
|
||||
, version: '1.0'
|
||||
, mobile: true
|
||||
, x: true
|
||||
}
|
||||
}
|
||||
, 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: true
|
||||
|
Loading…
Reference in New Issue
Block a user