mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
made version extraction less error-prone/more future-proof, will now always check
if result of regex match is truthy and array bounds are correct before actually accessing the version number
This commit is contained in:
parent
24dd55d9b4
commit
0da898f906
49
bowser.js
49
bowser.js
@ -16,6 +16,11 @@
|
|||||||
var t = true,
|
var t = true,
|
||||||
v /* temporary placeholder for versions. */
|
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)
|
var ie = /(msie|trident)/i.test(ua)
|
||||||
@ -46,13 +51,12 @@
|
|||||||
name: 'Windows Phone'
|
name: 'Windows Phone'
|
||||||
, windowsphone: t
|
, windowsphone: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
, version: ua.match(/iemobile\/(\d+(\.\d+)?)/i)[1]
|
, version: getVersion(ua, /iemobile\/(\d+(\.\d+)?)/i, 1)
|
||||||
}
|
}
|
||||||
else if (opera) {
|
else if (opera) {
|
||||||
if ((v = ua.match(webkitVersion)) && v.length > 1) v = v[1]
|
v = getVersion(ua, webkitVersion, 1) ||
|
||||||
else if ((v = ua.match(/opr\/(\d+(\.\d+)?)/i)) && v.length > 1) v = v[1]
|
getVersion(ua, /opr\/(\d+(\.\d+)?)/i, 1) ||
|
||||||
else if ((v = ua.match(/opera[ \/](\d+(\.\d+)?)/i)) && v.length > 1) v = v[1]
|
getVersion(ua, /opera[ \/](\d+(\.\d+)?)/i, 1);
|
||||||
else v = 0
|
|
||||||
o = {
|
o = {
|
||||||
name: 'Opera'
|
name: 'Opera'
|
||||||
, opera: t
|
, opera: t
|
||||||
@ -65,16 +69,17 @@
|
|||||||
if (chrome) {
|
if (chrome) {
|
||||||
o.webkit = t
|
o.webkit = t
|
||||||
}
|
}
|
||||||
} else if (ie) o = {
|
}
|
||||||
|
else if (ie) o = {
|
||||||
name: 'Internet Explorer'
|
name: 'Internet Explorer'
|
||||||
, msie: t
|
, msie: t
|
||||||
, version: ua.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]
|
, version: getVersion(ua, /(msie |rv:)(\d+(\.\d+)?)/i, 2)
|
||||||
}
|
}
|
||||||
else if (chrome) o = {
|
else if (chrome) o = {
|
||||||
name: 'Chrome'
|
name: 'Chrome'
|
||||||
, webkit: t
|
, webkit: t
|
||||||
, chrome: t
|
, chrome: t
|
||||||
, version: ua.match(/(?:chrome|crios)\/(\d+(\.\d+)?)/i)[1]
|
, version: getVersion(ua, /(?:chrome|crios)\/(\d+(\.\d+)?)/i, 1)
|
||||||
, ipad: ipad
|
, ipad: ipad
|
||||||
, iphone: iphone
|
, iphone: iphone
|
||||||
, ipod: ipod
|
, ipod: ipod
|
||||||
@ -86,20 +91,20 @@
|
|||||||
name: 'PhantomJS'
|
name: 'PhantomJS'
|
||||||
, webkit: t
|
, webkit: t
|
||||||
, phantom: t
|
, phantom: t
|
||||||
, version: ua.match(/phantomjs\/(\d+(\.\d+)?)/i)[1]
|
, version: getVersion(ua, /phantomjs\/(\d+(\.\d+)?)/i, 1)
|
||||||
}
|
}
|
||||||
else if (touchpad) o = {
|
else if (touchpad) o = {
|
||||||
name: 'TouchPad'
|
name: 'TouchPad'
|
||||||
, webkit: t
|
, webkit: t
|
||||||
, touchpad: t
|
, touchpad: t
|
||||||
, version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1]
|
, version : getVersion(ua, /touchpad\/(\d+(\.\d+)?)/i, 1)
|
||||||
}
|
}
|
||||||
else if (silk) o = {
|
else if (silk) o = {
|
||||||
name: 'Amazon Silk'
|
name: 'Amazon Silk'
|
||||||
, webkit: t
|
, webkit: t
|
||||||
, android: t
|
, android: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
, version : ua.match(/silk\/(\d+(\.\d+)?)/i)[1]
|
, version : getVersion(ua, /silk\/(\d+(\.\d+)?)/i, 1)
|
||||||
}
|
}
|
||||||
else if (iphone || ipad || ipod) {
|
else if (iphone || ipad || ipod) {
|
||||||
o = {
|
o = {
|
||||||
@ -113,7 +118,7 @@
|
|||||||
}
|
}
|
||||||
// WTF: version is not part of user agent in web apps
|
// WTF: version is not part of user agent in web apps
|
||||||
if (webkitVersion.test(ua)) {
|
if (webkitVersion.test(ua)) {
|
||||||
o.version = ua.match(webkitVersion)[1]
|
o.version = getVersion(ua, webkitVersion, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (blackberry) {
|
else if (blackberry) {
|
||||||
@ -122,11 +127,11 @@
|
|||||||
, blackberry: t
|
, blackberry: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
}
|
}
|
||||||
if ((v = ua.match(webkitVersion))) {
|
if ((v = getVersion(ua, webkitVersion, 1))) {
|
||||||
o.version = v[1]
|
o.version = v
|
||||||
o.webkit = t
|
o.webkit = t
|
||||||
} else {
|
} else {
|
||||||
o.version = ua.match(/blackberry[\d]+\/(\d+(\.\d+)?)/i)[1]
|
o.version = getVersion(ua, /blackberry[\d]+\/(\d+(\.\d+)?)/i, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (webos) o = {
|
else if (webos) o = {
|
||||||
@ -134,19 +139,19 @@
|
|||||||
, mobile: t
|
, mobile: t
|
||||||
, webkit: t
|
, webkit: t
|
||||||
, webos: t
|
, webos: t
|
||||||
, version: (ua.match(webkitVersion) || ua.match(/wosbrowser\/(\d+(\.\d+)?)/i))[1]
|
, version: (getVersion(ua, webkitVersion, 1) || getVersion(ua, /wosbrowser\/(\d+(\.\d+)?)/i, 1))
|
||||||
}
|
}
|
||||||
else if (gecko) {
|
else if (gecko) {
|
||||||
o = {
|
o = {
|
||||||
name: 'Gecko'
|
name: 'Gecko'
|
||||||
, gecko: t
|
, gecko: t
|
||||||
, mozilla: t
|
, mozilla: t
|
||||||
, version: ((v = ua.match(firefoxVersion)) && v? v[1] : 0)
|
, version: getVersion(ua, firefoxVersion, 1)
|
||||||
}
|
}
|
||||||
if (seamonkey) {
|
if (seamonkey) {
|
||||||
o.name = 'SeaMonkey'
|
o.name = 'SeaMonkey'
|
||||||
o.seamonkey = t
|
o.seamonkey = t
|
||||||
o.version = ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
|
o.version = getVersion(ua, /seamonkey\/(\d+(\.\d+)?)/i, 1)
|
||||||
} else if (firefox) {
|
} else if (firefox) {
|
||||||
o.name = 'Firefox'
|
o.name = 'Firefox'
|
||||||
o.firefox = t
|
o.firefox = t
|
||||||
@ -154,21 +159,23 @@
|
|||||||
if (android) {
|
if (android) {
|
||||||
o.android = t
|
o.android = t
|
||||||
o.mobile = t
|
o.mobile = t
|
||||||
|
} else if (!android && firefox && /\((mobile|tablet);.*rv:[\d\.]+\)/i.test(ua)) {
|
||||||
|
o.firefoxos = t
|
||||||
|
o.mobile = t
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (android) o = {
|
else if (android) o = {
|
||||||
name: 'Android'
|
name: 'Android'
|
||||||
, webkit: t
|
, webkit: t
|
||||||
, android: t
|
, android: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
, version: ua.match(webkitVersion)[1]
|
, version: getVersion(ua, webkitVersion, 1)
|
||||||
}
|
}
|
||||||
else if (safari) o = {
|
else if (safari) o = {
|
||||||
name: 'Safari'
|
name: 'Safari'
|
||||||
, webkit: t
|
, webkit: t
|
||||||
, safari: t
|
, safari: t
|
||||||
, version: ((v = ua.match(webkitVersion)) ? v[1] : 0)
|
, version: getVersion(ua, webkitVersion, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Graded Browser Support
|
// Graded Browser Support
|
||||||
|
2
bowser.min.js
vendored
2
bowser.min.js
vendored
@ -3,4 +3,4 @@
|
|||||||
* https://github.com/ded/bowser
|
* https://github.com/ded/bowser
|
||||||
* MIT License | (c) Dustin Diaz 2013
|
* MIT License | (c) Dustin Diaz 2013
|
||||||
*/
|
*/
|
||||||
!function(e,t){typeof define=="function"?define(t):typeof module!="undefined"&&module.exports?module.exports.browser=t():this[e]=t()}("bowser",function(){function n(n){var r=/(msie|trident)/i.test(n),i=/chrome|crios/i.test(n),s=/phantom/i.test(n),o=/iphone/i.test(n),u=/ipad/i.test(n),a=/ipod/i.test(n),f=/touchpad/i.test(n),l=/silk/i.test(n),c=/safari/i.test(n)&&!i&&!s&&!l,h=/android/i.test(n),p=/opera/i.test(n)||/opr/i.test(n),d=/firefox/i.test(n),m=/gecko\//i.test(n),g=/seamonkey\//i.test(n),y=/webos/i.test(n),b=/windows phone/i.test(n),w=/blackberry/i.test(n),E=/version\/(\d+(\.\d+)?)/i,S=/firefox[ \/](\d+(\.\d+)?)/i,x=/mobile/i.test(n),T={};return a&&(o=!1),b?T={name:"Windows Phone",windowsphone:e,mobile:e,version:n.match(/iemobile\/(\d+(\.\d+)?)/i)[1]}:p?((t=n.match(E))&&t.length>1?t=t[1]:(t=n.match(/opr\/(\d+(\.\d+)?)/i))&&t.length>1?t=t[1]:(t=n.match(/opera[ \/](\d+(\.\d+)?)/i))&&t.length>1?t=t[1]:t=0,T={name:"Opera",opera:e,version:t},h&&(T.android=e,T.mobile=e),i&&(T.webkit=e)):r?T={name:"Internet Explorer",msie:e,version:n.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]}:i?T={name:"Chrome",webkit:e,chrome:e,version:n.match(/(?:chrome|crios)\/(\d+(\.\d+)?)/i)[1],ipad:u,iphone:o,ipod:a,ios:o||u||a,android:h,mobile:x}:s?T={name:"PhantomJS",webkit:e,phantom:e,version:n.match(/phantomjs\/(\d+(\.\d+)?)/i)[1]}:f?T={name:"TouchPad",webkit:e,touchpad:e,version:n.match(/touchpad\/(\d+(\.\d+)?)/i)[1]}:l?T={name:"Amazon Silk",webkit:e,android:e,mobile:e,version:n.match(/silk\/(\d+(\.\d+)?)/i)[1]}:o||u||a?(T={name:o?"iPhone":u?"iPad":"iPod",webkit:e,mobile:e,ios:e,iphone:o,ipad:u,ipod:a},E.test(n)&&(T.version=n.match(E)[1])):w?(T={name:"BlackBerry",blackberry:e,mobile:e},(t=n.match(E))?(T.version=t[1],T.webkit=e):T.version=n.match(/blackberry[\d]+\/(\d+(\.\d+)?)/i)[1]):y?T={name:"WebOS",mobile:e,webkit:e,webos:e,version:(n.match(E)||n.match(/wosbrowser\/(\d+(\.\d+)?)/i))[1]}:m?(T={name:"Gecko",gecko:e,mozilla:e,version:(t=n.match(S))&&t?t[1]:0},g?(T.name="SeaMonkey",T.seamonkey=e,T.version=n.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]):d&&(T.name="Firefox",T.firefox=e),h&&(T.android=e,T.mobile=e)):h?T={name:"Android",webkit:e,android:e,mobile:e,version:n.match(E)[1]}:c&&(T={name:"Safari",webkit:e,safari:e,version:(t=n.match(E))?t[1]:0}),T.msie&&T.version>=9||T.chrome&&T.version>=20||T.firefox&&T.version>=10||T.safari&&T.version>=5||T.opera&&T.version>=10?T.a=e:T.msie&&T.version<9||T.chrome&&T.version<20||T.firefox&&T.version<10||T.safari&&T.version<5||T.opera&&T.version<10?T.c=e:T.x=e,T}var e=!0,t,r=n(typeof navigator!="undefined"?navigator.userAgent:"");return r._detect=n,r})
|
!function(e,t){typeof define=="function"?define(t):typeof module!="undefined"&&module.exports?module.exports.browser=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/i.test(r),o=/phantom/i.test(r),u=/iphone/i.test(r),a=/ipad/i.test(r),f=/ipod/i.test(r),l=/touchpad/i.test(r),c=/silk/i.test(r),h=/safari/i.test(r)&&!s&&!o&&!c,p=/android/i.test(r),d=/opera/i.test(r)||/opr/i.test(r),m=/firefox/i.test(r),g=/gecko\//i.test(r),y=/seamonkey\//i.test(r),b=/webos/i.test(r),w=/windows phone/i.test(r),E=/blackberry/i.test(r),S=/version\/(\d+(\.\d+)?)/i,x=/firefox[ \/](\d+(\.\d+)?)/i,T=/mobile/i.test(r),N={};return f&&(u=!1),w?N={name:"Windows Phone",windowsphone:e,mobile:e,version:n(r,/iemobile\/(\d+(\.\d+)?)/i,1)}:d?(t=n(r,S,1)||n(r,/opr\/(\d+(\.\d+)?)/i,1)||n(r,/opera[ \/](\d+(\.\d+)?)/i,1),N={name:"Opera",opera:e,version:t},p&&(N.android=e,N.mobile=e),s&&(N.webkit=e)):i?N={name:"Internet Explorer",msie:e,version:n(r,/(msie |rv:)(\d+(\.\d+)?)/i,2)}:s?N={name:"Chrome",webkit:e,chrome:e,version:n(r,/(?:chrome|crios)\/(\d+(\.\d+)?)/i,1),ipad:a,iphone:u,ipod:f,ios:u||a||f,android:p,mobile:T}:o?N={name:"PhantomJS",webkit:e,phantom:e,version:n(r,/phantomjs\/(\d+(\.\d+)?)/i,1)}:l?N={name:"TouchPad",webkit:e,touchpad:e,version:n(r,/touchpad\/(\d+(\.\d+)?)/i,1)}:c?N={name:"Amazon Silk",webkit:e,android:e,mobile:e,version:n(r,/silk\/(\d+(\.\d+)?)/i,1)}:u||a||f?(N={name:u?"iPhone":a?"iPad":"iPod",webkit:e,mobile:e,ios:e,iphone:u,ipad:a,ipod:f},S.test(r)&&(N.version=n(r,S,1))):E?(N={name:"BlackBerry",blackberry:e,mobile:e},(t=n(r,S,1))?(N.version=t,N.webkit=e):N.version=n(r,/blackberry[\d]+\/(\d+(\.\d+)?)/i,1)):b?N={name:"WebOS",mobile:e,webkit:e,webos:e,version:n(r,S,1)||n(r,/wosbrowser\/(\d+(\.\d+)?)/i,1)}:g?(N={name:"Gecko",gecko:e,mozilla:e,version:n(r,x,1)},y?(N.name="SeaMonkey",N.seamonkey=e,N.version=n(r,/seamonkey\/(\d+(\.\d+)?)/i,1)):m&&(N.name="Firefox",N.firefox=e),p?(N.android=e,N.mobile=e):!p&&m&&/\((mobile|tablet);.*rv:[\d\.]+\)/i.test(r)&&(N.firefoxos=e,N.mobile=e)):p?N={name:"Android",webkit:e,android:e,mobile:e,version:n(r,S,1)}:h&&(N={name:"Safari",webkit:e,safari:e,version:n(r,S,1)}),N.msie&&N.version>=9||N.chrome&&N.version>=20||N.firefox&&N.version>=10||N.safari&&N.version>=5||N.opera&&N.version>=10?N.a=e:N.msie&&N.version<9||N.chrome&&N.version<20||N.firefox&&N.version<10||N.safari&&N.version<5||N.opera&&N.version<10?N.c=e:N.x=e,N}var e=!0,t,i=r(typeof navigator!="undefined"?navigator.userAgent:"");return i._detect=r,i})
|
@ -10,6 +10,11 @@
|
|||||||
var t = true,
|
var t = true,
|
||||||
v /* temporary placeholder for versions. */
|
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)
|
var ie = /(msie|trident)/i.test(ua)
|
||||||
@ -40,13 +45,12 @@
|
|||||||
name: 'Windows Phone'
|
name: 'Windows Phone'
|
||||||
, windowsphone: t
|
, windowsphone: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
, version: ua.match(/iemobile\/(\d+(\.\d+)?)/i)[1]
|
, version: getVersion(ua, /iemobile\/(\d+(\.\d+)?)/i, 1)
|
||||||
}
|
}
|
||||||
else if (opera) {
|
else if (opera) {
|
||||||
if ((v = ua.match(webkitVersion)) && v.length > 1) v = v[1]
|
v = getVersion(ua, webkitVersion, 1) ||
|
||||||
else if ((v = ua.match(/opr\/(\d+(\.\d+)?)/i)) && v.length > 1) v = v[1]
|
getVersion(ua, /opr\/(\d+(\.\d+)?)/i, 1) ||
|
||||||
else if ((v = ua.match(/opera[ \/](\d+(\.\d+)?)/i)) && v.length > 1) v = v[1]
|
getVersion(ua, /opera[ \/](\d+(\.\d+)?)/i, 1);
|
||||||
else v = 0
|
|
||||||
o = {
|
o = {
|
||||||
name: 'Opera'
|
name: 'Opera'
|
||||||
, opera: t
|
, opera: t
|
||||||
@ -59,16 +63,17 @@
|
|||||||
if (chrome) {
|
if (chrome) {
|
||||||
o.webkit = t
|
o.webkit = t
|
||||||
}
|
}
|
||||||
} else if (ie) o = {
|
}
|
||||||
|
else if (ie) o = {
|
||||||
name: 'Internet Explorer'
|
name: 'Internet Explorer'
|
||||||
, msie: t
|
, msie: t
|
||||||
, version: ua.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]
|
, version: getVersion(ua, /(msie |rv:)(\d+(\.\d+)?)/i, 2)
|
||||||
}
|
}
|
||||||
else if (chrome) o = {
|
else if (chrome) o = {
|
||||||
name: 'Chrome'
|
name: 'Chrome'
|
||||||
, webkit: t
|
, webkit: t
|
||||||
, chrome: t
|
, chrome: t
|
||||||
, version: ua.match(/(?:chrome|crios)\/(\d+(\.\d+)?)/i)[1]
|
, version: getVersion(ua, /(?:chrome|crios)\/(\d+(\.\d+)?)/i, 1)
|
||||||
, ipad: ipad
|
, ipad: ipad
|
||||||
, iphone: iphone
|
, iphone: iphone
|
||||||
, ipod: ipod
|
, ipod: ipod
|
||||||
@ -80,20 +85,20 @@
|
|||||||
name: 'PhantomJS'
|
name: 'PhantomJS'
|
||||||
, webkit: t
|
, webkit: t
|
||||||
, phantom: t
|
, phantom: t
|
||||||
, version: ua.match(/phantomjs\/(\d+(\.\d+)?)/i)[1]
|
, version: getVersion(ua, /phantomjs\/(\d+(\.\d+)?)/i, 1)
|
||||||
}
|
}
|
||||||
else if (touchpad) o = {
|
else if (touchpad) o = {
|
||||||
name: 'TouchPad'
|
name: 'TouchPad'
|
||||||
, webkit: t
|
, webkit: t
|
||||||
, touchpad: t
|
, touchpad: t
|
||||||
, version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1]
|
, version : getVersion(ua, /touchpad\/(\d+(\.\d+)?)/i, 1)
|
||||||
}
|
}
|
||||||
else if (silk) o = {
|
else if (silk) o = {
|
||||||
name: 'Amazon Silk'
|
name: 'Amazon Silk'
|
||||||
, webkit: t
|
, webkit: t
|
||||||
, android: t
|
, android: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
, version : ua.match(/silk\/(\d+(\.\d+)?)/i)[1]
|
, version : getVersion(ua, /silk\/(\d+(\.\d+)?)/i, 1)
|
||||||
}
|
}
|
||||||
else if (iphone || ipad || ipod) {
|
else if (iphone || ipad || ipod) {
|
||||||
o = {
|
o = {
|
||||||
@ -107,7 +112,7 @@
|
|||||||
}
|
}
|
||||||
// WTF: version is not part of user agent in web apps
|
// WTF: version is not part of user agent in web apps
|
||||||
if (webkitVersion.test(ua)) {
|
if (webkitVersion.test(ua)) {
|
||||||
o.version = ua.match(webkitVersion)[1]
|
o.version = getVersion(ua, webkitVersion, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (blackberry) {
|
else if (blackberry) {
|
||||||
@ -116,11 +121,11 @@
|
|||||||
, blackberry: t
|
, blackberry: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
}
|
}
|
||||||
if ((v = ua.match(webkitVersion))) {
|
if ((v = getVersion(ua, webkitVersion, 1))) {
|
||||||
o.version = v[1]
|
o.version = v
|
||||||
o.webkit = t
|
o.webkit = t
|
||||||
} else {
|
} else {
|
||||||
o.version = ua.match(/blackberry[\d]+\/(\d+(\.\d+)?)/i)[1]
|
o.version = getVersion(ua, /blackberry[\d]+\/(\d+(\.\d+)?)/i, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (webos) o = {
|
else if (webos) o = {
|
||||||
@ -128,19 +133,19 @@
|
|||||||
, mobile: t
|
, mobile: t
|
||||||
, webkit: t
|
, webkit: t
|
||||||
, webos: t
|
, webos: t
|
||||||
, version: (ua.match(webkitVersion) || ua.match(/wosbrowser\/(\d+(\.\d+)?)/i))[1]
|
, version: (getVersion(ua, webkitVersion, 1) || getVersion(ua, /wosbrowser\/(\d+(\.\d+)?)/i, 1))
|
||||||
}
|
}
|
||||||
else if (gecko) {
|
else if (gecko) {
|
||||||
o = {
|
o = {
|
||||||
name: 'Gecko'
|
name: 'Gecko'
|
||||||
, gecko: t
|
, gecko: t
|
||||||
, mozilla: t
|
, mozilla: t
|
||||||
, version: ((v = ua.match(firefoxVersion)) && v? v[1] : 0)
|
, version: getVersion(ua, firefoxVersion, 1)
|
||||||
}
|
}
|
||||||
if (seamonkey) {
|
if (seamonkey) {
|
||||||
o.name = 'SeaMonkey'
|
o.name = 'SeaMonkey'
|
||||||
o.seamonkey = t
|
o.seamonkey = t
|
||||||
o.version = ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
|
o.version = getVersion(ua, /seamonkey\/(\d+(\.\d+)?)/i, 1)
|
||||||
} else if (firefox) {
|
} else if (firefox) {
|
||||||
o.name = 'Firefox'
|
o.name = 'Firefox'
|
||||||
o.firefox = t
|
o.firefox = t
|
||||||
@ -158,13 +163,13 @@
|
|||||||
, webkit: t
|
, webkit: t
|
||||||
, android: t
|
, android: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
, version: ua.match(webkitVersion)[1]
|
, version: getVersion(ua, webkitVersion, 1)
|
||||||
}
|
}
|
||||||
else if (safari) o = {
|
else if (safari) o = {
|
||||||
name: 'Safari'
|
name: 'Safari'
|
||||||
, webkit: t
|
, webkit: t
|
||||||
, safari: t
|
, safari: t
|
||||||
, version: ((v = ua.match(webkitVersion)) ? v[1] : 0)
|
, version: getVersion(ua, webkitVersion, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Graded Browser Support
|
// Graded Browser Support
|
||||||
|
Loading…
Reference in New Issue
Block a user