1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

recognize Amazon Kindle Fire Silk browser

This commit is contained in:
Leroix 2014-01-23 15:29:24 -07:00
parent 88589615f4
commit 61d4ee6e43
3 changed files with 21 additions and 3 deletions

View File

@ -13,6 +13,7 @@
* navigator.userAgent => * navigator.userAgent =>
* Chrome: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.57 Safari/534.24" * Chrome: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.57 Safari/534.24"
* Opera: "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.7; U; en) Presto/2.7.62 Version/11.01" * Opera: "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.7; U; en) Presto/2.7.62 Version/11.01"
* Silk: "Mozilla/5.0 (Linux; U; en-us; KFOT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.8 Safari/535.19 Silk-Accelerated=true"
* Safari: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1" * Safari: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1"
* IE: "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)" * IE: "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)"
* IE>=11: "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; Media Center PC 6.0; rv:11.0) like Gecko" * IE>=11: "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; Media Center PC 6.0; rv:11.0) like Gecko"
@ -29,7 +30,8 @@
, ie = /(msie|trident)/i.test(ua) , ie = /(msie|trident)/i.test(ua)
, chrome = /chrome|crios/i.test(ua) , chrome = /chrome|crios/i.test(ua)
, phantom = /phantom/i.test(ua) , phantom = /phantom/i.test(ua)
, safari = /safari/i.test(ua) && !chrome && !phantom , silk = /silk/i.test(ua)
, safari = /safari/i.test(ua) && !chrome && !phantom && !silk
, 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)
@ -94,6 +96,13 @@
, mobile: t , mobile: t
, version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1] , version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1]
} }
if (silk) return {
name: 'Silk'
, webkit: t
, silk: t
, mobile: t
, version: ua.match(/silk\/(\d+(\.\d+)?)/i)[1]
}
if (safari) return { if (safari) return {
name: 'Safari' name: 'Safari'
, webkit: t , webkit: t

2
bowser.min.js vendored
View File

@ -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 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]}:u||a?(g={name:u?"iPhone":"iPad",webkit:t,mobile:t,ios:t,iphone:u,ipad: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:"Silk",webkit:t,silk:t,mobile:t,version:e.match(/version\/(\d+(\.\d+)?)/i)[1]}:o?{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=/silk/i.test(e),o=/safari/i.test(e)&&!r&&!i&&!s,u=/iphone/i.test(e),a=/ipad/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})

View File

@ -7,6 +7,7 @@
* navigator.userAgent => * navigator.userAgent =>
* Chrome: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.57 Safari/534.24" * Chrome: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.57 Safari/534.24"
* Opera: "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.7; U; en) Presto/2.7.62 Version/11.01" * Opera: "Opera/9.80 (Macintosh; Intel Mac OS X 10.6.7; U; en) Presto/2.7.62 Version/11.01"
* Silk: "Mozilla/5.0 (Linux; U; en-us; KFOT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.8 Safari/535.19 Silk-Accelerated=true"
* Safari: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1" * Safari: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; en-us) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/5.0.5 Safari/533.21.1"
* IE: "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)" * IE: "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)"
* IE>=11: "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; Media Center PC 6.0; rv:11.0) like Gecko" * IE>=11: "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; Media Center PC 6.0; rv:11.0) like Gecko"
@ -23,7 +24,8 @@
, ie = /(msie|trident)/i.test(ua) , ie = /(msie|trident)/i.test(ua)
, chrome = /chrome|crios/i.test(ua) , chrome = /chrome|crios/i.test(ua)
, phantom = /phantom/i.test(ua) , phantom = /phantom/i.test(ua)
, safari = /safari/i.test(ua) && !chrome && !phantom , silk = /silk/i.test(ua)
, safari = /safari/i.test(ua) && !chrome && !phantom && !silk
, 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)
@ -88,6 +90,13 @@
, mobile: t , mobile: t
, version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1] , version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1]
} }
if (silk) return {
name: 'Silk'
, webkit: t
, silk: t
, mobile: t
, version: ua.match(/version\/(\d+(\.\d+)?)/i)[1]
}
if (safari) return { if (safari) return {
name: 'Safari' name: 'Safari'
, webkit: t , webkit: t