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'
|
||||
},
|
||||
system: {
|
||||
'CPU OS': 'iOS',
|
||||
'iPhone OS': 'iOS',
|
||||
'Macintosh': 'Mac OS X'
|
||||
}
|
||||
|
@ -290,8 +291,10 @@ Ox.parseUserAgent = function(userAgent) {
|
|||
/(BlackBerry) (\d+)/,
|
||||
/(Darwin)/,
|
||||
/(BSD) (FreeBSD|NetBSD|OpenBSD)/,
|
||||
/(CPU OS) (\d+)/,
|
||||
/(iPhone OS) (\d+)/,
|
||||
/(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)/,
|
||||
/(Mac OS X) (10.\d)/,
|
||||
/(Mac OS X)/,
|
||||
|
@ -311,12 +314,15 @@ Ox.parseUserAgent = function(userAgent) {
|
|||
versions = {
|
||||
browser: {},
|
||||
system: {
|
||||
'10.0': '10.0 (Cheetah)',
|
||||
'10.1': '10.1 (Puma)',
|
||||
'10.2': '10.2 (Jaguar)',
|
||||
'10.3': '10.3 (Panther)',
|
||||
'10.4': '10.4 (Tiger)',
|
||||
'10.5': '10.5 (Leopard)',
|
||||
'10.6': '10.6 (Snow Leopard)',
|
||||
'10.7': '10.7 (Lion)',
|
||||
'10.8': '10.8 (Mountain Lion)',
|
||||
'CrOS': 'Chrome OS',
|
||||
'NT 4.0': 'NT 4.0 (Windows NT)',
|
||||
'NT 4.1': 'NT 4.1 (Windows 98)',
|
||||
|
@ -352,20 +358,19 @@ Ox.parseUserAgent = function(userAgent) {
|
|||
name, string, swap, version;
|
||||
if (matches) {
|
||||
matches[2] = matches[2] || '';
|
||||
swap = matches[1].match(/^\d+$/);
|
||||
swap = matches[1].match(/^\d/) || matches[2] == 'Linux';
|
||||
name = matches[swap ? 2 : 1];
|
||||
version = matches[swap ? 1 : 2].replace('_', '.');
|
||||
name = names[key][name] || name,
|
||||
version = versions[key][version] || version;
|
||||
string = name + (
|
||||
version
|
||||
? ' ' + (
|
||||
['BSD', 'Linux', 'Unix'].indexOf(name) > -1
|
||||
? '(' + version + ')'
|
||||
: version
|
||||
)
|
||||
: ''
|
||||
);
|
||||
string = name;
|
||||
if (version) {
|
||||
string += ' ' + (
|
||||
['BSD', 'Linux', 'Unix'].indexOf(name) > -1
|
||||
? '(' + version + ')'
|
||||
: version
|
||||
)
|
||||
}
|
||||
userAgentData[key] = {
|
||||
name: names[name] || name,
|
||||
string: string,
|
||||
|
|
Loading…
Reference in a new issue