mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Add iPod check into the mix
Since you get a flag for iPhone and iPad it only makes sense to also provide a flag for iPod for completeness.
This commit is contained in:
parent
88589615f4
commit
6ddead5399
@ -19,6 +19,7 @@
|
||||
* Firefox: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0) Gecko/20100101 Firefox/4.0"
|
||||
* 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"
|
||||
* 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",
|
||||
* iPod: "Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3_3 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 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"
|
||||
* 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"
|
||||
@ -32,6 +33,7 @@
|
||||
, safari = /safari/i.test(ua) && !chrome && !phantom
|
||||
, iphone = /iphone/i.test(ua)
|
||||
, ipad = /ipad/i.test(ua)
|
||||
, ipod = /ipod/i.test(ua)
|
||||
, touchpad = /touchpad/i.test(ua)
|
||||
, android = /android/i.test(ua)
|
||||
, opera = /opera/i.test(ua) || /opr/i.test(ua)
|
||||
@ -72,14 +74,15 @@
|
||||
, touchpad: t
|
||||
, version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1]
|
||||
}
|
||||
if (iphone || ipad) {
|
||||
if (iphone || ipad || ipod) {
|
||||
o = {
|
||||
name : iphone ? 'iPhone' : 'iPad'
|
||||
name : iphone ? 'iPhone' : ipad ? 'iPad' : 'iPod'
|
||||
, webkit: t
|
||||
, mobile: t
|
||||
, ios: t
|
||||
, iphone: iphone
|
||||
, ipad: ipad
|
||||
, ipod: ipod
|
||||
}
|
||||
// WTF: version is not part of user agent in web apps
|
||||
if (webkitVersion.test(ua)) {
|
||||
|
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 g(){return n?{name:"Internet Explorer",msie:t,version:e.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]}:l?{name:"Opera",opera:t,version:e.match(d)?e.match(d)[1]:e.match(/opr\/(\d+(\.\d+)?)/i)[1]}:r?{name:"Chrome",webkit:t,chrome:t,version:e.match(/(?:chrome|crios)\/(\d+(\.\d+)?)/i)[1]}:i?{name:"PhantomJS",webkit:t,phantom:t,version:e.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]}:a?{name:"TouchPad",webkit:t,touchpad:t,version:e.match(/touchpad\/(\d+(\.\d+)?)/i)[1]}:o||u?(m={name:o?"iPhone":"iPad",webkit:t,mobile:t,ios:t,iphone:o,ipad:u},d.test(e)&&(m.version=e.match(d)[1]),m):f?{name:"Android",webkit:t,android:t,mobile:t,version:(e.match(d)||e.match(v))[1]}:s?{name:"Safari",webkit:t,safari:t,version:e.match(d)[1]}:h?(m={name:"Gecko",gecko:t,mozilla:t,version:e.match(v)[1]},c&&(m.name="Firefox",m.firefox=t),m):p?{name:"SeaMonkey",seamonkey:t,version:e.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]}:{}}var e=navigator.userAgent,t=!0,n=/(msie|trident)/i.test(e),r=/chrome|crios/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)||/opr/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>=8||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<8||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})
|
||||
!function(e,t){typeof define=="function"?define(t):typeof module!="undefined"&&module.exports?module.exports.browser=t():this[e]=t()}("bowser",function(){function y(){return n?{name:"Internet Explorer",msie:t,version:e.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]}:c?{name:"Opera",opera:t,version:e.match(v)?e.match(v)[1]:e.match(/opr\/(\d+(\.\d+)?)/i)[1]}:r?{name:"Chrome",webkit:t,chrome:t,version:e.match(/(?:chrome|crios)\/(\d+(\.\d+)?)/i)[1]}:i?{name:"PhantomJS",webkit:t,phantom:t,version:e.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]}:f?{name:"TouchPad",webkit:t,touchpad:t,version:e.match(/touchpad\/(\d+(\.\d+)?)/i)[1]}:o||u||a?(g={name:o?"iPhone":u?"iPad":"iPod",webkit:t,mobile:t,ios:t,iphone:o,ipad:u,ipod:a},v.test(e)&&(g.version=e.match(v)[1]),g):l?{name:"Android",webkit:t,android:t,mobile:t,version:(e.match(v)||e.match(m))[1]}:s?{name:"Safari",webkit:t,safari:t,version:e.match(v)[1]}:p?(g={name:"Gecko",gecko:t,mozilla:t,version:e.match(m)[1]},h&&(g.name="Firefox",g.firefox=t),g):d?{name:"SeaMonkey",seamonkey:t,version:e.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]}:{}}var e=navigator.userAgent,t=!0,n=/(msie|trident)/i.test(e),r=/chrome|crios/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=/ipod/i.test(e),f=/touchpad/i.test(e),l=/android/i.test(e),c=/opera/i.test(e)||/opr/i.test(e),h=/firefox/i.test(e),p=/gecko\//i.test(e),d=/seamonkey\//i.test(e),v=/version\/(\d+(\.\d+)?)/i,m=/firefox\/(\d+(\.\d+)?)/i,g,b=y();return b.msie&&b.version>=8||b.chrome&&b.version>=10||b.firefox&&b.version>=4||b.safari&&b.version>=5||b.opera&&b.version>=10?b.a=t:b.msie&&b.version<8||b.chrome&&b.version<10||b.firefox&&b.version<4||b.safari&&b.version<5||b.opera&&b.version<10?b.c=t:b.x=t,b})
|
@ -13,6 +13,7 @@
|
||||
* Firefox: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0) Gecko/20100101 Firefox/4.0"
|
||||
* 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"
|
||||
* 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",
|
||||
* iPod: "Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3_3 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 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"
|
||||
* 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"
|
||||
@ -26,6 +27,7 @@
|
||||
, safari = /safari/i.test(ua) && !chrome && !phantom
|
||||
, iphone = /iphone/i.test(ua)
|
||||
, ipad = /ipad/i.test(ua)
|
||||
, ipod = /ipod/i.test(ua)
|
||||
, touchpad = /touchpad/i.test(ua)
|
||||
, android = /android/i.test(ua)
|
||||
, opera = /opera/i.test(ua) || /opr/i.test(ua)
|
||||
@ -66,14 +68,15 @@
|
||||
, touchpad: t
|
||||
, version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1]
|
||||
}
|
||||
if (iphone || ipad) {
|
||||
if (iphone || ipad || ipod) {
|
||||
o = {
|
||||
name : iphone ? 'iPhone' : 'iPad'
|
||||
name : iphone ? 'iPhone' : ipad ? 'iPad' : 'iPod'
|
||||
, webkit: t
|
||||
, mobile: t
|
||||
, ios: t
|
||||
, iphone: iphone
|
||||
, ipad: ipad
|
||||
, ipod: ipod
|
||||
}
|
||||
// WTF: version is not part of user agent in web apps
|
||||
if (webkitVersion.test(ua)) {
|
||||
|
Loading…
Reference in New Issue
Block a user