mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Add braces for better minification and semicolons to improve readability.
This commit is contained in:
parent
20826d1ea5
commit
90ad912e8d
82
bowser.js
82
bowser.js
@ -5,9 +5,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
!function (name, definition) {
|
!function (name, definition) {
|
||||||
if (typeof define == 'function') define(definition)
|
if (typeof define === 'function') {
|
||||||
else if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition()
|
define(definition);
|
||||||
else this[name] = definition()
|
} else if (typeof module !== 'undefined' && module.exports) {
|
||||||
|
module.exports[name] = definition();
|
||||||
|
} else {
|
||||||
|
this[name] = definition();
|
||||||
|
}
|
||||||
}('bowser', function () {
|
}('bowser', function () {
|
||||||
/**
|
/**
|
||||||
* navigator.userAgent =>
|
* navigator.userAgent =>
|
||||||
@ -40,72 +44,80 @@
|
|||||||
, seamonkey = /seamonkey\//i.test(ua)
|
, seamonkey = /seamonkey\//i.test(ua)
|
||||||
, webkitVersion = /version\/(\d+(\.\d+)?)/i
|
, webkitVersion = /version\/(\d+(\.\d+)?)/i
|
||||||
, firefoxVersion = /firefox\/(\d+(\.\d+)?)/i
|
, firefoxVersion = /firefox\/(\d+(\.\d+)?)/i
|
||||||
, o
|
, o;
|
||||||
|
|
||||||
function detect() {
|
function detect() {
|
||||||
|
|
||||||
if (ie) return {
|
if (ie) {
|
||||||
|
return {
|
||||||
msie: t
|
msie: t
|
||||||
, version: ua.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]
|
, version: ua.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]
|
||||||
}
|
};
|
||||||
if (opera) return {
|
} else if (opera) {
|
||||||
|
return {
|
||||||
opera: t
|
opera: t
|
||||||
, version: ua.match(webkitVersion) ? ua.match(webkitVersion)[1] : ua.match(/opr\/(\d+(\.\d+)?)/i)
|
, version: ua.match(webkitVersion) ? ua.match(webkitVersion)[1] : ua.match(/opr\/(\d+(\.\d+)?)/i)
|
||||||
}
|
};
|
||||||
if (chrome) return {
|
} else if (chrome) {
|
||||||
|
return {
|
||||||
webkit: t
|
webkit: t
|
||||||
, chrome: t
|
, chrome: t
|
||||||
, version: ua.match(/chrome\/(\d+(\.\d+)?)/i)[1]
|
, version: ua.match(/chrome\/(\d+(\.\d+)?)/i)[1]
|
||||||
}
|
};
|
||||||
if (phantom) return {
|
} else if (phantom) {
|
||||||
|
return {
|
||||||
webkit: t
|
webkit: t
|
||||||
, phantom: t
|
, phantom: t
|
||||||
, version: ua.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]
|
, version: ua.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]
|
||||||
}
|
};
|
||||||
if (touchpad) return {
|
} else if (touchpad) {
|
||||||
|
return {
|
||||||
webkit: t
|
webkit: t
|
||||||
, touchpad: t
|
, touchpad: t
|
||||||
, version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1]
|
, version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1]
|
||||||
}
|
};
|
||||||
if (iphone || ipad) {
|
} else if (iphone || ipad) {
|
||||||
o = {
|
o = {
|
||||||
webkit: t
|
webkit: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
, ios: t
|
, ios: t
|
||||||
, iphone: iphone
|
, iphone: iphone
|
||||||
, ipad: ipad
|
, ipad: ipad
|
||||||
}
|
};
|
||||||
// WTF: version is not part of user agent in web apps
|
// WTF: version is not part of user agent in web apps
|
||||||
if (webkitVersion.test(ua)) {
|
if (webkitVersion.test(ua)) {
|
||||||
o.version = ua.match(webkitVersion)[1]
|
o.version = ua.match(webkitVersion)[1];
|
||||||
}
|
}
|
||||||
return o
|
return o;
|
||||||
}
|
} else if (android) {
|
||||||
if (android) return {
|
return {
|
||||||
webkit: t
|
webkit: t
|
||||||
, android: t
|
, android: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
, version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1]
|
, version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1]
|
||||||
}
|
};
|
||||||
if (safari) return {
|
} else if (safari) {
|
||||||
|
return {
|
||||||
webkit: t
|
webkit: t
|
||||||
, safari: t
|
, safari: t
|
||||||
, version: ua.match(webkitVersion)[1]
|
, version: ua.match(webkitVersion)[1]
|
||||||
}
|
};
|
||||||
if (gecko) {
|
} else if (gecko) {
|
||||||
o = {
|
o = {
|
||||||
gecko: t
|
gecko: t
|
||||||
, mozilla: t
|
, mozilla: t
|
||||||
, version: ua.match(firefoxVersion)[1]
|
, version: ua.match(firefoxVersion)[1]
|
||||||
}
|
};
|
||||||
if (firefox) o.firefox = t
|
if (firefox) o.firefox = t;
|
||||||
return o
|
return o;
|
||||||
}
|
} else if (seamonkey) {
|
||||||
if (seamonkey) return {
|
return {
|
||||||
seamonkey: t
|
seamonkey: t
|
||||||
, version: ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
|
, version: ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
|
||||||
}
|
};
|
||||||
return {}
|
} else {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var bowser = detect()
|
var bowser = detect()
|
||||||
@ -125,8 +137,10 @@
|
|||||||
(bowser.firefox && bowser.version < 4.0) ||
|
(bowser.firefox && bowser.version < 4.0) ||
|
||||||
(bowser.safari && bowser.version < 5) ||
|
(bowser.safari && bowser.version < 5) ||
|
||||||
(bowser.opera && bowser.version < 10.0)) {
|
(bowser.opera && bowser.version < 10.0)) {
|
||||||
bowser.c = t
|
bowser.c = t;
|
||||||
} else bowser.x = t
|
} else {
|
||||||
|
bowser.x = t;
|
||||||
|
}
|
||||||
|
|
||||||
return bowser
|
return bowser;
|
||||||
})
|
})
|
||||||
|
2
bowser.min.js
vendored
2
bowser.min.js
vendored
@ -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?{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})
|
!function(e,t){typeof define=="function"?define(t):typeof module!="undefined"&&module.exports?module.exports[e]=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})
|
@ -1,7 +1,11 @@
|
|||||||
!function (name, definition) {
|
!function (name, definition) {
|
||||||
if (typeof define == 'function') define(definition)
|
if (typeof define === 'function') {
|
||||||
else if (typeof module != 'undefined' && module.exports) module.exports['browser'] = definition()
|
define(definition);
|
||||||
else this[name] = definition()
|
} else if (typeof module !== 'undefined' && module.exports) {
|
||||||
|
module.exports[name] = definition();
|
||||||
|
} else {
|
||||||
|
this[name] = definition();
|
||||||
|
}
|
||||||
}('bowser', function () {
|
}('bowser', function () {
|
||||||
/**
|
/**
|
||||||
* navigator.userAgent =>
|
* navigator.userAgent =>
|
||||||
@ -34,72 +38,80 @@
|
|||||||
, seamonkey = /seamonkey\//i.test(ua)
|
, seamonkey = /seamonkey\//i.test(ua)
|
||||||
, webkitVersion = /version\/(\d+(\.\d+)?)/i
|
, webkitVersion = /version\/(\d+(\.\d+)?)/i
|
||||||
, firefoxVersion = /firefox\/(\d+(\.\d+)?)/i
|
, firefoxVersion = /firefox\/(\d+(\.\d+)?)/i
|
||||||
, o
|
, o;
|
||||||
|
|
||||||
function detect() {
|
function detect() {
|
||||||
|
|
||||||
if (ie) return {
|
if (ie) {
|
||||||
|
return {
|
||||||
msie: t
|
msie: t
|
||||||
, version: ua.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]
|
, version: ua.match(/(msie |rv:)(\d+(\.\d+)?)/i)[2]
|
||||||
}
|
};
|
||||||
if (opera) return {
|
} else if (opera) {
|
||||||
|
return {
|
||||||
opera: t
|
opera: t
|
||||||
, version: ua.match(webkitVersion) ? ua.match(webkitVersion)[1] : ua.match(/opr\/(\d+(\.\d+)?)/i)
|
, version: ua.match(webkitVersion) ? ua.match(webkitVersion)[1] : ua.match(/opr\/(\d+(\.\d+)?)/i)
|
||||||
}
|
};
|
||||||
if (chrome) return {
|
} else if (chrome) {
|
||||||
|
return {
|
||||||
webkit: t
|
webkit: t
|
||||||
, chrome: t
|
, chrome: t
|
||||||
, version: ua.match(/chrome\/(\d+(\.\d+)?)/i)[1]
|
, version: ua.match(/chrome\/(\d+(\.\d+)?)/i)[1]
|
||||||
}
|
};
|
||||||
if (phantom) return {
|
} else if (phantom) {
|
||||||
|
return {
|
||||||
webkit: t
|
webkit: t
|
||||||
, phantom: t
|
, phantom: t
|
||||||
, version: ua.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]
|
, version: ua.match(/phantomjs\/(\d+(\.\d+)+)/i)[1]
|
||||||
}
|
};
|
||||||
if (touchpad) return {
|
} else if (touchpad) {
|
||||||
|
return {
|
||||||
webkit: t
|
webkit: t
|
||||||
, touchpad: t
|
, touchpad: t
|
||||||
, version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1]
|
, version : ua.match(/touchpad\/(\d+(\.\d+)?)/i)[1]
|
||||||
}
|
};
|
||||||
if (iphone || ipad) {
|
} else if (iphone || ipad) {
|
||||||
o = {
|
o = {
|
||||||
webkit: t
|
webkit: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
, ios: t
|
, ios: t
|
||||||
, iphone: iphone
|
, iphone: iphone
|
||||||
, ipad: ipad
|
, ipad: ipad
|
||||||
}
|
};
|
||||||
// WTF: version is not part of user agent in web apps
|
// WTF: version is not part of user agent in web apps
|
||||||
if (webkitVersion.test(ua)) {
|
if (webkitVersion.test(ua)) {
|
||||||
o.version = ua.match(webkitVersion)[1]
|
o.version = ua.match(webkitVersion)[1];
|
||||||
}
|
}
|
||||||
return o
|
return o;
|
||||||
}
|
} else if (android) {
|
||||||
if (android) return {
|
return {
|
||||||
webkit: t
|
webkit: t
|
||||||
, android: t
|
, android: t
|
||||||
, mobile: t
|
, mobile: t
|
||||||
, version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1]
|
, version: (ua.match(webkitVersion) || ua.match(firefoxVersion))[1]
|
||||||
}
|
};
|
||||||
if (safari) return {
|
} else if (safari) {
|
||||||
|
return {
|
||||||
webkit: t
|
webkit: t
|
||||||
, safari: t
|
, safari: t
|
||||||
, version: ua.match(webkitVersion)[1]
|
, version: ua.match(webkitVersion)[1]
|
||||||
}
|
};
|
||||||
if (gecko) {
|
} else if (gecko) {
|
||||||
o = {
|
o = {
|
||||||
gecko: t
|
gecko: t
|
||||||
, mozilla: t
|
, mozilla: t
|
||||||
, version: ua.match(firefoxVersion)[1]
|
, version: ua.match(firefoxVersion)[1]
|
||||||
}
|
};
|
||||||
if (firefox) o.firefox = t
|
if (firefox) o.firefox = t;
|
||||||
return o
|
return o;
|
||||||
}
|
} else if (seamonkey) {
|
||||||
if (seamonkey) return {
|
return {
|
||||||
seamonkey: t
|
seamonkey: t
|
||||||
, version: ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
|
, version: ua.match(/seamonkey\/(\d+(\.\d+)?)/i)[1]
|
||||||
}
|
};
|
||||||
return {}
|
} else {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var bowser = detect()
|
var bowser = detect()
|
||||||
@ -119,8 +131,10 @@
|
|||||||
(bowser.firefox && bowser.version < 4.0) ||
|
(bowser.firefox && bowser.version < 4.0) ||
|
||||||
(bowser.safari && bowser.version < 5) ||
|
(bowser.safari && bowser.version < 5) ||
|
||||||
(bowser.opera && bowser.version < 10.0)) {
|
(bowser.opera && bowser.version < 10.0)) {
|
||||||
bowser.c = t
|
bowser.c = t;
|
||||||
} else bowser.x = t
|
} else {
|
||||||
|
bowser.x = t;
|
||||||
|
}
|
||||||
|
|
||||||
return bowser
|
return bowser;
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user