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

Merge pull request #48 from BendingBender/refactor-duplications

Refactor duplications, add sailfish, prevent executing all regex matching upfront
This commit is contained in:
Dustin Diaz 2014-03-01 10:12:39 -08:00
commit 62d192e61a
5 changed files with 352 additions and 391 deletions

View File

@ -29,6 +29,7 @@ Flags set for detected Browsers[Engines]
* Amazon Kindle browser as `silk`[`webkit`] * Amazon Kindle browser as `silk`[`webkit`]
* Bada browser as `bada`[`webkit`] * Bada browser as `bada`[`webkit`]
* Tizen browser as `tizen`[`webkit`] * Tizen browser as `tizen`[`webkit`]
* Sailfish browser as `sailfish`[`gecko`]
For all detected browsers the browser version is set in the `version` field. For all detected browsers the browser version is set in the `version` field.
@ -43,6 +44,7 @@ Flags set for detected mobile Operating Systems
* `webos` (`touchpad`) * `webos` (`touchpad`)
* `bada` * `bada`
* `tizen` * `tizen`
* `sailfish`
Android, iOS, Windows Phone, WebOS, Bada, and Tizen will all report the OS version number if it is contained in the UA string in the `osversion` field. iOS is always reported as `ios` and additionally as `iphone`/`ipad`/`ipod`, whichever one matches best. If WebOS device is an HP TouchPad the flag `touchpad` is additionally set. Android, iOS, Windows Phone, WebOS, Bada, and Tizen will all report the OS version number if it is contained in the UA string in the `osversion` field. iOS is always reported as `ios` and additionally as `iphone`/`ipad`/`ipod`, whichever one matches best. If WebOS device is an HP TouchPad the flag `touchpad` is additionally set.

322
bowser.js
View File

