mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Merge pull request #22 from bpierre/firefox-android
Firefox for Android
This commit is contained in:
commit
e0b3391a82
@ -37,6 +37,7 @@
|
|||||||
, gecko = /gecko\//i.test(ua)
|
, gecko = /gecko\//i.test(ua)
|
||||||
, seamonkey = /seamonkey\//i.test(ua)
|
, seamonkey = /seamonkey\//i.test(ua)
|
||||||
, webkitVersion = /version\/(\d+(\.\d+)?)/i
|
, webkitVersion = /version\/(\d+(\.\d+)?)/i
|
||||||
|
, firefoxVersion = /firefox\/(\d+(\.\d+)?)/i
|
||||||
, o
|
, o
|
||||||
|
|
||||||
function detect() {
|
function detect() {
|
||||||
@ -78,7 +79,7 @@
|
|||||||
webkit: t
|
webkit: t
|
||||||
, android: t
|
, android: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
, version: ua.match(webkitVersion)[1]
|
, version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1]
|
||||||
}
|
}
|
||||||
if (safari) return {
|
if (safari) return {
|
||||||
webkit: t
|
webkit: t
|
||||||
@ -93,7 +94,7 @@
|
|||||||
o = {
|
o = {
|
||||||
gecko: t
|
gecko: t
|
||||||
, mozilla: t
|
, mozilla: t
|
||||||
, version: ua.match(/firefox\/(\d+(\.\d+)?)/i)[1]
|
, version: ua.match(firefoxVersion)[1]
|
||||||
}
|
}
|
||||||
if (firefox) o.firefox = t
|
if (firefox) o.firefox = t
|
||||||
return o
|
return o
|
||||||
|
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 2011
|
* MIT License | (c) Dustin Diaz 2011
|
||||||
*/
|
*/
|
||||||
!function(a,b){typeof define=="function"?define(b):typeof module!="undefined"&&module.exports?module.exports.browser=b():this[a]=b()}("bowser",function(){function p(){if(c)return{msie:b,version:a.match(/msie (\d+(\.\d+)?);/i)[1]};if(d)return{webkit:b,chrome:b,version:a.match(/chrome\/(\d+(\.\d+)?)/i)[1]};if(h)return{webkit:b,touchpad:b,version:a.match(/touchpad\/(\d+(\.\d+)?)/i)[1]};if(f||g){o={webkit:b,mobile:b,ios:b,iphone:f,ipad:g},n.test(a)&&(o.version=a.match(n)[1]);return o}if(i)return{webkit:b,android:b,mobile:b,version:a.match(n)[1]};if(e)return{webkit:b,safari:b,version:a.match(n)[1]};if(j)return{opera:b,version:a.match(n)[1]};if(l){o={gecko:b,mozilla:b,version:a.match(/firefox\/(\d+(\.\d+)?)/i)[1]},k&&(o.firefox=b);return o}if(m)return{seamonkey:b,version:a.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]}}var a=navigator.userAgent,b=!0,c=/msie/i.test(a),d=/chrome/i.test(a),e=/safari/i.test(a)&&!d,f=/iphone/i.test(a),g=/ipad/i.test(a),h=/touchpad/i.test(a),i=/android/i.test(a),j=/opera/i.test(a),k=/firefox/i.test(a),l=/gecko\//i.test(a),m=/seamonkey\//i.test(a),n=/version\/(\d+(\.\d+)?)/i,o,q=p();q.msie&&q.version>=7||q.chrome&&q.version>=10||q.firefox&&q.version>=4||q.safari&&q.version>=5||q.opera&&q.version>=10?q.a=b:q.msie&&q.version<7||q.chrome&&q.version<10||q.firefox&&q.version<4||q.safari&&q.version<5||q.opera&&q.version<10?q.c=b:q.x=b;return q})
|
!function(e,t){typeof define=="function"?define(t):typeof module!="undefined"&&module.exports?module.exports.browser=t():this[e]=t()}("bowser",function(){function g(){if(n)return{msie:t,version:e.match(/msie (\d+(\.\d+)?);/i)[1]};if(r)return{webkit:t,chrome:t,version:e.match(/chrome\/(\d+(\.\d+)?)/i)[1]};if(i)return{webkit:t,phantom:t,version:e.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]};if(a)return{webkit:t,touchpad:t,version:e.match(/touchpad\/(\d+(\.\d+)?)/i)[1]};if(o||u)return m={webkit:t,mobile:t,ios:t,iphone:o,ipad:u},d.test(e)&&(m.version=e.match(d)[1]),m;if(f)return{webkit:t,android:t,mobile:t,version:(e.match(d)||e.match(v))[1]};if(s)return{webkit:t,safari:t,version:e.match(d)[1]};if(l)return{opera:t,version:e.match(d)[1]};if(h)return m={gecko:t,mozilla:t,version:e.match(v)[1]},c&&(m.firefox=t),m;if(p)return{seamonkey:t,version:e.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]}}var e=navigator.userAgent,t=!0,n=/msie/i.test(e),r=/chrome/i.test(e),i=/phantom/i.test(e),s=/safari/i.test(e)&&!r&&!i,o=/iphone/i.test(e),u=/ipad/i.test(e),a=/touchpad/i.test(e),f=/android/i.test(e),l=/opera/i.test(e),c=/firefox/i.test(e),h=/gecko\//i.test(e),p=/seamonkey\//i.test(e),d=/version\/(\d+(\.\d+)?)/i,v=/firefox\/(\d+(\.\d+)?)/i,m,y=g();return y.msie&&y.version>=7||y.chrome&&y.version>=10||y.firefox&&y.version>=4||y.safari&&y.version>=5||y.opera&&y.version>=10?y.a=t:y.msie&&y.version<7||y.chrome&&y.version<10||y.firefox&&y.version<4||y.safari&&y.version<5||y.opera&&y.version<10?y.c=t:y.x=t,y})
|
@ -14,13 +14,15 @@
|
|||||||
* iPad: "Mozilla/5.0 (iPad; U; CPU 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",
|
* iPad: "Mozilla/5.0 (iPad; U; CPU 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",
|
||||||
* Android: "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; T-Mobile G2 Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
|
* Android: "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; T-Mobile G2 Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"
|
||||||
* Touchpad: "Mozilla/5.0 (hp-tabled;Linux;hpwOS/3.0.5; U; en-US)) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/234.83 Safari/534.6 TouchPad/1.0"
|
* Touchpad: "Mozilla/5.0 (hp-tabled;Linux;hpwOS/3.0.5; U; en-US)) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/234.83 Safari/534.6 TouchPad/1.0"
|
||||||
|
* PhantomJS: "Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.5.0 Safari/534.34"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var ua = navigator.userAgent
|
var ua = navigator.userAgent
|
||||||
, t = true
|
, t = true
|
||||||
, ie = /msie/i.test(ua)
|
, ie = /msie/i.test(ua)
|
||||||
, chrome = /chrome/i.test(ua)
|
, chrome = /chrome/i.test(ua)
|
||||||
, safari = /safari/i.test(ua) && !chrome
|
, phantom = /phantom/i.test(ua)
|
||||||
|
, safari = /safari/i.test(ua) && !chrome && !phantom
|
||||||
, iphone = /iphone/i.test(ua)
|
, iphone = /iphone/i.test(ua)
|
||||||
, ipad = /ipad/i.test(ua)
|
, ipad = /ipad/i.test(ua)
|
||||||
, touchpad = /touchpad/i.test(ua)
|
, touchpad = /touchpad/i.test(ua)
|
||||||
@ -30,6 +32,7 @@
|
|||||||
, gecko = /gecko\//i.test(ua)
|
, gecko = /gecko\//i.test(ua)
|
||||||
, seamonkey = /seamonkey\//i.test(ua)
|
, seamonkey = /seamonkey\//i.test(ua)
|
||||||
, webkitVersion = /version\/(\d+(\.\d+)?)/i
|
, webkitVersion = /version\/(\d+(\.\d+)?)/i
|
||||||
|
, firefoxVersion = /firefox\/(\d+(\.\d+)?)/i
|
||||||
, o
|
, o
|
||||||
|
|
||||||
function detect() {
|
function detect() {
|
||||||
@ -43,6 +46,11 @@
|
|||||||
, chrome: t
|
, chrome: t
|
||||||
, version: ua.match(/chrome\/(\d+(\.\d+)?)/i)[1]
|
, version: ua.match(/chrome\/(\d+(\.\d+)?)/i)[1]
|
||||||
}
|
}
|
||||||
|
if (phantom) return {
|
||||||
|
webkit: t
|
||||||
|
, phantom: t
|
||||||
|
, version: ua.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]
|
||||||
|
}
|
||||||
if (touchpad) return {
|
if (touchpad) return {
|
||||||
webkit: t
|
webkit: t
|
||||||
, touchpad: t
|
, touchpad: t
|
||||||
@ -66,7 +74,7 @@
|
|||||||
webkit: t
|
webkit: t
|
||||||
, android: t
|
, android: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
, version: ua.match(webkitVersion)[1]
|
, version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1]
|
||||||
}
|
}
|
||||||
if (safari) return {
|
if (safari) return {
|
||||||
webkit: t
|
webkit: t
|
||||||
@ -81,7 +89,7 @@
|
|||||||
o = {
|
o = {
|
||||||
gecko: t
|
gecko: t
|
||||||
, mozilla: t
|
, mozilla: t
|
||||||
, version: ua.match(/firefox\/(\d+(\.\d+)?)/i)[1]
|
, version: ua.match(firefoxVersion)[1]
|
||||||
}
|
}
|
||||||
if (firefox) o.firefox = t
|
if (firefox) o.firefox = t
|
||||||
return o
|
return o
|
||||||
|
Loading…
Reference in New Issue
Block a user