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

Set mobile, ipad/iphone/android for Chrome running on those platforms.

This commit is contained in:
Tim 'mithro' Ansell 2013-12-16 12:51:09 +11:00
parent 88589615f4
commit 78b7ada2fa

View File

@ -48,12 +48,26 @@
, opera: t
, version: ua.match(webkitVersion) ? ua.match(webkitVersion)[1] : ua.match(/opr\/(\d+(\.\d+)?)/i)[1]
}
if (chrome) return {
if (chrome) {
o = {
name: 'Chrome'
, webkit: t
, chrome: t
, version: ua.match(/(?:chrome|crios)\/(\d+(\.\d+)?)/i)[1]
}
// Chrome for Android
if (android) {
o.android = t;
o.mobile = t;
}
// Chrome for iOS
if (iphone || ipad) {
o.ios = t;
o.iphone = iphone;
o.ipad = ipad;
}
return o
}
if (phantom) return {
name: 'PhantomJS'
, webkit: t
@ -81,13 +95,6 @@
}
return o
}
if (android) return {
name: 'Android'
, webkit: t
, android: t
, mobile: t
, version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1]
}
if (safari) return {
name: 'Safari'
, webkit: t
@ -105,6 +112,11 @@
o.name = 'Firefox';
o.firefox = t;
}
// Firefox for Android
if (android) {
o.android = t;
o.mobile = t;
}
return o
}
if (seamonkey) return {
@ -112,6 +124,14 @@
, seamonkey: t
, version: ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
}
// Android browser/webview (not Firefox/Chrome running on Android)
if (android) return {
name: 'Android'
, webkit: t
, android: t
, mobile: t
, version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1]
}
return {}
}