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
2.0 KiB
JavaScript
Raw Normal View History

2011-04-27 22:14:35 +00:00
/*!
* Bowser - a browser detector
* https://github.com/ded/bowser
2013-08-16 20:03:14 +00:00
* MIT License | (c) Dustin Diaz 2013
*/
2014-02-19 17:16:06 +00:00
!function(e,t){typeof module!="undefined"&&module.exports?module.exports.browser=t():typeof define=="function"?define(t):this[e]=t()}("bowser",function(){function w(){return n?{name:"Internet Explorer",msie:t,version:e.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]}:h?{name:"Opera",opera:t,version:e.match(m)?e.match(m)[1]:e.match(/opr\/(\d+(\.\d+)?)/i)[1]}:r?{name:"Chrome",webkit:t,chrome:t,version:e.match(/(?:chrome|crios)\/(\d+(\.\d+)?)/i)[1],ipad:o,iphone:s,ios:!!e.match(/crios/i),mobile:y}: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]}:s||o||u?(b={name:s?"iPhone":o?"iPad":"iPod",webkit:t,mobile:s,ios:t,iphone:s,ipad:o,ipod:u},m.test(e)&&(b.version=e.match(m)[1]),b):c?{name:"Android",webkit:t,android:t,mobile:t,version:(e.match(m)||e.match(g))[1]}:l?{name:"Safari",webkit:t,safari:t,version:e.match(m)[1]}:d?(b={name:"Gecko",gecko:t,mozilla:t,version:e.match(g)[1]},p&&(b.name="Firefox",b.firefox=t),b):v?{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=/iphone/i.test(e),o=/ipad/i.test(e),u=/ipod/i.test(e),a=/touchpad/i.test(e),f=/silk/i.test(e),l=/safari/i.test(e)&&!r&&!i&&!f,c=/android/i.test(e),h=/opera/i.test(e)||/opr/i.test(e),p=/firefox/i.test(e),d=/gecko\//i.test(e),v=/seamonkey\//i.test(e),m=/version\/(\d+(\.\d+)?)/i,g=/firefox\/(\d+(\.\d+)?)/i,y=/mobile/i.test(e),b,E=w();return E.msie&&E.version>=9||E.chrome&&E.version>=20||E.firefox&&E.version>=10||E.safari&&E.version>=5||E.opera&&E.version>=10?E.a=t:E.msie&&E.version<9||E.chrome&&E.version<20||E.firefox&&E.version<10||E.safari&&E.version<5||E.opera&&E.version<10?E.c=t:E.x=t,E})