update parseUserAgent
This commit is contained in:
parent
61f9496f34
commit
aed581b33e
1 changed files with 15 additions and 10 deletions
|
@ -263,6 +263,7 @@ Ox.parseUserAgent = function(userAgent) {
|
||||||
'MSIE': 'Internet Explorer'
|
'MSIE': 'Internet Explorer'
|
||||||
},
|
},
|
||||||
system: {
|
system: {
|
||||||
|
'CPU OS': 'iOS',
|
||||||
'iPhone OS': 'iOS',
|
'iPhone OS': 'iOS',
|
||||||
'Macintosh': 'Mac OS X'
|
'Macintosh': 'Mac OS X'
|
||||||
}
|
}
|
||||||
|
@ -290,8 +291,10 @@ Ox.parseUserAgent = function(userAgent) {
|
||||||
/(BlackBerry) (\d+)/,
|
/(BlackBerry) (\d+)/,
|
||||||
/(Darwin)/,
|
/(Darwin)/,
|
||||||
/(BSD) (FreeBSD|NetBSD|OpenBSD)/,
|
/(BSD) (FreeBSD|NetBSD|OpenBSD)/,
|
||||||
|
/(CPU OS) (\d+)/,
|
||||||
/(iPhone OS) (\d+)/,
|
/(iPhone OS) (\d+)/,
|
||||||
/(Linux).+(CentOS|CrOS|Debian|Fedora|Gentoo|Mandriva|MeeGo|Mint|Red Hat|SUSE|Ubuntu|webOS)/,
|
/(Linux).+(CentOS|CrOS|Debian|Fedora|Gentoo|Mandriva|MeeGo|Mint|Red Hat|SUSE|Ubuntu|webOS)/,
|
||||||
|
/(CentOS|CrOS|Debian|Fedora|Gentoo|Mandriva|MeeGo|Mint|Red Hat|SUSE|Ubuntu|webOS).+(Linux)/,
|
||||||
/(Linux)/,
|
/(Linux)/,
|
||||||
/(Mac OS X) (10.\d)/,
|
/(Mac OS X) (10.\d)/,
|
||||||
/(Mac OS X)/,
|
/(Mac OS X)/,
|
||||||
|
@ -311,12 +314,15 @@ Ox.parseUserAgent = function(userAgent) {
|
||||||
versions = {
|
versions = {
|
||||||
browser: {},
|
browser: {},
|
||||||
system: {
|
system: {
|
||||||
|
'10.0': '10.0 (Cheetah)',
|
||||||
|
'10.1': '10.1 (Puma)',
|
||||||
'10.2': '10.2 (Jaguar)',
|
'10.2': '10.2 (Jaguar)',
|
||||||
'10.3': '10.3 (Panther)',
|
'10.3': '10.3 (Panther)',
|
||||||
'10.4': '10.4 (Tiger)',
|
'10.4': '10.4 (Tiger)',
|
||||||
'10.5': '10.5 (Leopard)',
|
'10.5': '10.5 (Leopard)',
|
||||||
'10.6': '10.6 (Snow Leopard)',
|
'10.6': '10.6 (Snow Leopard)',
|
||||||
'10.7': '10.7 (Lion)',
|
'10.7': '10.7 (Lion)',
|
||||||
|
'10.8': '10.8 (Mountain Lion)',
|
||||||
'CrOS': 'Chrome OS',
|
'CrOS': 'Chrome OS',
|
||||||
'NT 4.0': 'NT 4.0 (Windows NT)',
|
'NT 4.0': 'NT 4.0 (Windows NT)',
|
||||||
'NT 4.1': 'NT 4.1 (Windows 98)',
|
'NT 4.1': 'NT 4.1 (Windows 98)',
|
||||||
|
@ -352,20 +358,19 @@ Ox.parseUserAgent = function(userAgent) {
|
||||||
name, string, swap, version;
|
name, string, swap, version;
|
||||||
if (matches) {
|
if (matches) {
|
||||||
matches[2] = matches[2] || '';
|
matches[2] = matches[2] || '';
|
||||||
swap = matches[1].match(/^\d+$/);
|
swap = matches[1].match(/^\d/) || matches[2] == 'Linux';
|
||||||
name = matches[swap ? 2 : 1];
|
name = matches[swap ? 2 : 1];
|
||||||
version = matches[swap ? 1 : 2].replace('_', '.');
|
version = matches[swap ? 1 : 2].replace('_', '.');
|
||||||
name = names[key][name] || name,
|
name = names[key][name] || name,
|
||||||
version = versions[key][version] || version;
|
version = versions[key][version] || version;
|
||||||
string = name + (
|
string = name;
|
||||||
version
|
if (version) {
|
||||||
? ' ' + (
|
string += ' ' + (
|
||||||
['BSD', 'Linux', 'Unix'].indexOf(name) > -1
|
['BSD', 'Linux', 'Unix'].indexOf(name) > -1
|
||||||
? '(' + version + ')'
|
? '(' + version + ')'
|
||||||
: version
|
: version
|
||||||
)
|
)
|
||||||
: ''
|
}
|
||||||
);
|
|
||||||
userAgentData[key] = {
|
userAgentData[key] = {
|
||||||
name: names[name] || name,
|
name: names[name] || name,
|
||||||
string: string,
|
string: string,
|
||||||
|
|
Loading…
Reference in a new issue