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

6 lines
1.6 KiB
JavaScript
Raw Normal View History

2011-04-27 22:14:35 +00:00
/*!
* Bowser - a browser detector
* https://github.com/ded/bowser
* MIT License | (c) Dustin Diaz 2011
*/
2013-08-16 10:53:26 +00:00
!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})