@ -13,234 +13,216 @@
* See useragents.js for examples of navigator.userAgent * See useragents.js for examples of navigator.userAgent
*/ */
var t = true, var t = true
v /* temporary placeholder for versions. */
function getVersion(ua, regex, matchedIdx) {
var match = ua.match(regex);
return (match && match.length > matchedIdx && match[matchedIdx]) || 0;
}
function detect(ua) { function detect(ua) {
var ie = /(msie|trident)/i.test(ua) function getFirstMatch(regex) {
, chrome = /chrome|crios|crmo/i.test(ua) var match = ua.match(regex);
, phantom = /phantom/i.test(ua) return (match && match.length > 1 && match[1]) || '';
, iphone = /iphone/i.test(ua) }
, ipad = /ipad/i.test(ua)
, ipod = /ipod/i.test(ua) var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()
, silk = /silk/i.test(ua) , likeAndroid = /like android/i.test(ua)
, safari = /safari/i.test(ua) && !chrome && !phantom && !silk , android = !likeAndroid && /android/i.test(ua)
, android = /android/i.test(ua) , versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i)
, opera = /opera/i.test(ua) || /opr/i.test(ua)
, firefox = /(firefox|iceweasel)/i.test(ua)
, gecko = /gecko\//i.test(ua)
, seamonkey = /seamonkey\//i.test(ua)
, webos = /(?:web|hpw)os/i.test(ua)
, touchpad = /touchpad\//i.test(ua)
, windowsphone = /windows phone/i.test(ua)
, blackberry = /(blackberry|\bbb\d+)/i.test(ua)
, rimtablet = /rim\stablet/i.test(ua)
, bada = /bada/i.test(ua)
, tizen = /tizen/i.test(ua)
, webkitVersion = /version\/(\d+(\.\d+)?)/i
, firefoxVersion = /(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i
, mobile = /mobi/i.test(ua)
, tablet = /tablet/i.test(ua) , tablet = /tablet/i.test(ua)
, o = {} , mobile = !tablet && /[^-]mobi/i.test(ua)
, result
if (ipod) iphone = false if (/opera|opr/i.test(ua)) {
result = {
if (windowsphone) o = { name: 'Opera'
, opera: t
, version: versionIdentifier || getFirstMatch(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)
}
}
else if (/windows phone/i.test(ua)) {
result = {
name: 'Windows Phone' name: 'Windows Phone'
, windowsphone: t , windowsphone: t
, msie: t , msie: t
, version: getVersion(ua, /iemobile\/(\d+(\.\d+)?)/i, 1) , version: getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i)
}
else if (opera) {
v = getVersion(ua, webkitVersion, 1) ||
getVersion(ua, /opr\/(\d+(\.\d+)?)/i, 1) ||
getVersion(ua, /opera[ \/](\d+(\.\d+)?)/i, 1);
o = {
name: 'Opera'
, opera: t
, version: v
}
if (android) {
o.android = t
}
if (chrome) {
o.webkit = t
} }
} }
else if (ie) o = { else if (/msie|trident/i.test(ua)) {
result = {
name: 'Internet Explorer' name: 'Internet Explorer'
, msie: t , msie: t
, version: getVersion(ua, /(msie |rv:)(\d+(\.\d+)?)/i, 2) , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i)
} }
else if (chrome) { }
o = { else if (/chrome|crios|crmo/i.test(ua)) {
result = {
name: 'Chrome' name: 'Chrome'
, webkit: t
, chrome: t , chrome: t
, version: getVersion(ua, /(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i, 1) , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
}
if (android) o.android = t
if (ipad || ipod || iphone) {
o[iphone ? 'iphone' : ipad ? 'ipad' : 'ipod'] = t
o.ios = t
} }
} }
else if (phantom) o = { else if (iosdevice) {
name: 'PhantomJS' result = {
, webkit: t name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'
, phantom: t
, version: getVersion(ua, /phantomjs\/(\d+(\.\d+)?)/i, 1)
} }
else if (silk) o = { // WTF: version is not part of user agent in web apps
if (versionIdentifier) {
result.version = versionIdentifier
}
}
else if (/sailfish/i.test(ua)) {
result = {
name: 'Sailfish'
, sailfish: t
, version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i)
}
}
else if (/seamonkey\//i.test(ua)) {
result = {
name: 'SeaMonkey'
, seamonkey: t
, version: getFirstMatch(/seamonkey\/(\d+(\.\d+)?)/i)
}
}
else if (/firefox|iceweasel/i.test(ua)) {
result = {
name: 'Firefox'
, firefox: t
, version: getFirstMatch(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)
}
if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
result.firefoxos = t
}
}
else if (/silk/i.test(ua)) {
result = {
name: 'Amazon Silk' name: 'Amazon Silk'
, silk: t , silk: t
, webkit: t , version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i)
, android: t
, version : getVersion(ua, /silk\/(\d+(\.\d+)?)/i, 1)
}
else if (iphone || ipad || ipod) {
o = {
name : iphone ? 'iPhone' : ipad ? 'iPad' : 'iPod'
, webkit: t
, ios: t
}
o[iphone ? 'iphone' : ipad ? 'ipad' : 'ipod'] = t
// WTF: version is not part of user agent in web apps
if (webkitVersion.test(ua)) {
o.version = getVersion(ua, webkitVersion, 1)
} }
} }
else if (blackberry || rimtablet) { else if (android) {
o = { result = {
name: 'Android'
, version: versionIdentifier
}
}
else if (/phantom/i.test(ua)) {
result = {
name: 'PhantomJS'
, phantom: t
, version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i)
}
}
else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) {
result = {
name: 'BlackBerry' name: 'BlackBerry'
, blackberry: t , blackberry: t
} , version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i)
if ((v = getVersion(ua, webkitVersion, 1))) {
o.version = v
o.webkit = t
} else {
o.version = getVersion(ua, /blackberry[\d]+\/(\d+(\.\d+)?)/i, 1)
} }
} }
else if (webos) { else if (/(web|hpw)os/i.test(ua)) {
o = { result = {
name: 'WebOS' name: 'WebOS'
, webkit: t
, webos: t , webos: t
, version: (getVersion(ua, webkitVersion, 1) || getVersion(ua, /w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i, 1)) , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)
}; };
touchpad && (o.touchpad = t) /touchpad\//i.test(ua) && (result.touchpad = t)
} }
else if (bada) { else if (/bada/i.test(ua)) {
o = { result = {
name: 'Bada' name: 'Bada'
, webkit: t
, bada: t , bada: t
, version: getVersion(ua, /dolfin\/(\d+(\.\d+)?)/i, 1) , version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i)
}; };
} }
else if (tizen) { else if (/tizen/i.test(ua)) {
o = { result = {
name: 'Tizen' name: 'Tizen'
, webkit: t
, tizen: t , tizen: t
, version: getVersion(ua, /(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i, 1) || getVersion(ua, webkitVersion, 1) , version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier
}; };
} }
else if (gecko) { else if (/safari/i.test(ua)) {
o = { result = {
name: 'Gecko'
, gecko: t
, mozilla: t
, version: getVersion(ua, firefoxVersion, 1)
}
if (seamonkey) {
o.name = 'SeaMonkey'
o.seamonkey = t
o.version = getVersion(ua, /seamonkey\/(\d+(\.\d+)?)/i, 1)
} else if (firefox) {
o.name = 'Firefox'
o.firefox = t
}
if (android) {
o.android = t
} else if (!android && firefox && /\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
o.firefoxos = t
}
}
else if (android) o = {
name: 'Android'
, webkit: t
, android: t
, version: getVersion(ua, webkitVersion, 1)
}
else if (safari) o = {
name: 'Safari' name: 'Safari'
, webkit: t
, safari: t , safari: t
, version: getVersion(ua, webkitVersion, 1) , version: versionIdentifier
}
}
else result = {}
// set webkit or gecko flag for browsers based on these engines
if (/(apple)?webkit/i.test(ua)) {
result.name = result.name || "Webkit"
result.webkit = t
if (!result.version && versionIdentifier) {
result.version = versionIdentifier
}
} else if (!result.opera && /gecko\//i.test(ua)) {
result.name = result.name || "Gecko"
result.gecko = t
result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i)
} }
// set OS flags for platforms that have multiple browsers
if (android || result.silk) {
result.android = t
} else if (iosdevice) {
result[iosdevice] = t
result.ios = t
}
// OS version extraction // OS version extraction
var osVersion; var osVersion = '';
if (tizen) { if (iosdevice) {
osVersion = getVersion(ua, /tizen[\/\s](\d+(\.\d+)*)/i, 1); osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i);
} else if (windowsphone) { osVersion = osVersion.replace(/[_\s]/g, '.');
osVersion = getVersion(ua, /windows phone (?:os)?\s?(\d+(\.\d+)*)/i, 1);
} else if (webos) {
osVersion = getVersion(ua, /(?:web|hpw)os\/(\d+(\.\d+)*)/i, 1);
} else if (rimtablet) {
osVersion = getVersion(ua, /rim\stablet\sos\s(\d+(\.\d+)*)/i, 1);
} else if (bada) {
osVersion = getVersion(ua, /bada\/(\d+(\.\d+)*)/i, 1);
} else if (iphone || ipad || ipod) {
osVersion = getVersion(ua, /os (\d+([_\s]\d+)*) like mac os x/i, 1);
osVersion = (osVersion || "").replace(/[_\s]/g, '.');
} else if (android) { } else if (android) {
osVersion = getVersion(ua, /android[ \/-](\d+(\.\d+)*)/i, 1); osVersion = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i);
} else if (result.windowsphone) {
osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i);
} else if (result.webos) {
osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i);
} else if (result.blackberry) {
osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i);
} else if (result.bada) {
osVersion = getFirstMatch(/bada\/(\d+(\.\d+)*)/i);
} else if (result.tizen) {
osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i);
} }
if (osVersion) { if (osVersion) {
o.osversion = osVersion; result.osversion = osVersion;
} }
// device type extraction // device type extraction
var osMajorVersion = (osVersion || '').split('.')[0]; var osMajorVersion = osVersion.split('.')[0];
if (tablet || ipad || (android && (osMajorVersion == 3 || (osMajorVersion == 4 && !mobile))) || rimtablet || silk || touchpad) { if (tablet || iosdevice == 'ipad' || (android && (osMajorVersion == 3 || (osMajorVersion == 4 && !mobile))) || result.silk) {
o.tablet = t result.tablet = t
} else if (iphone || ipod || (android && mobile) || windowsphone || blackberry || webos || bada || tizen || mobile) { } else if (mobile || iosdevice == 'iphone' || iosdevice == 'ipod' || android || result.blackberry || result.webos || result.bada) {
o.mobile = t result.mobile = t
} }
// Graded Browser Support // Graded Browser Support
// http://developer.yahoo.com/yui/articles/gbs // http://developer.yahoo.com/yui/articles/gbs
if ((o.msie && o.version >= 9) || if ((result.msie && result.version >= 9) ||
(o.chrome && o.version >= 20) || (result.chrome && result.version >= 20) ||
(o.firefox && o.version >= 10.0) || (result.firefox && result.version >= 10.0) ||
(o.safari && o.version >= 5) || (result.safari && result.version >= 5) ||
(o.opera && o.version >= 10.0) || (result.opera && result.version >= 10.0) ||
(o.ios && o.osversion && o.osversion.split(".")[0] >= 6) (result.ios && result.osversion && result.osversion.split(".")[0] >= 6)
) { ) {
o.a = t; result.a = t;
} }
else if ((result.msie && result.version < 9) ||
else if ((o.msie && o.version < 9) || (result.chrome && result.version < 20) ||
(o.chrome && o.version < 20) || (result.firefox && result.version < 10.0) ||
(o.firefox && o.version < 10.0) || (result.safari && result.version < 5) ||
(o.safari && o.version < 5) || (result.opera && result.version < 10.0) ||
(o.opera && o.version < 10.0) || (result.ios && result.osversion && result.osversion.split(".")[0] < 6)
(o.ios && o.osversion && o.osversion.split(".")[0] < 6)
) { ) {
o.c = t result.c = t
} else o.x = t } else result.x = t
return o return result
} }
var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent : '') var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent : '')

