mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
added tests for seamonkey and fixed detection
This commit is contained in:
parent
4acca40a99
commit
1a22035c5b
16
bowser.js
16
bowser.js
@ -143,14 +143,19 @@
|
||||
, mozilla: t
|
||||
, version: ((v = ua.match(firefoxVersion)) && v? v[1] : 0)
|
||||
}
|
||||
if (firefox) {
|
||||
o.name = 'Firefox';
|
||||
o.firefox = t;
|
||||
if (seamonkey) {
|
||||
o.name = 'SeaMonkey'
|
||||
o.seamonkey = t
|
||||
o.version = ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
|
||||
} else if (firefox) {
|
||||
o.name = 'Firefox'
|
||||
o.firefox = t
|
||||
}
|
||||
if (android) {
|
||||
o.android = t
|
||||
o.mobile = t
|
||||
}
|
||||
|
||||
}
|
||||
else if (android) o = {
|
||||
name: 'Android'
|
||||
@ -165,11 +170,6 @@
|
||||
, safari: t
|
||||
, version: ((v = ua.match(webkitVersion)) ? v[1] : 0)
|
||||
}
|
||||
else if (seamonkey) o = {
|
||||
name: 'SeaMonkey'
|
||||
, seamonkey: t
|
||||
, version: ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
|
||||
}
|
||||
|
||||
// Graded Browser Support
|
||||
// http://developer.yahoo.com/yui/articles/gbs
|
||||
|
2
bowser.min.js
vendored
2
bowser.min.js
vendored
@ -3,4 +3,4 @@
|
||||
* https://github.com/ded/bowser
|
||||
* 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},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}:g&&(T={name:"SeaMonkey",seamonkey:e,version:n.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]}),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(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})
|
@ -137,14 +137,19 @@
|
||||
, mozilla: t
|
||||
, version: ((v = ua.match(firefoxVersion)) && v? v[1] : 0)
|
||||
}
|
||||
if (firefox) {
|
||||
o.name = 'Firefox';
|
||||
o.firefox = t;
|
||||
if (seamonkey) {
|
||||
o.name = 'SeaMonkey'
|
||||
o.seamonkey = t
|
||||
o.version = ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
|
||||
} else if (firefox) {
|
||||
o.name = 'Firefox'
|
||||
o.firefox = t
|
||||
}
|
||||
if (android) {
|
||||
o.android = t
|
||||
o.mobile = t
|
||||
}
|
||||
|
||||
}
|
||||
else if (android) o = {
|
||||
name: 'Android'
|
||||
@ -159,11 +164,6 @@
|
||||
, safari: t
|
||||
, version: ((v = ua.match(webkitVersion)) ? v[1] : 0)
|
||||
}
|
||||
else if (seamonkey) o = {
|
||||
name: 'SeaMonkey'
|
||||
, seamonkey: t
|
||||
, version: ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
|
||||
}
|
||||
|
||||
// Graded Browser Support
|
||||
// http://developer.yahoo.com/yui/articles/gbs
|
||||
|
@ -329,6 +329,15 @@ module.exports.useragents = {
|
||||
, android: true
|
||||
, a: true
|
||||
}
|
||||
, 'Mozilla/5.0 (Android; Tablet; rv:26.0) Gecko/26.0 Firefox/26.0': {
|
||||
mozilla: true
|
||||
, gecko: true
|
||||
, firefox: true
|
||||
, version: '26.0'
|
||||
, mobile: true
|
||||
, android: true
|
||||
, a: true
|
||||
}
|
||||
, 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0': {
|
||||
mozilla: true
|
||||
, gecko: true
|
||||
@ -407,6 +416,29 @@ module.exports.useragents = {
|
||||
, c: true
|
||||
}
|
||||
}
|
||||
, SeaMonkey: {
|
||||
'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
|
||||
, seamonkey: true
|
||||
, version: '2.7'
|
||||
, 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: true
|
||||
, gecko: true
|
||||
, seamonkey: true
|
||||
, version: '2.7'
|
||||
, x: true
|
||||
}
|
||||
, 'Mozilla/5.0 (X11; Linux i686; rv:10.0.1) Gecko/20100101 Firefox/10.0.1 SeaMonkey/2.7.1': {
|
||||
mozilla: true
|
||||
, gecko: true
|
||||
, seamonkey: true
|
||||
, version: '2.7'
|
||||
, x: true
|
||||
}
|
||||
}
|
||||
, 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': {
|
||||
ios: true
|
||||
|
Loading…
Reference in New Issue
Block a user