mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
add support amazon silk support for kindle devices
This commit is contained in:
parent
88589615f4
commit
325df23ddc
10
bowser.js
10
bowser.js
@ -22,6 +22,7 @@
|
||||
* 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"
|
||||
* Amazon Silk: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.22.153_10033210) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true"
|
||||
*/
|
||||
|
||||
var ua = navigator.userAgent
|
||||
@ -33,6 +34,7 @@
|
||||
, iphone = /iphone/i.test(ua)
|
||||
, ipad = /ipad/i.test(ua)
|
||||
, touchpad = /touchpad/i.test(ua)
|
||||
, silk = /silk/i.test(ua)
|
||||
, android = /android/i.test(ua)
|
||||
, opera = /opera/i.test(ua) || /opr/i.test(ua)
|
||||
, firefox = /firefox/i.test(ua)
|
||||
@ -72,6 +74,14 @@
|
||||
, touchpad: t
|
||||
, version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1]
|
||||
}
|
||||
|
||||
if (silk) return {
|
||||
name: 'Amazon Silk'
|
||||
, webkit: t
|
||||
, android: t
|
||||
, mobile: t
|
||||
, version : ua.match(/silk\/(\d+(\.\d+)?)/i)[1]
|
||||
}
|
||||
if (iphone || ipad) {
|
||||
o = {
|
||||
name : iphone ? 'iPhone' : 'iPad'
|
||||
|
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]}:a?{name:"TouchPad",webkit:t,touchpad:t,version:e.match(/touchpad\/(\d+(\.\d+)?)/i)[1]}:f?{name:"Amazon Silk",webkit:t,android:t,mobile:t,version:e.match(/silk\/(\d+(\.\d+)?)/i)[1]}:o||u?(g={name:o?"iPhone":"iPad",webkit:t,mobile:t,ios:t,iphone:o,ipad:u},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=/touchpad/i.test(e),f=/silk/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})
|
@ -16,6 +16,7 @@
|
||||
* 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"
|
||||
* Amazon Silk: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.22.153_10033210) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true"
|
||||
*/
|
||||
|
||||
var ua = navigator.userAgent
|
||||
@ -27,6 +28,7 @@
|
||||
, iphone = /iphone/i.test(ua)
|
||||
, ipad = /ipad/i.test(ua)
|
||||
, touchpad = /touchpad/i.test(ua)
|
||||
, silk = /silk/i.test(ua)
|
||||
, android = /android/i.test(ua)
|
||||
, opera = /opera/i.test(ua) || /opr/i.test(ua)
|
||||
, firefox = /firefox/i.test(ua)
|
||||
@ -66,6 +68,14 @@
|
||||
, touchpad: t
|
||||
, version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1]
|
||||
}
|
||||
|
||||
if (silk) return {
|
||||
name: 'Amazon Silk'
|
||||
, webkit: t
|
||||
, android: t
|
||||
, mobile: t
|
||||
, version : ua.match(/silk\/(\d+(\.\d+)?)/i)[1]
|
||||
}
|
||||
if (iphone || ipad) {
|
||||
o = {
|
||||
name : iphone ? 'iPhone' : 'iPad'
|
||||
|
Loading…
Reference in New Issue
Block a user