2
bowser.min.js vendored
View File

@ -3,4 +3,4 @@
* https://github.com/ded/bowser * https://github.com/ded/bowser
* MIT License | (c) Dustin Diaz 2014 * MIT License | (c) Dustin Diaz 2014
*/ */
!function(e,t){typeof module!="undefined"&&module.exports?module.exports.browser=t():typeof define=="function"?define(t):this[e]=t()}("bowser",function(){function n(e,t,n){var r=e.match(t);return r&&r.length>n&&r[n]||0}function r(r){var i=/(msie|trident)/i.test(r),s=/chrome|crios|crmo/i.test(r),o=/phantom/i.test(r),u=/iphone/i.test(r),a=/ipad/i.test(r),f=/ipod/i.test(r),l=/silk/i.test(r),c=/safari/i.test(r)&&!s&&!o&&!l,h=/android/i.test(r),p=/opera/i.test(r)||/opr/i.test(r),d=/(firefox|iceweasel)/i.test(r),m=/gecko\//i.test(r),g=/seamonkey\//i.test(r),y=/(?:web|hpw)os/i.test(r),b=/touchpad\//i.test(r),w=/windows phone/i.test(r),E=/(blackberry|\bbb\d+)/i.test(r),S=/rim\stablet/i.test(r),x=/bada/i.test(r),T=/tizen/i.test(r),N=/version\/(\d+(\.\d+)?)/i,C=/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i,k=/mobi/i.test(r),L=/tablet/i.test(r),A={};f&&(u=!1);if(w)A={name:"Windows Phone",windowsphone:e,msie:e,version:n(r,/iemobile\/(\d+(\.\d+)?)/i,1)};else if(p)t=n(r,N,1)||n(r,/opr\/(\d+(\.\d+)?)/i,1)||n(r,/opera[ \/](\d+(\.\d+)?)/i,1),A={name:"Opera",opera:e,version:t},h&&(A.android=e),s&&(A.webkit=e);else if(i)A={name:"Internet Explorer",msie:e,version:n(r,/(msie |rv:)(\d+(\.\d+)?)/i,2)};else if(s){A={name:"Chrome",webkit:e,chrome:e,version:n(r,/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i,1)},h&&(A.android=e);if(a||f||u)A[u?"iphone":a?"ipad":"ipod"]=e,A.ios=e}else o?A={name:"PhantomJS",webkit:e,phantom:e,version:n(r,/phantomjs\/(\d+(\.\d+)?)/i,1)}:l?A={name:"Amazon Silk",silk:e,webkit:e,android:e,version:n(r,/silk\/(\d+(\.\d+)?)/i,1)}:u||a||f?(A={name:u?"iPhone":a?"iPad":"iPod",webkit:e,ios:e},A[u?"iphone":a?"ipad":"ipod"]=e,N.test(r)&&(A.version=n(r,N,1))):E||S?(A={name:"BlackBerry",blackberry:e},(t=n(r,N,1))?(A.version=t,A.webkit=e):A.version=n(r,/blackberry[\d]+\/(\d+(\.\d+)?)/i,1)):y?(A={name:"WebOS",webkit:e,webos:e,version:n(r,N,1)||n(r,/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i,1)},b&&(A.touchpad=e)):x?A={name:"Bada",webkit:e,bada:e,version:n(r,/dolfin\/(\d+(\.\d+)?)/i,1)}:T?A={name:"Tizen",webkit:e,tizen:e,version:n(r,/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i,1)||n(r,N,1)}:m?(A={name:"Gecko",gecko:e,mozilla:e,version:n(r,C,1)},g?(A.name="SeaMonkey",A.seamonkey=e,A.version=n(r,/seamonkey\/(\d+(\.\d+)?)/i,1)):d&&(A.name="Firefox",A.firefox=e),h?A.android=e:!h&&d&&/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(r)&&(A.firefoxos=e)):h?A={name:"Android",webkit:e,android:e,version:n(r,N,1)}:c&&(A={name:"Safari",webkit:e,safari:e,version:n(r,N,1)});var O;T?O=n(r,/tizen[\/\s](\d+(\.\d+)*)/i,1):w?O=n(r,/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,1):y?O=n(r,/(?:web|hpw)os\/(\d+(\.\d+)*)/i,1):S?O=n(r,/rim\stablet\sos\s(\d+(\.\d+)*)/i,1):x?O=n(r,/bada\/(\d+(\.\d+)*)/i,1):u||a||f?(O=n(r,/os (\d+([_\s]\d+)*) like mac os x/i,1),O=(O||"").replace(/[_\s]/g,".")):h&&(O=n(r,/android[ \/-](\d+(\.\d+)*)/i,1)),O&&(A.osversion=O);var M=(O||"").split(".")[0];if(L||a||h&&(M==3||M==4&&!k)||S||l||b)A.tablet=e;else if(u||f||h&&k||w||E||y||x||T||k)A.mobile=e;return A.msie&&A.version>=9||A.chrome&&A.version>=20||A.firefox&&A.version>=10||A.safari&&A.version>=5||A.opera&&A.version>=10||A.ios&&A.osversion&&A.osversion.split(".")[0]>=6?A.a=e:A.msie&&A.version<9||A.chrome&&A.version<20||A.firefox&&A.version<10||A.safari&&A.version<5||A.opera&&A.version<10||A.ios&&A.osversion&&A.osversion.split(".")[0]<6?A.c=e:A.x=e,A}var e=!0,t,i=r(typeof navigator!="undefined"?navigator.userAgent:"");return i._detect=r,i}) !function(e,t){typeof module!="undefined"&&module.exports?module.exports.browser=t():typeof define=="function"?define(t):this[e]=t()}("bowser",function(){function t(t){function n(e){var n=t.match(e);return n&&n.length>1&&n[1]||""}var r=n(/(ipod|iphone|ipad)/i).toLowerCase(),i=/like android/i.test(t),s=!i&&/android/i.test(t),o=n(/version\/(\d+(\.\d+)?)/i),u=/tablet/i.test(t),a=!u&&/[^-]mobi/i.test(t),f;/opera|opr/i.test(t)?f={name:"Opera",opera:e,version:o||n(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)}:/windows phone/i.test(t)?f={name:"Windows Phone",windowsphone:e,msie:e,version:n(/iemobile\/(\d+(\.\d+)?)/i)}:/msie|trident/i.test(t)?f={name:"Internet Explorer",msie:e,version:n(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:/chrome|crios|crmo/i.test(t)?f={name:"Chrome",chrome:e,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:r?(f={name:r=="iphone"?"iPhone":r=="ipad"?"iPad":"iPod"},o&&(f.version=o)):/sailfish/i.test(t)?f={name:"Sailfish",sailfish:e,version:n(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(t)?f={name:"SeaMonkey",seamonkey:e,version:n(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel/i.test(t)?(f={name:"Firefox",firefox:e,version:n(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(t)&&(f.firefoxos=e)):/silk/i.test(t)?f={name:"Amazon Silk",silk:e,version:n(/silk\/(\d+(\.\d+)?)/i)}:s?f={name:"Android",version:o}:/phantom/i.test(t)?f={name:"PhantomJS",phantom:e,version:n(/phantomjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(t)||/rim\stablet/i.test(t)?f={name:"BlackBerry",blackberry:e,version:o||n(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:/(web|hpw)os/i.test(t)?(f={name:"WebOS",webos:e,version:o||n(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(t)&&(f.touchpad=e)):/bada/i.test(t)?f={name:"Bada",bada:e,version:n(/dolfin\/(\d+(\.\d+)?)/i)}:/tizen/i.test(t)?f={name:"Tizen",tizen:e,version:n(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||o}:/safari/i.test(t)?f={name:"Safari",safari:e,version:o}:f={},/(apple)?webkit/i.test(t)?(f.name=f.name||"Webkit",f.webkit=e,!f.version&&o&&(f.version=o)):!f.opera&&/gecko\//i.test(t)&&(f.name=f.name||"Gecko",f.gecko=e,f.version=f.version||n(/gecko\/(\d+(\.\d+)?)/i)),s||f.silk?f.android=e:r&&(f[r]=e,f.ios=e);var l="";r?(l=n(/os (\d+([_\s]\d+)*) like mac os x/i),l=l.replace(/[_\s]/g,".")):s?l=n(/android[ \/-](\d+(\.\d+)*)/i):f.windowsphone?l=n(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):f.webos?l=n(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):f.blackberry?l=n(/rim\stablet\sos\s(\d+(\.\d+)*)/i):f.bada?l=n(/bada\/(\d+(\.\d+)*)/i):f.tizen&&(l=n(/tizen[\/\s](\d+(\.\d+)*)/i)),l&&(f.osversion=l);var c=l.split(".")[0];if(u||r=="ipad"||s&&(c==3||c==4&&!a)||f.silk)f.tablet=e;else if(a||r=="iphone"||r=="ipod"||s||f.blackberry||f.webos||f.bada)f.mobile=e;return f.msie&&f.version>=9||f.chrome&&f.version>=20||f.firefox&&f.version>=10||f.safari&&f.version>=5||f.opera&&f.version>=10||f.ios&&f.osversion&&f.osversion.split(".")[0]>=6?f.a=e:f.msie&&f.version<9||f.chrome&&f.version<20||f.firefox&&f.version<10||f.safari&&f.version<5||f.opera&&f.version<10||f.ios&&f.osversion&&f.osversion.split(".")[0]<6?f.c=e:f.x=e,f}var e=!0,n=t(typeof navigator!="undefined"?navigator.userAgent:"");return n._detect=t,n})

View File

@ -7,234 +7,216 @@
* See useragents.js for examples of navigator.userAgent * See useragents.js for examples of navigator.userAgent
*/ */
var t = true, var t = true
v /* temporary placeholder for versions. */
function getVersion(ua, regex, matchedIdx) {
var match = ua.match(regex);
return (match && match.length > matchedIdx && match[matchedIdx]) || 0;
}
function detect(ua) { function detect(ua) {
var ie = /(msie|trident)/i.test(ua) function getFirstMatch(regex) {
, chrome = /chrome|crios|crmo/i.test(ua) var match = ua.match(regex);
, phantom = /phantom/i.test(ua) return (match && match.length > 1 && match[1]) || '';
, iphone = /iphone/i.test(ua) }
, ipad = /ipad/i.test(ua)
, ipod = /ipod/i.test(ua) var iosdevice = getFirstMatch(/(ipod|iphone|ipad)/i).toLowerCase()
, silk = /silk/i.test(ua) , likeAndroid = /like android/i.test(ua)
, safari = /safari/i.test(ua) && !chrome && !phantom && !silk , android = !likeAndroid && /android/i.test(ua)
, android = /android/i.test(ua) , versionIdentifier = getFirstMatch(/version\/(\d+(\.\d+)?)/i)
, opera = /opera/i.test(ua) || /opr/i.test(ua)
, firefox = /(firefox|iceweasel)/i.test(ua)
, gecko = /gecko\//i.test(ua)
, seamonkey = /seamonkey\//i.test(ua)
, webos = /(?:web|hpw)os/i.test(ua)
, touchpad = /touchpad\//i.test(ua)
, windowsphone = /windows phone/i.test(ua)
, blackberry = /(blackberry|\bbb\d+)/i.test(ua)
, rimtablet = /rim\stablet/i.test(ua)
, bada = /bada/i.test(ua)
, tizen = /tizen/i.test(ua)
, webkitVersion = /version\/(\d+(\.\d+)?)/i
, firefoxVersion = /(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i
, mobile = /mobi/i.test(ua)
, tablet = /tablet/i.test(ua) , tablet = /tablet/i.test(ua)
, o = {} , mobile = !tablet && /[^-]mobi/i.test(ua)
, result
if (ipod) iphone = false if (/opera|opr/i.test(ua)) {
result = {
if (windowsphone) o = { name: 'Opera'
, opera: t
, version: versionIdentifier || getFirstMatch(/(?:opera|opr)[\s\/](\d+(\.\d+)?)/i)
}
}
else if (/windows phone/i.test(ua)) {
result = {
name: 'Windows Phone' name: 'Windows Phone'
, windowsphone: t , windowsphone: t
, msie: t , msie: t
, version: getVersion(ua, /iemobile\/(\d+(\.\d+)?)/i, 1) , version: getFirstMatch(/iemobile\/(\d+(\.\d+)?)/i)
}
else if (opera) {
v = getVersion(ua, webkitVersion, 1) ||
getVersion(ua, /opr\/(\d+(\.\d+)?)/i, 1) ||
getVersion(ua, /opera[ \/](\d+(\.\d+)?)/i, 1);
o = {
name: 'Opera'
, opera: t
, version: v
}
if (android) {
o.android = t
}
if (chrome) {
o.webkit = t
} }
} }
else if (ie) o = { else if (/msie|trident/i.test(ua)) {
result = {
name: 'Internet Explorer' name: 'Internet Explorer'
, msie: t , msie: t
, version: getVersion(ua, /(msie |rv:)(\d+(\.\d+)?)/i, 2) , version: getFirstMatch(/(?:msie |rv:)(\d+(\.\d+)?)/i)
} }
else if (chrome) { }
o = { else if (/chrome|crios|crmo/i.test(ua)) {
result = {
name: 'Chrome' name: 'Chrome'
, webkit: t
, chrome: t , chrome: t
, version: getVersion(ua, /(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i, 1) , version: getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)
}
if (android) o.android = t
if (ipad || ipod || iphone) {
o[iphone ? 'iphone' : ipad ? 'ipad' : 'ipod'] = t
o.ios = t
} }
} }
else if (phantom) o = { else if (iosdevice) {
name: 'PhantomJS' result = {
, webkit: t name : iosdevice == 'iphone' ? 'iPhone' : iosdevice == 'ipad' ? 'iPad' : 'iPod'
, phantom: t
, version: getVersion(ua, /phantomjs\/(\d+(\.\d+)?)/i, 1)
} }
else if (silk) o = { // WTF: version is not part of user agent in web apps
if (versionIdentifier) {
result.version = versionIdentifier
}
}
else if (/sailfish/i.test(ua)) {
result = {
name: 'Sailfish'
, sailfish: t
, version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i)
}
}
else if (/seamonkey\//i.test(ua)) {
result = {
name: 'SeaMonkey'
, seamonkey: t
, version: getFirstMatch(/seamonkey\/(\d+(\.\d+)?)/i)
}
}
else if (/firefox|iceweasel/i.test(ua)) {
result = {
name: 'Firefox'
, firefox: t
, version: getFirstMatch(/(?:firefox|iceweasel)[ \/](\d+(\.\d+)?)/i)
}
if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
result.firefoxos = t
}
}
else if (/silk/i.test(ua)) {
result = {
name: 'Amazon Silk' name: 'Amazon Silk'
, silk: t , silk: t
, webkit: t , version : getFirstMatch(/silk\/(\d+(\.\d+)?)/i)
, android: t
, version : getVersion(ua, /silk\/(\d+(\.\d+)?)/i, 1)
}
else if (iphone || ipad || ipod) {
o = {
name : iphone ? 'iPhone' : ipad ? 'iPad' : 'iPod'
, webkit: t
, ios: t
}
o[iphone ? 'iphone' : ipad ? 'ipad' : 'ipod'] = t
// WTF: version is not part of user agent in web apps
if (webkitVersion.test(ua)) {
o.version = getVersion(ua, webkitVersion, 1)
} }
} }
else if (blackberry || rimtablet) { else if (android) {
o = { result = {
name: 'Android'
, version: versionIdentifier
}
}
else if (/phantom/i.test(ua)) {
result = {
name: 'PhantomJS'
, phantom: t
, version: getFirstMatch(/phantomjs\/(\d+(\.\d+)?)/i)
}
}
else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) {
result = {
name: 'BlackBerry' name: 'BlackBerry'
, blackberry: t , blackberry: t
} , version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i)
if ((v = getVersion(ua, webkitVersion, 1))) {
o.version = v
o.webkit = t
} else {
o.version = getVersion(ua, /blackberry[\d]+\/(\d+(\.\d+)?)/i, 1)
} }
} }
else if (webos) { else if (/(web|hpw)os/i.test(ua)) {
o = { result = {
name: 'WebOS' name: 'WebOS'
, webkit: t
, webos: t , webos: t
, version: (getVersion(ua, webkitVersion, 1) || getVersion(ua, /w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i, 1)) , version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)
}; };
touchpad && (o.touchpad = t) /touchpad\//i.test(ua) && (result.touchpad = t)
} }
else if (bada) { else if (/bada/i.test(ua)) {
o = { result = {
name: 'Bada' name: 'Bada'
, webkit: t
, bada: t , bada: t
, version: getVersion(ua, /dolfin\/(\d+(\.\d+)?)/i, 1) , version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i)
}; };
} }
else if (tizen) { else if (/tizen/i.test(ua)) {
o = { result = {
name: 'Tizen' name: 'Tizen'
, webkit: t
, tizen: t , tizen: t
, version: getVersion(ua, /(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i, 1) || getVersion(ua, webkitVersion, 1) , version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier
}; };
} }
else if (gecko) { else if (/safari/i.test(ua)) {
o = { result = {
name: 'Gecko'
, gecko: t
, mozilla: t
, version: getVersion(ua, firefoxVersion, 1)
}
if (seamonkey) {
o.name = 'SeaMonkey'
o.seamonkey = t
o.version = getVersion(ua, /seamonkey\/(\d+(\.\d+)?)/i, 1)
} else if (firefox) {
o.name = 'Firefox'
o.firefox = t
}
if (android) {
o.android = t
} else if (!android && firefox && /\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
o.firefoxos = t
}
}
else if (android) o = {
name: 'Android'
, webkit: t
, android: t
, version: getVersion(ua, webkitVersion, 1)
}
else if (safari) o = {
name: 'Safari' name: 'Safari'
, webkit: t
, safari: t , safari: t
, version: getVersion(ua, webkitVersion, 1) , version: versionIdentifier
}
}
else result = {}
// set webkit or gecko flag for browsers based on these engines
if (/(apple)?webkit/i.test(ua)) {
result.name = result.name || "Webkit"
result.webkit = t
if (!result.version && versionIdentifier) {
result.version = versionIdentifier
}
} else if (!result.opera && /gecko\//i.test(ua)) {
result.name = result.name || "Gecko"
result.gecko = t
result.version = result.version || getFirstMatch(/gecko\/(\d+(\.\d+)?)/i)
} }
// set OS flags for platforms that have multiple browsers
if (android || result.silk) {
result.android = t
} else if (iosdevice) {
result[iosdevice] = t
result.ios = t
}
// OS version extraction // OS version extraction
var osVersion; var osVersion = '';
if (tizen) { if (iosdevice) {
osVersion = getVersion(ua, /tizen[\/\s](\d+(\.\d+)*)/i, 1); osVersion = getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i);
} else if (windowsphone) { osVersion = osVersion.replace(/[_\s]/g, '.');
osVersion = getVersion(ua, /windows phone (?:os)?\s?(\d+(\.\d+)*)/i, 1);
} else if (webos) {
osVersion = getVersion(ua, /(?:web|hpw)os\/(\d+(\.\d+)*)/i, 1);
} else if (rimtablet) {
osVersion = getVersion(ua, /rim\stablet\sos\s(\d+(\.\d+)*)/i, 1);
} else if (bada) {
osVersion = getVersion(ua, /bada\/(\d+(\.\d+)*)/i, 1);
} else if (iphone || ipad || ipod) {
osVersion = getVersion(ua, /os (\d+([_\s]\d+)*) like mac os x/i, 1);
osVersion = (osVersion || "").replace(/[_\s]/g, '.');
} else if (android) { } else if (android) {
osVersion = getVersion(ua, /android[ \/-](\d+(\.\d+)*)/i, 1); osVersion = getFirstMatch(/android[ \/-](\d+(\.\d+)*)/i);
} else if (result.windowsphone) {
osVersion = getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i);
} else if (result.webos) {
osVersion = getFirstMatch(/(?:web|hpw)os\/(\d+(\.\d+)*)/i);
} else if (result.blackberry) {
osVersion = getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i);
} else if (result.bada) {
osVersion = getFirstMatch(/bada\/(\d+(\.\d+)*)/i);
} else if (result.tizen) {
osVersion = getFirstMatch(/tizen[\/\s](\d+(\.\d+)*)/i);
} }
if (osVersion) { if (osVersion) {
o.osversion = osVersion; result.osversion = osVersion;
} }
// device type extraction // device type extraction
var osMajorVersion = (osVersion || '').split('.')[0]; var osMajorVersion = osVersion.split('.')[0];
if (tablet || ipad || (android && (osMajorVersion == 3 || (osMajorVersion == 4 && !mobile))) || rimtablet || silk || touchpad) { if (tablet || iosdevice == 'ipad' || (android && (osMajorVersion == 3 || (osMajorVersion == 4 && !mobile))) || result.silk) {
o.tablet = t result.tablet = t
} else if (iphone || ipod || (android && mobile) || windowsphone || blackberry || webos || bada || tizen || mobile) { } else if (mobile || iosdevice == 'iphone' || iosdevice == 'ipod' || android || result.blackberry || result.webos || result.bada) {
o.mobile = t result.mobile = t
} }
// Graded Browser Support // Graded Browser Support
// http://developer.yahoo.com/yui/articles/gbs // http://developer.yahoo.com/yui/articles/gbs
if ((o.msie && o.version >= 9) || if ((result.msie && result.version >= 9) ||
(o.chrome && o.version >= 20) || (result.chrome && result.version >= 20) ||
(o.firefox && o.version >= 10.0) || (result.firefox && result.version >= 10.0) ||
(o.safari && o.version >= 5) || (result.safari && result.version >= 5) ||
(o.opera && o.version >= 10.0) || (result.opera && result.version >= 10.0) ||
(o.ios && o.osversion && o.osversion.split(".")[0] >= 6) (result.ios && result.osversion && result.osversion.split(".")[0] >= 6)
) { ) {
o.a = t; result.a = t;
} }
else if ((result.msie && result.version < 9) ||
else if ((o.msie && o.version < 9) || (result.chrome && result.version < 20) ||
(o.chrome && o.version < 20) || (result.firefox && result.version < 10.0) ||
(o.firefox && o.version < 10.0) || (result.safari && result.version < 5) ||
(o.safari && o.version < 5) || (result.opera && result.version < 10.0) ||
(o.opera && o.version < 10.0) || (result.ios && result.osversion && result.osversion.split(".")[0] < 6)
(o.ios && o.osversion && o.osversion.split(".")[0] < 6)
) { ) {
o.c = t result.c = t
} else o.x = t } else result.x = t
return o return result
} }
var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent : '') var bowser = detect(typeof navigator !== 'undefined' ? navigator.userAgent : '')

