diff --git a/bowser.js b/bowser.js index c19137c..a028e69 100644 --- a/bowser.js +++ b/bowser.js @@ -4,10 +4,10 @@ * MIT License | (c) Dustin Diaz 2013 */ -!function (name, definition) { - if (typeof define == 'function') define(definition) - else if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition() - else this[name] = definition() +;!function (name, definition) { + if (typeof define == 'function') define(name, [], definition); + else if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition(); + else this[name] = definition(); }('bowser', function () { /** * navigator.userAgent => @@ -40,33 +40,33 @@ , seamonkey = /seamonkey\//i.test(ua) , webkitVersion = /version\/(\d+(\.\d+)?)/i , firefoxVersion = /firefox\/(\d+(\.\d+)?)/i - , o + , o; function detect() { if (ie) return { msie: t , version: ua.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2] - } + }; if (opera) return { opera: t , version: ua.match(webkitVersion) ? ua.match(webkitVersion)[1] : ua.match(/opr\/(\d+(\.\d+)?)/i) - } + }; if (chrome) return { webkit: t , chrome: t , version: ua.match(/chrome\/(\d+(\.\d+)?)/i)[1] - } + }; if (phantom) return { webkit: t , phantom: t , version: ua.match(/phantomjs\/(\d+(\.\d+)+)/i)[1] - } + }; if (touchpad) return { webkit: t , touchpad: t , version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1] - } + }; if (iphone || ipad) { o = { webkit: t @@ -74,41 +74,41 @@ , ios: t , iphone: iphone , ipad: ipad - } + }; // WTF: version is not part of user agent in web apps if (webkitVersion.test(ua)) { - o.version = ua.match(webkitVersion)[1] + o.version = ua.match(webkitVersion)[1]; } - return o + return o; } if (android) return { webkit: t , android: t , mobile: t , version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1] - } + }; if (safari) return { webkit: t , safari: t , version: ua.match(webkitVersion)[1] - } + }; if (gecko) { o = { gecko: t , mozilla: t , version: ua.match(firefoxVersion)[1] - } - if (firefox) o.firefox = t - return o + }; + if (firefox) o.firefox = t; + return o; } if (seamonkey) return { seamonkey: t , version: ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1] - } - return {} + }; + return {}; } - var bowser = detect() + var bowser = detect(); // Graded Browser Support // http://developer.yahoo.com/yui/articles/gbs @@ -125,8 +125,8 @@ (bowser.firefox && bowser.version < 4.0) || (bowser.safari && bowser.version < 5) || (bowser.opera && bowser.version < 10.0)) { - bowser.c = t - } else bowser.x = t + bowser.c = t; + } else bowser.x = t; - return bowser -}) + return bowser; +}); \ No newline at end of file diff --git a/bowser.min.js b/bowser.min.js index 04f4764..478d8fe 100644 --- a/bowser.min.js +++ b/bowser.min.js @@ -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?{msie:t,version:e.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]}:l?{opera:t,version:e.match(d)?e.match(d)[1]:e.match(/opr\/(\d+(\.\d+)?)/i)}:r?{webkit:t,chrome:t,version:e.match(/chrome\/(\d+(\.\d+)?)/i)[1]}:i?{webkit:t,phantom:t,version:e.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]}:a?{webkit:t,touchpad:t,version:e.match(/touchpad\/(\d+(\.\d+)?)/i)[1]}:o||u?(m={webkit:t,mobile:t,ios:t,iphone:o,ipad:u},d.test(e)&&(m.version=e.match(d)[1]),m):f?{webkit:t,android:t,mobile:t,version:(e.match(d)||e.match(v))[1]}:s?{webkit:t,safari:t,version:e.match(d)[1]}:h?(m={gecko:t,mozilla:t,version:e.match(v)[1]},c&&(m.firefox=t),m):p?{seamonkey:t,version:e.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]}:{}}var e=navigator.userAgent,t=!0,n=/(msie|trident)/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)||/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}) \ No newline at end of file +!function(e,t){typeof define=="function"?define(e,[],t):typeof module!="undefined"&&module.exports?module.exports.browser=t():this[e]=t()}("bowser",function(){function g(){return n?{msie:t,version:e.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]}:l?{opera:t,version:e.match(d)?e.match(d)[1]:e.match(/opr\/(\d+(\.\d+)?)/i)}:r?{webkit:t,chrome:t,version:e.match(/chrome\/(\d+(\.\d+)?)/i)[1]}:i?{webkit:t,phantom:t,version:e.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]}:a?{webkit:t,touchpad:t,version:e.match(/touchpad\/(\d+(\.\d+)?)/i)[1]}:o||u?(m={webkit:t,mobile:t,ios:t,iphone:o,ipad:u},d.test(e)&&(m.version=e.match(d)[1]),m):f?{webkit:t,android:t,mobile:t,version:(e.match(d)||e.match(v))[1]}:s?{webkit:t,safari:t,version:e.match(d)[1]}:h?(m={gecko:t,mozilla:t,version:e.match(v)[1]},c&&(m.firefox=t),m):p?{seamonkey:t,version:e.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]}:{}}var e=navigator.userAgent,t=!0,n=/(msie|trident)/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)||/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}) \ No newline at end of file diff --git a/src/bowser.js b/src/bowser.js index 35c1d5c..1fb67f0 100644 --- a/src/bowser.js +++ b/src/bowser.js @@ -1,7 +1,7 @@ -!function (name, definition) { - if (typeof define == 'function') define(definition) - else if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition() - else this[name] = definition() +;!function (name, definition) { + if (typeof define == 'function') define(name, [], definition); + else if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition(); + else this[name] = definition(); }('bowser', function () { /** * navigator.userAgent => @@ -34,33 +34,33 @@ , seamonkey = /seamonkey\//i.test(ua) , webkitVersion = /version\/(\d+(\.\d+)?)/i , firefoxVersion = /firefox\/(\d+(\.\d+)?)/i - , o + , o; function detect() { if (ie) return { msie: t , version: ua.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2] - } + }; if (opera) return { opera: t , version: ua.match(webkitVersion) ? ua.match(webkitVersion)[1] : ua.match(/opr\/(\d+(\.\d+)?)/i) - } + }; if (chrome) return { webkit: t , chrome: t , version: ua.match(/chrome\/(\d+(\.\d+)?)/i)[1] - } + }; if (phantom) return { webkit: t , phantom: t , version: ua.match(/phantomjs\/(\d+(\.\d+)+)/i)[1] - } + }; if (touchpad) return { webkit: t , touchpad: t , version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1] - } + }; if (iphone || ipad) { o = { webkit: t @@ -68,41 +68,41 @@ , ios: t , iphone: iphone , ipad: ipad - } + }; // WTF: version is not part of user agent in web apps if (webkitVersion.test(ua)) { - o.version = ua.match(webkitVersion)[1] + o.version = ua.match(webkitVersion)[1]; } - return o + return o; } if (android) return { webkit: t , android: t , mobile: t , version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1] - } + }; if (safari) return { webkit: t , safari: t , version: ua.match(webkitVersion)[1] - } + }; if (gecko) { o = { gecko: t , mozilla: t , version: ua.match(firefoxVersion)[1] - } - if (firefox) o.firefox = t - return o + }; + if (firefox) o.firefox = t; + return o; } if (seamonkey) return { seamonkey: t , version: ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1] - } - return {} + }; + return {}; } - var bowser = detect() + var bowser = detect(); // Graded Browser Support // http://developer.yahoo.com/yui/articles/gbs @@ -119,8 +119,8 @@ (bowser.firefox && bowser.version < 4.0) || (bowser.safari && bowser.version < 5) || (bowser.opera && bowser.version < 10.0)) { - bowser.c = t - } else bowser.x = t + bowser.c = t; + } else bowser.x = t; - return bowser -}) + return bowser; +}); \ No newline at end of file