mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Merge branch 'release/1.8.0' into production
This commit is contained in:
commit
1df2712eb6
@ -1,5 +1,8 @@
|
|||||||
# Bowser Changelog
|
# Bowser Changelog
|
||||||
|
|
||||||
|
### 1.8.0 (October 7, 2017)
|
||||||
|
- [ADD] Add `osname` into result object (#200)
|
||||||
|
|
||||||
### 1.7.3 (August 30, 2017)
|
### 1.7.3 (August 30, 2017)
|
||||||
- [FIX] Fix detection of Chrome on Android 8 OPR6 (#193)
|
- [FIX] Fix detection of Chrome on Android 8 OPR6 (#193)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
## Bowser
|
## Bowser
|
||||||
A Browser detector. Because sometimes, there is no other way, and not even good modern browsers always provide good feature detection mechanisms.
|
A Browser detector. Because sometimes, there is no other way, and not even good modern browsers always provide good feature detection mechanisms.
|
||||||
|
|
||||||
[![bowser ci](https://secure.travis-ci.org/ded/bowser.png)](https://travis-ci.org/ded/bowser/)
|
[![Build Status](https://travis-ci.org/lancedikson/bowser.svg?branch=master)](https://travis-ci.org/lancedikson/bowser)
|
||||||
|
|
||||||
So... it works like this:
|
So... it works like this:
|
||||||
|
|
||||||
@ -153,8 +153,9 @@ If detected, one of these flags may be set to true:
|
|||||||
* `tizen`
|
* `tizen`
|
||||||
* `sailfish`
|
* `sailfish`
|
||||||
|
|
||||||
`osversion` may also be set:
|
`osname` and `osversion` may also be set:
|
||||||
|
|
||||||
|
* `osname` - for the OS flags detected above: macOS, Windows, Windows Phone, Linux, Chrome OS, Android, iOS, Blackberry OS, Firefox OS, WebOS, Bada, Tizen, Sailfish OS, and Xbox
|
||||||
* `osversion` - for Android, iOS, MacOS, Windows, Windows Phone, WebOS, Bada, and Tizen. If included in UA string.
|
* `osversion` - for Android, iOS, MacOS, Windows, Windows Phone, WebOS, Bada, and Tizen. If included in UA string.
|
||||||
|
|
||||||
iOS is always reported as `ios` and additionally as `iphone`/`ipad`/`ipod`, whichever one matches best.
|
iOS is always reported as `ios` and additionally as `iphone`/`ipad`/`ipod`, whichever one matches best.
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
"ender",
|
"ender",
|
||||||
"sniff"
|
"sniff"
|
||||||
],
|
],
|
||||||
"version": "1.7.3",
|
"version": "1.8.0",
|
||||||
"homepage": "https://github.com/lancedikson/bowser",
|
"homepage": "https://github.com/lancedikson/bowser",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
"src/bowser.js"
|
"src/bowser.js"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "bowser",
|
"name": "bowser",
|
||||||
"version": "1.7.3",
|
"version": "1.8.0",
|
||||||
"description": "Lightweight browser detector",
|
"description": "Lightweight browser detector",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"browser",
|
"browser",
|
||||||
|
@ -130,6 +130,7 @@
|
|||||||
else if (windowsphone) {
|
else if (windowsphone) {
|
||||||
result = {
|
result = {
|
||||||
name: 'Windows Phone'
|
name: 'Windows Phone'
|
||||||
|
, osname: 'Windows Phone'
|
||||||
, windowsphone: t
|
, windowsphone: t
|
||||||
}
|
}
|
||||||
if (edgeVersion) {
|
if (edgeVersion) {
|
||||||
@ -150,6 +151,7 @@
|
|||||||
} else if (chromeos) {
|
} else if (chromeos) {
|
||||||
result = {
|
result = {
|
||||||
name: 'Chrome'
|
name: 'Chrome'
|
||||||
|
, osname: 'Chrome OS'
|
||||||
, chromeos: t
|
, chromeos: t
|
||||||
, chromeBook: t
|
, chromeBook: t
|
||||||
, chrome: t
|
, chrome: t
|
||||||
@ -172,6 +174,7 @@
|
|||||||
else if (sailfish) {
|
else if (sailfish) {
|
||||||
result = {
|
result = {
|
||||||
name: 'Sailfish'
|
name: 'Sailfish'
|
||||||
|
, osname: 'Sailfish OS'
|
||||||
, sailfish: t
|
, sailfish: t
|
||||||
, version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i)
|
, version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i)
|
||||||
}
|
}
|
||||||
@ -191,6 +194,7 @@
|
|||||||
}
|
}
|
||||||
if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
|
if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
|
||||||
result.firefoxos = t
|
result.firefoxos = t
|
||||||
|
result.osname = 'Firefox OS'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (silk) {
|
else if (silk) {
|
||||||
@ -217,6 +221,7 @@
|
|||||||
else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) {
|
else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) {
|
||||||
result = {
|
result = {
|
||||||
name: 'BlackBerry'
|
name: 'BlackBerry'
|
||||||
|
, osname: 'BlackBerry OS'
|
||||||
, blackberry: t
|
, blackberry: t
|
||||||
, version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i)
|
, version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i)
|
||||||
}
|
}
|
||||||
@ -224,6 +229,7 @@
|
|||||||
else if (webos) {
|
else if (webos) {
|
||||||
result = {
|
result = {
|
||||||
name: 'WebOS'
|
name: 'WebOS'
|
||||||
|
, osname: 'WebOS'
|
||||||
, webos: t
|
, webos: t
|
||||||
, version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)
|
, version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)
|
||||||
};
|
};
|
||||||
@ -232,6 +238,7 @@
|
|||||||
else if (/bada/i.test(ua)) {
|
else if (/bada/i.test(ua)) {
|
||||||
result = {
|
result = {
|
||||||
name: 'Bada'
|
name: 'Bada'
|
||||||
|
, osname: 'Bada'
|
||||||
, bada: t
|
, bada: t
|
||||||
, version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i)
|
, version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i)
|
||||||
};
|
};
|
||||||
@ -239,6 +246,7 @@
|
|||||||
else if (tizen) {
|
else if (tizen) {
|
||||||
result = {
|
result = {
|
||||||
name: 'Tizen'
|
name: 'Tizen'
|
||||||
|
, osname: 'Tizen'
|
||||||
, tizen: t
|
, tizen: t
|
||||||
, version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier
|
, version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier
|
||||||
};
|
};
|
||||||
@ -323,17 +331,23 @@
|
|||||||
// set OS flags for platforms that have multiple browsers
|
// set OS flags for platforms that have multiple browsers
|
||||||
if (!result.windowsphone && !result.msedge && (android || result.silk)) {
|
if (!result.windowsphone && !result.msedge && (android || result.silk)) {
|
||||||
result.android = t
|
result.android = t
|
||||||
|
result.osname = 'Android'
|
||||||
} else if (!result.windowsphone && !result.msedge && iosdevice) {
|
} else if (!result.windowsphone && !result.msedge && iosdevice) {
|
||||||
result[iosdevice] = t
|
result[iosdevice] = t
|
||||||
result.ios = t
|
result.ios = t
|
||||||
|
result.osname = 'iOS'
|
||||||
} else if (mac) {
|
} else if (mac) {
|
||||||
result.mac = t
|
result.mac = t
|
||||||
|
result.osname = 'macOS'
|
||||||
} else if (xbox) {
|
} else if (xbox) {
|
||||||
result.xbox = t
|
result.xbox = t
|
||||||
|
result.osname = 'Xbox'
|
||||||
} else if (windows) {
|
} else if (windows) {
|
||||||
result.windows = t
|
result.windows = t
|
||||||
|
result.osname = 'Windows'
|
||||||
} else if (linux) {
|
} else if (linux) {
|
||||||
result.linux = t
|
result.linux = t
|
||||||
|
result.osname = 'Linux'
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWindowsVersion (s) {
|
function getWindowsVersion (s) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -117,6 +117,11 @@ describe('Unsupported browser check', function() {
|
|||||||
assert.equal(unsupported, false);
|
assert.equal(unsupported, false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should NOT be passed by #isUnsupportedBrowser for IE10.6 and for IE10 miminal version specified in strict mode', function() {
|
||||||
|
var isUnsupported = browser.isUnsupportedBrowser({msie: "11"}, true, this.ie10_6);
|
||||||
|
assert.equal(isUnsupported, true);
|
||||||
|
});
|
||||||
|
|
||||||
it('should NOT be passed by #check for IE10.6 and for IE11 miminal version specified', function() {
|
it('should NOT be passed by #check for IE10.6 and for IE11 miminal version specified', function() {
|
||||||
var supported = browser.check({msie: "11"}, this.ie10_6);
|
var supported = browser.check({msie: "11"}, this.ie10_6);
|
||||||
assert.equal(supported, false);
|
assert.equal(supported, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user