View File

@ -360,8 +360,7 @@ module.exports.useragents = {
} }
, Firefox: { , Firefox: {
'Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0': { 'Mozilla/5.0 (Mobile; rv:26.0) Gecko/26.0 Firefox/26.0': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '26.0' , version: '26.0'
, mobile: true , mobile: true
@ -369,8 +368,7 @@ module.exports.useragents = {
, a: true , a: true
} }
, 'Mozilla/5.0 (Tablet; rv:26.0) Gecko/26.0 Firefox/26.0': { , 'Mozilla/5.0 (Tablet; rv:26.0) Gecko/26.0 Firefox/26.0': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '26.0' , version: '26.0'
, tablet: true , tablet: true
@ -378,8 +376,7 @@ module.exports.useragents = {
, a: true , a: true
} }
, 'Mozilla/5.0 (Mobile; LG-D300; rv:18.1) Gecko/18.1 Firefox/18.1': { , 'Mozilla/5.0 (Mobile; LG-D300; rv:18.1) Gecko/18.1 Firefox/18.1': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '18.1' , version: '18.1'
, mobile: true , mobile: true
@ -387,8 +384,7 @@ module.exports.useragents = {
, a: true , a: true
} }
, 'Mozilla/5.0 (Android; Mobile; rv:27.0) Gecko/27.0 Firefox/27.0': { , 'Mozilla/5.0 (Android; Mobile; rv:27.0) Gecko/27.0 Firefox/27.0': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '27.0' , version: '27.0'
, mobile: true , mobile: true
@ -396,8 +392,7 @@ module.exports.useragents = {
, a: true , a: true
} }
, 'Mozilla/5.0 (Android; Tablet; rv:26.0) Gecko/26.0 Firefox/26.0': { , 'Mozilla/5.0 (Android; Tablet; rv:26.0) Gecko/26.0 Firefox/26.0': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '26.0' , version: '26.0'
, tablet: true , tablet: true
@ -405,92 +400,79 @@ module.exports.useragents = {
, a: true , a: true
} }
, 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0': { , 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '25.0' , version: '25.0'
, a: true , a: true
} }
, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0': { , 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '24.0' , version: '24.0'
, a: true , a: true
} }
, 'Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0': { , 'Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Firefox/21.0': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '21.0' , version: '21.0'
, a: true , a: true
} }
, 'Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20121202 Firefox/17.0 Iceweasel/17.0.1': { , 'Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20121202 Firefox/17.0 Iceweasel/17.0.1': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '17.0' , version: '17.0'
, a: true , a: true
} }
, 'Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120724 Debian Iceweasel/15.0': { , 'Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120724 Debian Iceweasel/15.0': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '15.0' , version: '15.0'
, a: true , a: true
} }
, 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:15.0) Gecko/20120910144328 Firefox/15.0.2': { , 'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:15.0) Gecko/20120910144328 Firefox/15.0.2': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '15.0' , version: '15.0'
, a: true , a: true
} }
, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; WOW64; en-US; rv:2.0.4) Gecko/20120718 AskTbAVR-IDW/3.12.5.17700 Firefox/14.0.1': { , 'Mozilla/5.0 (Windows; U; Windows NT 6.1; WOW64; en-US; rv:2.0.4) Gecko/20120718 AskTbAVR-IDW/3.12.5.17700 Firefox/14.0.1': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '14.0' , version: '14.0'
, a: true , a: true
} }
, 'Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20100101 Firefox/6.0 FirePHP/0.6': { , 'Mozilla/5.0 (Windows NT 5.1; rv:6.0) Gecko/20100101 Firefox/6.0 FirePHP/0.6': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '6.0' , version: '6.0'
, c: true , c: true
} }
, 'Mozilla/5.0 (X11; Linux x86_64; rv:2.2a1pre) Gecko/20100101 Firefox/4.2a1pre': { , 'Mozilla/5.0 (X11; Linux x86_64; rv:2.2a1pre) Gecko/20100101 Firefox/4.2a1pre': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '4.2' , version: '4.2'
, c: true , c: true
} }
, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0) Gecko/20100101 Firefox/4.0': { , 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0) Gecko/20100101 Firefox/4.0': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '4.0' , version: '4.0'
, c: true , c: true
} }
, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2b1) Gecko/20091014 Firefox/3.6b1 GTB5': { , 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2b1) Gecko/20091014 Firefox/3.6b1 GTB5': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '3.6' , version: '3.6'
, c: true , c: true
} }
, 'Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.0.15) Gecko/2009101601 Firefox 2.1 (.NET CLR 3.5.30729)': { , 'Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.9.0.15) Gecko/2009101601 Firefox 2.1 (.NET CLR 3.5.30729)': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '2.1' , version: '2.1'
, c: true , c: true
} }
, 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20061014 Firefox/1.5.0.7': { , 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.7) Gecko/20061014 Firefox/1.5.0.7': {
mozilla: true gecko: true
, gecko: true
, firefox: true , firefox: true
, version: '1.5' , version: '1.5'
, c: true , c: true
@ -498,22 +480,19 @@ module.exports.useragents = {
} }
, SeaMonkey: { , SeaMonkey: {
'Mozilla/5.0 (Windows NT 5.2; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1': { 'Mozilla/5.0 (Windows NT 5.2; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1': {
mozilla: true gecko: true
, gecko: true
, seamonkey: true , seamonkey: true
, version: '2.7' , version: '2.7'
, x: true , x: true
} }
, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1': { , 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1': {
mozilla: true gecko: true
, gecko: true
, seamonkey: true , seamonkey: true
, version: '2.7' , version: '2.7'
, x: true , x: true
} }
, 'Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1': { , 'Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1': {
mozilla: true gecko: true
, gecko: true
, seamonkey: true , seamonkey: true
, version: '2.7' , version: '2.7'
, x: true , x: true
@ -928,6 +907,22 @@ module.exports.useragents = {
, x: true , x: true
} }
} }
, Sailfish: {
'Mozilla/5.0 (Maemo; Linux; U; Jolla; Sailfish; Mobile; rv:26.0) Gecko/26.0 Firefox/26.0 SailfishBrowser/1.0 like Safari/538.1': {
sailfish: true
, gecko: true
, version: '1.0'
, mobile: true
, x: true
}
, 'Mozilla/5.0 (Linux; U; Jolla; Sailfish; Mobile; rv:20.0) Gecko/20.0 Firefox/20.0 Sailfish Browser/1.0 like Safari/535.19': {
sailfish: true
, gecko: true
, version: '1.0'
, mobile: true
, x: true
}
}
, PhantomJS: { , PhantomJS: {
'Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.5.0 Safari/534.34': { 'Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.5.0 Safari/534.34': {
phantom: true phantom: true