This commit is contained in:
Faisal Salman 2012-12-23 06:45:59 +07:00
parent 4703137b79
commit a6610646ca
4 changed files with 18 additions and 9 deletions

View File

@ -1,7 +1,7 @@
{
"title": "UA-Parser.JS",
"name": "ua-parser-js",
"version": "0.4.18",
"version": "0.5.0",
"author": "Faisal Salman <fyzlman@gmail.com> (http://faisalman.com)",
"description": "Lightweight JavaScript-based user-agent string parser",
"keywords": [

17
test.js
View File

@ -1122,12 +1122,21 @@ var os = [
}
},
{
desc : 'iOS',
ua : '',
desc : 'iOS with Chrome',
ua : 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3',
expect :
{
name : '',
version : ''
name : 'iOS',
version : '5.1.1'
}
},
{
desc : 'iOS with Opera Mini',
ua : 'Opera/9.80 (iPhone; Opera Mini/7.1.32694/27.1407; U; en) Presto/2.8.119 Version/11.10',
expect :
{
name : 'iOS',
version : undefined
}
},
{

View File

@ -1,4 +1,4 @@
// UA-Parser.JS v0.4.18
// UA-Parser.JS v0.5.0
// Lightweight JavaScript-based User-Agent string parser
// https://github.com/faisalman/ua-parser-js
//
@ -329,7 +329,7 @@
/\s(\w*bsd|dragonfly)\s?([\w\.]+)*/i, // FreeBSD/NetBSD/OpenBSD/DragonFly
], [NAME, VERSION],[
/(ip[honead]+).*os\s*([\w]+)*\slike\smac/i // iOS
/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i, // iOS
], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [
/(mac\sos\sx)\s?([\w\s\.]+\w)*/i, // Mac OS

4
ua-parser.min.js vendored

File diff suppressed because one or more lines are too long