mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
marginally improved regex to detect firefoxos
This commit is contained in:
parent
b62ae3e233
commit
ffd340c62b
@ -159,7 +159,7 @@
|
|||||||
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)) {
|
} else if (!android && firefox && /\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
|
||||||
o.firefoxos = t
|
o.firefoxos = t
|
||||||
o.mobile = t
|
o.mobile = t
|
||||||
}
|
}
|
||||||
|
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 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/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={};f&&(u=!1);if(w)T={name:"Windows Phone",windowsphone:e,msie:e,mobile:e,version:n(r,/iemobile\/(\d+(\.\d+)?)/i,1)};else if(d)t=n(r,S,1)||n(r,/opr\/(\d+(\.\d+)?)/i,1)||n(r,/opera[ \/](\d+(\.\d+)?)/i,1),T={name:"Opera",opera:e,version:t},p&&(T.android=e,T.mobile=e),s&&(T.webkit=e);else if(i)T={name:"Internet Explorer",msie:e,version:n(r,/(msie |rv:)(\d+(\.\d+)?)/i,2)};else if(s){T={name:"Chrome",webkit:e,chrome:e,version:n(r,/(?:chrome|crios)\/(\d+(\.\d+)?)/i,1)},p&&(T.android=e);if(a||f||u)T[u?"iphone":a?"ipad":"ipod"]=e,T.ios=e;if(T.android||T.ios)T.mobile=e}else o?T={name:"PhantomJS",webkit:e,phantom:e,version:n(r,/phantomjs\/(\d+(\.\d+)?)/i,1)}:l?T={name:"TouchPad",webkit:e,touchpad:e,version:n(r,/touchpad\/(\d+(\.\d+)?)/i,1)}:c?T={name:"Amazon Silk",webkit:e,android:e,mobile:e,version:n(r,/silk\/(\d+(\.\d+)?)/i,1)}:u||a||f?(T={name:u?"iPhone":a?"iPad":"iPod",webkit:e,mobile:e,ios:e},T[u?"iphone":a?"ipad":"ipod"]=e,S.test(r)&&(T.version=n(r,S,1))):E?(T={name:"BlackBerry",blackberry:e,mobile:e},(t=n(r,S,1))?(T.version=t,T.webkit=e):T.version=n(r,/blackberry[\d]+\/(\d+(\.\d+)?)/i,1)):b?T={name:"WebOS",mobile:e,webkit:e,webos:e,version:n(r,S,1)||n(r,/wosbrowser\/(\d+(\.\d+)?)/i,1)}:g?(T={name:"Gecko",gecko:e,mozilla:e,version:n(r,x,1)},y?(T.name="SeaMonkey",T.seamonkey=e,T.version=n(r,/seamonkey\/(\d+(\.\d+)?)/i,1)):m&&(T.name="Firefox",T.firefox=e),p?(T.android=e,T.mobile=e):!p&&m&&/\((mobile|tablet);.*rv:[\d\.]+\)/i.test(r)&&(T.firefoxos=e,T.mobile=e)):p?T={name:"Android",webkit:e,android:e,mobile:e,version:n(r,S,1)}:h&&(T={name:"Safari",webkit:e,safari:e,version:n(r,S,1)});var N;return p?(N=n(r,/android[ \/](\d+(\.\d+)*)/i,1),N&&(T.osversion=N)):u||a||f?(N=n(r,/os (\d+([_\s]\d+)*) like mac os x/i,1),N&&(T.osversion=N.replace(/[_\s]/g,"."))):w&&(N=n(r,/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,1),N&&(T.osversion=N)),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.ios&&T.osversion&&T.osversion.split(".")[0]>=6?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.ios&&T.osversion&&T.osversion.split(".")[0]<6?T.c=e:T.x=e,T}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 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={};f&&(u=!1);if(w)T={name:"Windows Phone",windowsphone:e,msie:e,mobile:e,version:n(r,/iemobile\/(\d+(\.\d+)?)/i,1)};else if(d)t=n(r,S,1)||n(r,/opr\/(\d+(\.\d+)?)/i,1)||n(r,/opera[ \/](\d+(\.\d+)?)/i,1),T={name:"Opera",opera:e,version:t},p&&(T.android=e,T.mobile=e),s&&(T.webkit=e);else if(i)T={name:"Internet Explorer",msie:e,version:n(r,/(msie |rv:)(\d+(\.\d+)?)/i,2)};else if(s){T={name:"Chrome",webkit:e,chrome:e,version:n(r,/(?:chrome|crios)\/(\d+(\.\d+)?)/i,1)},p&&(T.android=e);if(a||f||u)T[u?"iphone":a?"ipad":"ipod"]=e,T.ios=e;if(T.android||T.ios)T.mobile=e}else o?T={name:"PhantomJS",webkit:e,phantom:e,version:n(r,/phantomjs\/(\d+(\.\d+)?)/i,1)}:l?T={name:"TouchPad",webkit:e,touchpad:e,version:n(r,/touchpad\/(\d+(\.\d+)?)/i,1)}:c?T={name:"Amazon Silk",webkit:e,android:e,mobile:e,version:n(r,/silk\/(\d+(\.\d+)?)/i,1)}:u||a||f?(T={name:u?"iPhone":a?"iPad":"iPod",webkit:e,mobile:e,ios:e},T[u?"iphone":a?"ipad":"ipod"]=e,S.test(r)&&(T.version=n(r,S,1))):E?(T={name:"BlackBerry",blackberry:e,mobile:e},(t=n(r,S,1))?(T.version=t,T.webkit=e):T.version=n(r,/blackberry[\d]+\/(\d+(\.\d+)?)/i,1)):b?T={name:"WebOS",mobile:e,webkit:e,webos:e,version:n(r,S,1)||n(r,/wosbrowser\/(\d+(\.\d+)?)/i,1)}:g?(T={name:"Gecko",gecko:e,mozilla:e,version:n(r,x,1)},y?(T.name="SeaMonkey",T.seamonkey=e,T.version=n(r,/seamonkey\/(\d+(\.\d+)?)/i,1)):m&&(T.name="Firefox",T.firefox=e),p?(T.android=e,T.mobile=e):!p&&m&&/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(r)&&(T.firefoxos=e,T.mobile=e)):p?T={name:"Android",webkit:e,android:e,mobile:e,version:n(r,S,1)}:h&&(T={name:"Safari",webkit:e,safari:e,version:n(r,S,1)});var N;return p?(N=n(r,/android[ \/](\d+(\.\d+)*)/i,1),N&&(T.osversion=N)):u||a||f?(N=n(r,/os (\d+([_\s]\d+)*) like mac os x/i,1),N&&(T.osversion=N.replace(/[_\s]/g,"."))):w&&(N=n(r,/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,1),N&&(T.osversion=N)),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.ios&&T.osversion&&T.osversion.split(".")[0]>=6?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.ios&&T.osversion&&T.osversion.split(".")[0]<6?T.c=e:T.x=e,T}var e=!0,t,i=r(typeof navigator!="undefined"?navigator.userAgent:"");return i._detect=r,i})
|
@ -153,7 +153,7 @@
|
|||||||
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)) {
|
} else if (!android && firefox && /\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
|
||||||
o.firefoxos = t
|
o.firefoxos = t
|
||||||
o.mobile = t
|
o.mobile = t
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user