mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
Add osname to result
This commit is contained in:
parent
3ce77e9ed4
commit
f980192ef3
@ -130,6 +130,7 @@
|
||||
else if (windowsphone) {
|
||||
result = {
|
||||
name: 'Windows Phone'
|
||||
, osname: 'Windows Phone'
|
||||
, windowsphone: t
|
||||
}
|
||||
if (edgeVersion) {
|
||||
@ -150,6 +151,7 @@
|
||||
} else if (chromeos) {
|
||||
result = {
|
||||
name: 'Chrome'
|
||||
, osname: 'Chrome OS'
|
||||
, chromeos: t
|
||||
, chromeBook: t
|
||||
, chrome: t
|
||||
@ -172,6 +174,7 @@
|
||||
else if (sailfish) {
|
||||
result = {
|
||||
name: 'Sailfish'
|
||||
, osname: 'Sailfish OS'
|
||||
, sailfish: t
|
||||
, version: getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i)
|
||||
}
|
||||
@ -191,6 +194,7 @@
|
||||
}
|
||||
if (/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(ua)) {
|
||||
result.firefoxos = t
|
||||
result.osname = 'Firefox OS'
|
||||
}
|
||||
}
|
||||
else if (silk) {
|
||||
@ -217,6 +221,7 @@
|
||||
else if (/blackberry|\bbb\d+/i.test(ua) || /rim\stablet/i.test(ua)) {
|
||||
result = {
|
||||
name: 'BlackBerry'
|
||||
, osname: 'BlackBerry OS'
|
||||
, blackberry: t
|
||||
, version: versionIdentifier || getFirstMatch(/blackberry[\d]+\/(\d+(\.\d+)?)/i)
|
||||
}
|
||||
@ -224,6 +229,7 @@
|
||||
else if (webos) {
|
||||
result = {
|
||||
name: 'WebOS'
|
||||
, osname: 'WebOS'
|
||||
, webos: t
|
||||
, version: versionIdentifier || getFirstMatch(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)
|
||||
};
|
||||
@ -232,6 +238,7 @@
|
||||
else if (/bada/i.test(ua)) {
|
||||
result = {
|
||||
name: 'Bada'
|
||||
, osname: 'Bada'
|
||||
, bada: t
|
||||
, version: getFirstMatch(/dolfin\/(\d+(\.\d+)?)/i)
|
||||
};
|
||||
@ -239,6 +246,7 @@
|
||||
else if (tizen) {
|
||||
result = {
|
||||
name: 'Tizen'
|
||||
, osname: 'Tizen'
|
||||
, tizen: t
|
||||
, version: getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i) || versionIdentifier
|
||||
};
|
||||
@ -323,17 +331,23 @@
|
||||
// set OS flags for platforms that have multiple browsers
|
||||
if (!result.windowsphone && !result.msedge && (android || result.silk)) {
|
||||
result.android = t
|
||||
result.osname = 'Android'
|
||||
} else if (!result.windowsphone && !result.msedge && iosdevice) {
|
||||
result[iosdevice] = t
|
||||
result.ios = t
|
||||
result.osname = 'iOS'
|
||||
} else if (mac) {
|
||||
result.mac = t
|
||||
result.osname = 'macOS'
|
||||
} else if (xbox) {
|
||||
result.xbox = t
|
||||
result.osname = 'Xbox'
|
||||
} else if (windows) {
|
||||
result.windows = t
|
||||
result.osname = 'Windows'
|
||||
} else if (linux) {
|
||||
result.linux = t
|
||||
result.osname = 'Linux'
|
||||
}
|
||||
|
||||
function getWindowsVersion (s) {
|
||||
|
Loading…
Reference in New Issue
Block a user