mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-11-21 01:26:40 +03:00
Compare commits
58 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a21b0f2294 | ||
|
|
66bb3bd874 | ||
|
|
82e704cb0e | ||
|
|
6e8d5a8b67 | ||
|
|
489a28288f | ||
|
|
354d6306ad | ||
|
|
cc5a30d162 | ||
|
|
40a8f6ec20 | ||
|
|
28429c6a36 | ||
|
|
2dedba8b4a | ||
|
|
3edce404fe | ||
|
|
baf4bb99b4 | ||
|
|
fab1fd2ec6 | ||
|
|
a6211ca98c | ||
|
|
676844156f | ||
|
|
7da36bad0b | ||
|
|
1261dca937 | ||
|
|
a23ae902b8 | ||
|
|
3fa1fe9f70 | ||
|
|
0fbf55227d | ||
|
|
7234216e02 | ||
|
|
6dc04cdea2 | ||
|
|
c4b6742ea0 | ||
|
|
7c1397cdcc | ||
|
|
1b3fdf173a | ||
|
|
3901fbe532 | ||
|
|
2dec1a8b76 | ||
|
|
4d28bee555 | ||
|
|
c177aa5e9e | ||
|
|
3796968cfe | ||
|
|
ea36010827 | ||
|
|
f57577e417 | ||
|
|
230ef846fa | ||
|
|
494175854f | ||
|
|
80d6d137ba | ||
|
|
19b5ddd038 | ||
|
|
9133d73d50 | ||
|
|
3699c70a3a | ||
|
|
e6d276032b | ||
|
|
b68caafd94 | ||
|
|
eed632e3dd | ||
|
|
c5ce73f7de | ||
|
|
2c9c721a5c | ||
|
|
ec50c619ea | ||
|
|
07a7956eda | ||
|
|
be0eec6716 | ||
|
|
8d439d26b8 | ||
|
|
dc20c12b63 | ||
|
|
ecf8f7a849 | ||
|
|
3bf60cc830 | ||
|
|
8c94018351 | ||
|
|
9098ad501f | ||
|
|
376541a383 | ||
|
|
9cad6a0f2d | ||
|
|
84a8eedad4 | ||
|
|
30e1e7a98f | ||
|
|
c1df106dca | ||
|
|
edcd5402a6 |
24
.gitignore
vendored
24
.gitignore
vendored
@@ -1,2 +1,26 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
<<<<<<< HEAD
|
||||||
|
### vim ###
|
||||||
|
.*.s[a-w][a-z]
|
||||||
|
*.un~
|
||||||
|
Session.vim
|
||||||
|
.netrwhist
|
||||||
|
*~
|
||||||
|
|
||||||
|
### OSX ###
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
Icon
|
||||||
|
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear on external disk
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
=======
|
||||||
|
.idea
|
||||||
|
>>>>>>> baf4bb99b4ef92c71419931e8fd334e34c051e52
|
||||||
|
|||||||
39
bower.json
Normal file
39
bower.json
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"name": "ua-parser-js",
|
||||||
|
"version": "0.7.0",
|
||||||
|
"authors": [
|
||||||
|
"Faisal Salman <fyzlman@gmail.com>"
|
||||||
|
],
|
||||||
|
"private": false,
|
||||||
|
"main": "src/ua-parser.js",
|
||||||
|
"ignore": [
|
||||||
|
"build",
|
||||||
|
"node_modules",
|
||||||
|
"bower_components",
|
||||||
|
"test",
|
||||||
|
"tests"
|
||||||
|
],
|
||||||
|
"contributors": [
|
||||||
|
"Faisal Salman <fyzlman@gmail.com>",
|
||||||
|
"Benjamin Bertrand <bertrand.design@gmail.com>",
|
||||||
|
"Christopher De Cairos <chris.decairos@gmail.com>",
|
||||||
|
"Davit Barbakadze <jayarjo@gmail.com>",
|
||||||
|
"Dmitry Tyschenko <dtyschenko@gmail.com>",
|
||||||
|
"Douglas Li <doug@knotch.it>",
|
||||||
|
"Erik Hesselink <hesselink@gmail.com>",
|
||||||
|
"Fabian Becker <halfdan@xnorfz.de>",
|
||||||
|
"Jackpoll <jackpoll123456@gmail.com>",
|
||||||
|
"Jake Mc <startswithaj@users.noreply.github.com>",
|
||||||
|
"John Tantalo <john.tantalo@gmail.com>",
|
||||||
|
"John Yanarella <jmy@codecatalyst.com>",
|
||||||
|
"Jon Buckley <jon@jbuckley.ca>",
|
||||||
|
"Lee Treveil <leetreveil@gmail.com>",
|
||||||
|
"Leonardo <leofiore@libero.it>",
|
||||||
|
"Michael Hess <mhess@connectify.me>",
|
||||||
|
"Ross Noble <rosshnoble@gmail.com>",
|
||||||
|
"Sandro Sonntag <sandro.sonntag@adorsys.de>"
|
||||||
|
],
|
||||||
|
"dependencies": {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "0.5.25",
|
"version": "0.7.0",
|
||||||
"description": "Lightweight JavaScript-based user-agent string parser",
|
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||||
"keywords": ["user-agent", "parser", "browser", "engine", "os", "device"],
|
"keywords": ["user-agent", "parser", "browser", "engine", "os", "device", "cpu"],
|
||||||
"scripts": ["src/ua-parser.js"],
|
"scripts": ["src/ua-parser.js"],
|
||||||
"main": "src/ua-parser.js",
|
"main": "src/ua-parser.js",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
41
package.json
41
package.json
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"title": "UAParser.js",
|
"title": "UAParser.js",
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "0.5.25",
|
"version": "0.7.0",
|
||||||
"author": "Faisal Salman <fyzlman@gmail.com> (http://faisalman.com)",
|
"author": "Faisal Salman <fyzlman@gmail.com> (http://faisalman.com)",
|
||||||
"description": "Lightweight JavaScript-based user-agent string parser",
|
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
@@ -10,33 +10,40 @@
|
|||||||
"browser",
|
"browser",
|
||||||
"engine",
|
"engine",
|
||||||
"os",
|
"os",
|
||||||
"device"
|
"device",
|
||||||
|
"cpu"
|
||||||
],
|
],
|
||||||
"homepage": "http://github.com/faisalman/ua-parser-js",
|
"homepage": "http://github.com/faisalman/ua-parser-js",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Faisal Salman <fyzlman@gmail.com>",
|
"Faisal Salman <fyzlman@gmail.com>",
|
||||||
|
"Benjamin Bertrand <bertrand.design@gmail.com>",
|
||||||
"Christopher De Cairos <chris.decairos@gmail.com>",
|
"Christopher De Cairos <chris.decairos@gmail.com>",
|
||||||
|
"Davit Barbakadze <jayarjo@gmail.com>",
|
||||||
|
"Dmitry Tyschenko <dtyschenko@gmail.com>",
|
||||||
|
"Douglas Li <doug@knotch.it>",
|
||||||
|
"Erik Hesselink <hesselink@gmail.com>",
|
||||||
|
"Fabian Becker <halfdan@xnorfz.de>",
|
||||||
|
"Jackpoll <jackpoll123456@gmail.com>",
|
||||||
|
"Jake Mc <startswithaj@users.noreply.github.com>",
|
||||||
"John Tantalo <john.tantalo@gmail.com>",
|
"John Tantalo <john.tantalo@gmail.com>",
|
||||||
|
"John Yanarella <jmy@codecatalyst.com>",
|
||||||
"Jon Buckley <jon@jbuckley.ca>",
|
"Jon Buckley <jon@jbuckley.ca>",
|
||||||
"Lee Treveil <leetreveil@gmail.com>"
|
"Lee Treveil <leetreveil@gmail.com>",
|
||||||
|
"Leonardo <leofiore@libero.it>",
|
||||||
|
"Michael Hess <mhess@connectify.me>",
|
||||||
|
"Ross Noble <rosshnoble@gmail.com>",
|
||||||
|
"Sandro Sonntag <sandro.sonntag@adorsys.de>"
|
||||||
],
|
],
|
||||||
"main": "src/ua-parser.js",
|
"main": "src/ua-parser.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "./build/build.sh"
|
"test": "./build/build.sh"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"jshint": ">= 1.1.0",
|
"jshint": "~1.1.0",
|
||||||
"mocha": ">= 1.7.1",
|
"mocha": "~1.7.1",
|
||||||
"uglify-js": ">= 1.3.4"
|
"uglify-js": "~1.3.4"
|
||||||
},
|
},
|
||||||
"repositories": [
|
"repository" : {
|
||||||
{
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/faisalman/ua-parser-js.git"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"repository" :
|
|
||||||
{
|
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/faisalman/ua-parser-js.git"
|
"url": "https://github.com/faisalman/ua-parser-js.git"
|
||||||
},
|
},
|
||||||
@@ -56,9 +63,5 @@
|
|||||||
"directories": {
|
"directories": {
|
||||||
"lib": "src",
|
"lib": "src",
|
||||||
"test": "test"
|
"test": "test"
|
||||||
},
|
}
|
||||||
"files": [
|
|
||||||
""
|
|
||||||
],
|
|
||||||
"repository": "git://github.com/faisalman/ua-parser-js.git"
|
|
||||||
}
|
}
|
||||||
|
|||||||
51
readme.md
51
readme.md
@@ -10,7 +10,7 @@ Lightweight JavaScript-based User-Agent string parser. Supports browser & node.j
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
Extract detailed type of web browser, layout engine, operating system, and device purely from user-agent string with relatively lightweight footprint (~7KB minified / ~3KB gzipped). Written in vanilla js, which means it doesn't depends on any other library.
|
Extract detailed type of web browser, layout engine, operating system, cpu architecture, and device purely from user-agent string with relatively lightweight footprint (~7KB minified / ~3KB gzipped). Written in vanilla js, which means it doesn't depends on any other library.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -23,11 +23,12 @@ Extract detailed type of web browser, layout engine, operating system, and devic
|
|||||||
# Possible 'browser.name':
|
# Possible 'browser.name':
|
||||||
Amaya, Arora, Avant, Baidu, Blazer, Bolt, Camino, Chimera, Chrome, Chromium,
|
Amaya, Arora, Avant, Baidu, Blazer, Bolt, Camino, Chimera, Chrome, Chromium,
|
||||||
Comodo Dragon, Conkeror, Dillo, Dolphin, Doris, Epiphany, Fennec, Firebird,
|
Comodo Dragon, Conkeror, Dillo, Dolphin, Doris, Epiphany, Fennec, Firebird,
|
||||||
Firefox, Flock, GoBrowser, iCab, ICE Browser, IceApe, IceCat, Iceweasel,
|
Firefox, Flock, GoBrowser, iCab, ICE Browser, IceApe, IceCat, IceDragon,
|
||||||
IE [Mobile], Jasmine, K-Meleon, Konqueror, Kindle, Links, Lunascape, Lynx, Maemo,
|
Iceweasel, IE [Mobile], Iron, Jasmine, K-Meleon, Konqueror, Kindle, Links,
|
||||||
Maxthon, Midori, Minimo, [Mobile] Safari, Mosaic, Mozilla, Netfront, Netscape,
|
Lunascape, Lynx, Maemo, Maxthon, Midori, Minimo, [Mobile] Safari, Mosaic, Mozilla,
|
||||||
NetSurf, Nokia, OmniWeb, Opera [Mini/Mobi/Tablet], Phoenix, Polaris, RockMelt,
|
Netfront, Netscape, NetSurf, Nokia, OmniWeb, Opera [Mini/Mobi/Tablet], Phoenix,
|
||||||
Silk, Skyfire, SeaMonkey, SlimBrowser, Swiftfox, Tizen, UCBrowser, w3m, Yandex
|
Polaris, QQBrowser, RockMelt, Silk, Skyfire, SeaMonkey, SlimBrowser, Swiftfox,
|
||||||
|
Tizen, UCBrowser, w3m, Yandex
|
||||||
|
|
||||||
# 'browser.version' & 'browser.major' determined dynamically
|
# 'browser.version' & 'browser.major' determined dynamically
|
||||||
```
|
```
|
||||||
@@ -73,8 +74,16 @@ Windows [Phone/Mobile], Zenwalk
|
|||||||
# 'os.version' determined dynamically
|
# 'os.version' determined dynamically
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* `getCPU()`
|
||||||
|
* returns `{ architecture: '' }`
|
||||||
|
|
||||||
|
```
|
||||||
|
# Possible 'cpu.architecture'
|
||||||
|
68k, amd64, arm, ia32, ia64, irix, irix64, mips, mips64, pa-risc, ppc, sparc, sparc64
|
||||||
|
```
|
||||||
|
|
||||||
* `getResult()`
|
* `getResult()`
|
||||||
* returns `{ browser: {}, device: {}, engine: {}, os: {} }`
|
* returns `{ ua: '', browser: {}, cpu: {}, device: {}, engine: {}, os: {} }`
|
||||||
* `getUA()`
|
* `getUA()`
|
||||||
* returns UA string of current instance
|
* returns UA string of current instance
|
||||||
* `setUA(uastring)`
|
* `setUA(uastring)`
|
||||||
@@ -96,6 +105,7 @@ Windows [Phone/Mobile], Zenwalk
|
|||||||
/*
|
/*
|
||||||
/// this will print an object structured like this:
|
/// this will print an object structured like this:
|
||||||
{
|
{
|
||||||
|
ua: "",
|
||||||
browser: {
|
browser: {
|
||||||
name: "",
|
name: "",
|
||||||
version: "",
|
version: "",
|
||||||
@@ -113,6 +123,9 @@ Windows [Phone/Mobile], Zenwalk
|
|||||||
model: "",
|
model: "",
|
||||||
type: "",
|
type: "",
|
||||||
vendor: ""
|
vendor: ""
|
||||||
|
},
|
||||||
|
cpu: {
|
||||||
|
architecture: ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -130,6 +143,7 @@ Windows [Phone/Mobile], Zenwalk
|
|||||||
console.log(result.os); // {name: "Ubuntu", version: "11.10"}
|
console.log(result.os); // {name: "Ubuntu", version: "11.10"}
|
||||||
console.log(result.os.version); // "11.10"
|
console.log(result.os.version); // "11.10"
|
||||||
console.log(result.engine.name); // "WebKit"
|
console.log(result.engine.name); // "WebKit"
|
||||||
|
console.log(result.cpu.architecture); // "amd64"
|
||||||
|
|
||||||
// do some other tests
|
// do some other tests
|
||||||
var uastring2 = "Mozilla/5.0 (compatible; Konqueror/4.1; OpenBSD) KHTML/4.1.4 (like Gecko)";
|
var uastring2 = "Mozilla/5.0 (compatible; Konqueror/4.1; OpenBSD) KHTML/4.1.4 (like Gecko)";
|
||||||
@@ -149,15 +163,6 @@ Windows [Phone/Mobile], Zenwalk
|
|||||||
</html>
|
</html>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using requirejs
|
|
||||||
|
|
||||||
```js
|
|
||||||
require(['ua-parser'], function(UAParser) {
|
|
||||||
var parser = new UAParser();
|
|
||||||
console.log(parser.getResult());
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### Using node.js
|
### Using node.js
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -167,7 +172,17 @@ $ npm install ua-parser-js
|
|||||||
```js
|
```js
|
||||||
var UAParser = require('ua-parser-js');
|
var UAParser = require('ua-parser-js');
|
||||||
var parser = new UAParser();
|
var parser = new UAParser();
|
||||||
console.log(parser.getResult());
|
var ua = request.headers['user-agent']; // user-agent header from an HTTP request
|
||||||
|
console.log(parser.setUA(ua).getResult());
|
||||||
|
```
|
||||||
|
|
||||||
|
### Using requirejs
|
||||||
|
|
||||||
|
```js
|
||||||
|
require(['ua-parser'], function(UAParser) {
|
||||||
|
var parser = new UAParser();
|
||||||
|
console.log(parser.getResult());
|
||||||
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using component
|
### Using component
|
||||||
@@ -190,7 +205,7 @@ $ bower install ua-parser-js
|
|||||||
|
|
||||||
### Using jQuery.ua
|
### Using jQuery.ua
|
||||||
|
|
||||||
Although written in vanilla js (which means it doesn't depends on jQuery), if you're using jQuery, this library will automatically detect and create `$.ua` object based on browser's user-agent (although in case you need, `window.UAParser` constructor is still present). To get/set user-agent you can use: `$.ua.get()` / `$.ua.set(uastring)`.
|
Although written in vanilla js (which means it doesn't depends on jQuery), this library will automatically detect if jQuery is present and create `$.ua` object based on browser's user-agent (although in case you need, `window.UAParser` constructor is still present). To get/set user-agent you can use: `$.ua.get()` / `$.ua.set(uastring)`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// In browser with default user-agent: 'Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Sprint APA7373KT Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0':
|
// In browser with default user-agent: 'Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Sprint APA7373KT Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0':
|
||||||
|
|||||||
241
src/ua-parser.js
241
src/ua-parser.js
@@ -1,4 +1,4 @@
|
|||||||
// UAParser.js v0.5.25
|
// UAParser.js v0.7.0
|
||||||
// Lightweight JavaScript-based User-Agent string parser
|
// Lightweight JavaScript-based User-Agent string parser
|
||||||
// https://github.com/faisalman/ua-parser-js
|
// https://github.com/faisalman/ua-parser-js
|
||||||
//
|
//
|
||||||
@@ -25,9 +25,11 @@
|
|||||||
TYPE = 'type',
|
TYPE = 'type',
|
||||||
VENDOR = 'vendor',
|
VENDOR = 'vendor',
|
||||||
VERSION = 'version',
|
VERSION = 'version',
|
||||||
|
ARCHITECTURE= 'architecture',
|
||||||
CONSOLE = 'console',
|
CONSOLE = 'console',
|
||||||
MOBILE = 'mobile',
|
MOBILE = 'mobile',
|
||||||
TABLET = 'tablet';
|
TABLET = 'tablet',
|
||||||
|
SMARTTV = 'smarttv';
|
||||||
|
|
||||||
|
|
||||||
///////////
|
///////////
|
||||||
@@ -37,7 +39,12 @@
|
|||||||
|
|
||||||
var util = {
|
var util = {
|
||||||
has : function (str1, str2) {
|
has : function (str1, str2) {
|
||||||
|
if (typeof str1 === "string") {
|
||||||
return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
|
return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
lowerize : function (str) {
|
||||||
|
return str.toLowerCase();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -74,14 +81,19 @@
|
|||||||
for (j = k = 0; j < regex.length; j++) {
|
for (j = k = 0; j < regex.length; j++) {
|
||||||
matches = regex[j].exec(this.getUA());
|
matches = regex[j].exec(this.getUA());
|
||||||
if (!!matches) {
|
if (!!matches) {
|
||||||
for (p in props) {
|
for (p = 0; p < props.length; p++) {
|
||||||
match = matches[++k];
|
match = matches[++k];
|
||||||
q = props[p];
|
q = props[p];
|
||||||
// check if given property is actually array
|
// check if given property is actually array
|
||||||
if (typeof(q) === OBJ_TYPE) {
|
if (typeof(q) === OBJ_TYPE && q.length > 0) {
|
||||||
if (q.length == 2) {
|
if (q.length == 2) {
|
||||||
// assign given value, ignore regex match
|
if (typeof(q[1]) == FUNC_TYPE) {
|
||||||
result[q[0]] = q[1];
|
// assign modified match
|
||||||
|
result[q[0]] = q[1].call(this, match);
|
||||||
|
} else {
|
||||||
|
// assign given value, ignore regex match
|
||||||
|
result[q[0]] = q[1];
|
||||||
|
}
|
||||||
} else if (q.length == 3) {
|
} else if (q.length == 3) {
|
||||||
// check whether function or regex
|
// check whether function or regex
|
||||||
if (typeof(q[1]) === FUNC_TYPE && !(q[1].exec && q[1].test)) {
|
if (typeof(q[1]) === FUNC_TYPE && !(q[1].exec && q[1].test)) {
|
||||||
@@ -91,6 +103,8 @@
|
|||||||
// sanitize match using given regex
|
// sanitize match using given regex
|
||||||
result[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
|
result[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
|
||||||
}
|
}
|
||||||
|
} else if (q.length == 4) {
|
||||||
|
result[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result[q] = match ? match : undefined;
|
result[q] = match ? match : undefined;
|
||||||
@@ -110,7 +124,7 @@
|
|||||||
for (var i in map) {
|
for (var i in map) {
|
||||||
// check if array
|
// check if array
|
||||||
if (typeof(map[i]) === OBJ_TYPE && map[i].length > 0) {
|
if (typeof(map[i]) === OBJ_TYPE && map[i].length > 0) {
|
||||||
for (var j in map[i]) {
|
for (var j = 0; j < map[i].length; j++) {
|
||||||
if (util.has(map[i][j], str)) {
|
if (util.has(map[i][j], str)) {
|
||||||
return (i === UNKNOWN) ? undefined : i;
|
return (i === UNKNOWN) ? undefined : i;
|
||||||
}
|
}
|
||||||
@@ -174,6 +188,7 @@
|
|||||||
'Vista' : 'NT 6.0',
|
'Vista' : 'NT 6.0',
|
||||||
'7' : 'NT 6.1',
|
'7' : 'NT 6.1',
|
||||||
'8' : 'NT 6.2',
|
'8' : 'NT 6.2',
|
||||||
|
'8.1' : 'NT 6.3',
|
||||||
'RT' : 'ARM'
|
'RT' : 'ARM'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,12 +205,15 @@
|
|||||||
|
|
||||||
browser : [[
|
browser : [[
|
||||||
|
|
||||||
|
/APP-([\w\s-\d]+)\/((\d+)?[\w\.]+)/i // KTA App
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
// Presto based
|
// Presto based
|
||||||
/(opera\smini)\/((\d+)?[\w\.-]+)/i, // Opera Mini
|
/(opera\smini)\/((\d+)?[\w\.-]+)/i, // Opera Mini
|
||||||
/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i, // Opera Mobi/Tablet
|
/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i, // Opera Mobi/Tablet
|
||||||
/(opera).+version\/((\d+)?[\w\.]+)/i, // Opera > 9.80
|
/(opera).+version\/((\d+)?[\w\.]+)/i, // Opera > 9.80
|
||||||
/(opera)[\/\s]+((\d+)?[\w\.]+)/i // Opera < 9.80
|
/(opera)[\/\s]+((\d+)?[\w\.]+)/i // Opera < 9.80
|
||||||
|
|
||||||
], [NAME, VERSION, MAJOR], [
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
/\s(opr)\/((\d+)?[\w\.]+)/i // Opera Webkit
|
/\s(opr)\/((\d+)?[\w\.]+)/i // Opera Webkit
|
||||||
@@ -209,14 +227,17 @@
|
|||||||
// Trident based
|
// Trident based
|
||||||
/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,
|
/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,
|
||||||
// Avant/IEMobile/SlimBrowser/Baidu
|
// Avant/IEMobile/SlimBrowser/Baidu
|
||||||
/ms(ie)\s((\d+)?[\w\.]+)/i, // Internet Explorer
|
/(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i, // Internet Explorer
|
||||||
|
|
||||||
// Webkit/KHTML based
|
// Webkit/KHTML based
|
||||||
/(rekonq)((?:\/)[\w\.]+)*/i, // Rekonq
|
/(rekonq)((?:\/)[\w\.]+)*/i, // Rekonq
|
||||||
/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt)\/((\d+)?[\w\.-]+)/i
|
/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i
|
||||||
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt
|
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron
|
||||||
], [NAME, VERSION, MAJOR], [
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i // IE11
|
||||||
|
], [[NAME, 'IE'], VERSION, MAJOR], [
|
||||||
|
|
||||||
/(yabrowser)\/((\d+)?[\w\.]+)/i // Yandex
|
/(yabrowser)\/((\d+)?[\w\.]+)/i // Yandex
|
||||||
], [[NAME, 'Yandex'], VERSION, MAJOR], [
|
], [[NAME, 'Yandex'], VERSION, MAJOR], [
|
||||||
|
|
||||||
@@ -250,20 +271,147 @@
|
|||||||
/(navigator|netscape)\/((\d+)?[\w\.-]+)/i // Netscape
|
/(navigator|netscape)\/((\d+)?[\w\.-]+)/i // Netscape
|
||||||
], [[NAME, 'Netscape'], VERSION, MAJOR], [
|
], [[NAME, 'Netscape'], VERSION, MAJOR], [
|
||||||
/(swiftfox)/i, // Swiftfox
|
/(swiftfox)/i, // Swiftfox
|
||||||
/(iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,
|
/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,
|
||||||
// Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
|
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
|
||||||
/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,
|
/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,
|
||||||
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
|
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
|
||||||
/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla
|
/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
/(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf)[\/\s]?((\d+)?[\w\.]+)/i,
|
/(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i,
|
||||||
// UCBrowser/Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf
|
// UCBrowser/Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/QQBrowser
|
||||||
/(links)\s\(((\d+)?[\w\.]+)/i, // Links
|
/(links)\s\(((\d+)?[\w\.]+)/i, // Links
|
||||||
/(gobrowser)\/?((\d+)?[\w\.]+)*/i, // GoBrowser
|
/(gobrowser)\/?((\d+)?[\w\.]+)*/i, // GoBrowser
|
||||||
/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i, // ICE Browser
|
/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i, // ICE Browser
|
||||||
/(mosaic)[\/\s]((\d+)?[\w\.]+)/i // Mosaic
|
/(mosaic)[\/\s]((\d+)?[\w\.]+)/i // Mosaic
|
||||||
], [NAME, VERSION, MAJOR]
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(apple(?:coremedia|))\/((\d+)[\w\._]+)/i, // Generic Apple CoreMedia
|
||||||
|
/(coremedia) v((\d+)[\w\._]+)/i
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(aqualung|lyssna|bsplayer)\/((\d+)?[\w\.-]+)/i // Aqualung/Lyssna/BSPlayer
|
||||||
|
], [NAME, VERSION], [
|
||||||
|
|
||||||
|
/(ares|ossproxy)\s((\d+)[\w\.-]+)/i // Ares/OSSProxy
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(audacious|audimusicstream|amarok|bass|core|dalvik|gnomemplayer|music on console|nsplayer|psp-internetradioplayer|videos)\/((\d+)[\w\.-]+)/i,
|
||||||
|
// Audacious/AudiMusicStream/Amarok/BASS/OpenCORE/Dalvik/GnomeMplayer/MoC
|
||||||
|
// NSPlayer/PSP-InternetRadioPlayer/Videos
|
||||||
|
/(clementine|music player daemon)\s((\d+)[\w\.-]+)/i, // Clementine/MPD
|
||||||
|
/(lg player|nexplayer)\s((\d+)[\d\.]+)/i,
|
||||||
|
/player\/(nexplayer|lg player)\s((\d+)[\w\.-]+)/i // NexPlayer/LG Player
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
/(nexplayer)\s((\d+)[\w\.-]+)/i // Nexplayer
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(flrp)\/((\d+)[\w\.-]+)/i // Flip Player
|
||||||
|
], [[NAME, 'Flip Player'], VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(fstream|nativehost|queryseekspider|ia-archiver|facebookexternalhit)/i
|
||||||
|
// FStream/NativeHost/QuerySeekSpider/IA Archiver/facebookexternalhit
|
||||||
|
], [NAME], [
|
||||||
|
|
||||||
|
/(gstreamer) souphttpsrc (?:\([^\)]+\)){0,1} libsoup\/((\d+)[\w\.-]+)/i
|
||||||
|
// Gstreamer
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(htc streaming player)\s[\w_]+\s\/\s((\d+)[\d\.]+)/i, // HTC Streaming Player
|
||||||
|
/(java|python-urllib|python-requests|wget|libcurl)\/((\d+)[\w\.-_]+)/i,
|
||||||
|
// Java/urllib/requests/wget/cURL
|
||||||
|
/(lavf)((\d+)[\d\.]+)/i // Lavf (FFMPEG)
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(htc_one_s)\/((\d+)[\d\.]+)/i, // HTC One S
|
||||||
|
], [[NAME, /_/g, ' '], VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(mplayer)(?:\s|\/)(?:(?:sherpya-){0,1}svn)(?:-|\s)(r\d+(?:-\d+[\w\.-]+){0,1})/i,
|
||||||
|
// MPlayer SVN
|
||||||
|
], [NAME, VERSION], [
|
||||||
|
|
||||||
|
/(mplayer)(?:\s|\/|[unkow-]+)((\d+)[\w\.-]+)/i, // MPlayer
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(mplayer)/i, // MPlayer (no other info)
|
||||||
|
/(yourmuze)/i, // YourMuze
|
||||||
|
/(media player classic|nero showtime)/i // Media Player Classic/Nero ShowTime
|
||||||
|
], [NAME], [
|
||||||
|
|
||||||
|
/(nero (?:home|scout))\/((\d+)[\w\.-]+)/i // Nero Home/Nero Scout
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(nokia\d+)\/((\d+)[\w\.-]+)/i // Nokia
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/\s(songbird)\/((\d+)[\w\.-]+)/i // Songbird/Philips-Songbird
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(winamp)3 version ((\d+)[\w\.-]+)/i, // Winamp
|
||||||
|
/(winamp)\s((\d+)[\w\.-]+)/i,
|
||||||
|
/(winamp)mpeg\/((\d+)[\w\.-]+)/i
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(ocms-bot|tapinradio|tunein radio|unknown|winamp|inlight radio)/i // OCMS-bot/tap in radio/tunein/unknown/winamp (no other info)
|
||||||
|
// inlight radio
|
||||||
|
], [NAME], [
|
||||||
|
|
||||||
|
/(quicktime|rma|radioapp|radioclientapplication|soundtap|totem|stagefright|streamium)\/((\d+)[\w\.-]+)/i
|
||||||
|
// QuickTime/RealMedia/RadioApp/RadioClientApplication/
|
||||||
|
// SoundTap/Totem/Stagefright/Streamium
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(smp)((\d+)[\d\.]+)/i // SMP
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(vlc) media player - version ((\d+)[\w\.]+)/i, // VLC Videolan
|
||||||
|
/(vlc)\/((\d+)[\w\.-]+)/i,
|
||||||
|
/(xbmc|gvfs|xine|xmms|irapp)\/((\d+)[\w\.-]+)/i, // XBMC/gvfs/Xine/XMMS/irapp
|
||||||
|
/(foobar2000)\/((\d+)[\d\.]+)/i, // Foobar2000
|
||||||
|
/(itunes)\/((\d+)[\d\.]+)/i // iTunes
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(wmplayer)\/((\d+)[\w\.-]+)/i, // Windows Media Player
|
||||||
|
/(windows-media-player)\/((\d+)[\w\.-]+)/i
|
||||||
|
], [[NAME, /-/g, ' '], VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/windows\/((\d+)[\w\.-]+) upnp\/[\d\.]+ dlnadoc\/[\d\.]+ (home media server)/i,
|
||||||
|
// Windows Media Server
|
||||||
|
], [VERSION, MAJOR, [NAME, 'Windows']], [
|
||||||
|
|
||||||
|
/(com\.riseupradioalarm)\/((\d+)[\d\.]*)/i // RiseUP Radio Alarm
|
||||||
|
], [NAME, VERSION, MAJOR], [
|
||||||
|
|
||||||
|
/(rad.io)\s((\d+)[\d\.]+)/i, // Rad.io
|
||||||
|
/(radio.(?:de|at|fr))\s((\d+)[\d\.]+)/i
|
||||||
|
], [[NAME, 'rad.io'], VERSION, MAJOR]
|
||||||
|
|
||||||
|
],
|
||||||
|
|
||||||
|
cpu : [[
|
||||||
|
|
||||||
|
/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i // AMD64
|
||||||
|
], [[ARCHITECTURE, 'amd64']], [
|
||||||
|
|
||||||
|
/(ia32(?=;))/i // IA32 (quicktime)
|
||||||
|
], [[ARCHITECTURE, util.lowerize]], [
|
||||||
|
|
||||||
|
/((?:i[346]|x)86)[;\)]/i // IA32
|
||||||
|
], [[ARCHITECTURE, 'ia32']], [
|
||||||
|
|
||||||
|
// PocketPC mistakenly identified as PowerPC
|
||||||
|
/windows\s(ce|mobile);\sppc;/i
|
||||||
|
], [[ARCHITECTURE, 'arm']], [
|
||||||
|
|
||||||
|
/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i // PowerPC
|
||||||
|
], [[ARCHITECTURE, /ower/, '', util.lowerize]], [
|
||||||
|
|
||||||
|
/(sun4\w)[;\)]/i // SPARC
|
||||||
|
], [[ARCHITECTURE, 'sparc']], [
|
||||||
|
|
||||||
|
/(ia64(?=;)|68k(?=\))|arm(?=v\d+;)|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i
|
||||||
|
// IA64, 68K, ARM, IRIX, MIPS, SPARC, PA-RISC
|
||||||
|
], [ARCHITECTURE, util.lowerize]
|
||||||
],
|
],
|
||||||
|
|
||||||
device : [[
|
device : [[
|
||||||
@@ -271,14 +419,25 @@
|
|||||||
/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i // iPad/PlayBook
|
/\((ipad|playbook);[\w\s\);-]+(rim|apple)/i // iPad/PlayBook
|
||||||
], [MODEL, VENDOR, [TYPE, TABLET]], [
|
], [MODEL, VENDOR, [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/applecoremedia\/[\w\.]+ \((ipad)/ // iPad
|
||||||
|
], [MODEL, [VENDOR, 'Apple'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/(apple\s{0,1}tv)/i // Apple TV
|
||||||
|
], [[MODEL, 'Apple TV'], [VENDOR, 'Apple']], [
|
||||||
|
|
||||||
/(hp).+(touchpad)/i, // HP TouchPad
|
/(hp).+(touchpad)/i, // HP TouchPad
|
||||||
/(kindle)\/([\w\.]+)/i, // Kindle
|
/(kindle)\/([\w\.]+)/i, // Kindle
|
||||||
/\s(nook)[\w\s]+build\/(\w+)/i, // Nook
|
/\s(nook)[\w\s]+build\/(\w+)/i, // Nook
|
||||||
/(dell)\s(strea[kpr\s\d]*[\dko])/i // Dell Streak
|
/(dell)\s(strea[kpr\s\d]*[\dko])/i // Dell Streak
|
||||||
], [VENDOR, MODEL, [TYPE, TABLET]], [
|
], [VENDOR, MODEL, [TYPE, TABLET]], [
|
||||||
|
|
||||||
/\((ip[honed]+);.+(apple)/i // iPod/iPhone
|
/(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i, // Kindle Fire HD
|
||||||
|
], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [
|
||||||
|
|
||||||
|
/\((ip[honed|\s\w*]+);.+(apple)/i // iPod/iPhone
|
||||||
], [MODEL, VENDOR, [TYPE, MOBILE]], [
|
], [MODEL, VENDOR, [TYPE, MOBILE]], [
|
||||||
|
/\((ip[honed|\s\w*]+);/i // iPod/iPhone
|
||||||
|
], [MODEL, [VENDOR, 'Apple'], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
/(blackberry)[\s-]?(\w+)/i, // BlackBerry
|
/(blackberry)[\s-]?(\w+)/i, // BlackBerry
|
||||||
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola)[\s_-]?([\w-]+)*/i,
|
/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola)[\s_-]?([\w-]+)*/i,
|
||||||
@@ -288,8 +447,8 @@
|
|||||||
], [VENDOR, MODEL, [TYPE, MOBILE]], [
|
], [VENDOR, MODEL, [TYPE, MOBILE]], [
|
||||||
/\((bb10);\s(\w+)/i // BlackBerry 10
|
/\((bb10);\s(\w+)/i // BlackBerry 10
|
||||||
], [[VENDOR, 'BlackBerry'], MODEL, [TYPE, MOBILE]], [
|
], [[VENDOR, 'BlackBerry'], MODEL, [TYPE, MOBILE]], [
|
||||||
|
// Asus Tablets
|
||||||
/android.+((transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+))/i // Asus Tablets
|
/android.+((transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7))/i
|
||||||
], [[VENDOR, 'Asus'], MODEL, [TYPE, TABLET]], [
|
], [[VENDOR, 'Asus'], MODEL, [TYPE, TABLET]], [
|
||||||
|
|
||||||
/(sony)\s(tablet\s[ps])/i // Sony Tablets
|
/(sony)\s(tablet\s[ps])/i // Sony Tablets
|
||||||
@@ -306,17 +465,18 @@
|
|||||||
|
|
||||||
/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, // HTC
|
/(htc)[;_\s-]+([\w\s]+(?=\))|\w+)*/i, // HTC
|
||||||
/(zte)-(\w+)*/i, // ZTE
|
/(zte)-(\w+)*/i, // ZTE
|
||||||
/(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|;\ssony)[_\s-]?([\w-]+)*/i
|
/(alcatel|geeksphone|huawei|lenovo|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]+)*/i
|
||||||
// Alcatel/GeeksPhone/Huawei/Lenovo/Nexian/Panasonic/Sony
|
// Alcatel/GeeksPhone/Huawei/Lenovo/Nexian/Panasonic/Sony
|
||||||
], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
|
], [VENDOR, [MODEL, /_/g, ' '], [TYPE, MOBILE]], [
|
||||||
|
|
||||||
/\s((milestone|droid[2x]?))[globa\s]*\sbuild\//i, // Motorola
|
// Motorola
|
||||||
|
/\s((milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?))[\w\s]+build\//i,
|
||||||
/(mot)[\s-]?(\w+)*/i
|
/(mot)[\s-]?(\w+)*/i
|
||||||
], [[VENDOR, 'Motorola'], MODEL, [TYPE, MOBILE]], [
|
], [[VENDOR, 'Motorola'], MODEL, [TYPE, MOBILE]], [
|
||||||
/android.+\s((mz60\d|xoom[\s2]{0,2}))\sbuild\//i
|
/android.+\s((mz60\d|xoom[\s2]{0,2}))\sbuild\//i
|
||||||
], [[VENDOR, 'Motorola'], MODEL, [TYPE, TABLET]], [
|
], [[VENDOR, 'Motorola'], MODEL, [TYPE, TABLET]], [
|
||||||
|
|
||||||
/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9))/i
|
/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9|nexus 10))/i
|
||||||
], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [ // Samsung
|
], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [ // Samsung
|
||||||
/((s[cgp]h-\w+|gt-\w+|galaxy\snexus))/i,
|
/((s[cgp]h-\w+|gt-\w+|galaxy\snexus))/i,
|
||||||
/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i,
|
/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i,
|
||||||
@@ -332,17 +492,24 @@
|
|||||||
/android\s3\.[\s\w-;]{10}((a\d{3}))/i // Acer
|
/android\s3\.[\s\w-;]{10}((a\d{3}))/i // Acer
|
||||||
], [[VENDOR, 'Acer'], MODEL, [TYPE, TABLET]], [
|
], [[VENDOR, 'Acer'], MODEL, [TYPE, TABLET]], [
|
||||||
|
|
||||||
/android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i // LG
|
/android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i // LG Tablet
|
||||||
], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [
|
], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [
|
||||||
/((nexus\s4))/i,
|
/(lg) netcast\.tv/i // LG SmartTV
|
||||||
|
], [VENDOR, [TYPE, SMARTTV]], [
|
||||||
|
/((nexus\s[45]))/i, // LG
|
||||||
/(lg)[e;\s-\/]+(\w+)*/i
|
/(lg)[e;\s-\/]+(\w+)*/i
|
||||||
], [[VENDOR, 'LG'], MODEL, [TYPE, MOBILE]], [
|
], [[VENDOR, 'LG'], MODEL, [TYPE, MOBILE]], [
|
||||||
|
|
||||||
|
/android.+((ideatab[a-z0-9\-\s]+))/i // Lenovo
|
||||||
|
], [[VENDOR, 'Lenovo'], MODEL, [TYPE, TABLET]], [
|
||||||
|
|
||||||
/(mobile|tablet);.+rv\:.+gecko\//i // Unidentifiable
|
/(mobile|tablet);.+rv\:.+gecko\//i // Unidentifiable
|
||||||
], [TYPE, VENDOR, MODEL]
|
], [TYPE, VENDOR, MODEL]
|
||||||
],
|
],
|
||||||
|
|
||||||
engine : [[
|
engine : [[
|
||||||
|
/APP-([\w\s-\d]+)\/((\d+)?[\w\.]+)/i // KTA App
|
||||||
|
], [[NAME, 'Mobile-App'], VERSION], [
|
||||||
|
|
||||||
/(presto)\/([\w\.]+)/i, // Presto
|
/(presto)\/([\w\.]+)/i, // Presto
|
||||||
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m
|
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m
|
||||||
@@ -357,6 +524,8 @@
|
|||||||
os : [[
|
os : [[
|
||||||
|
|
||||||
// Windows based
|
// Windows based
|
||||||
|
/microsoft\s(windows)\s(vista|xp)/i, // Windows (iTunes)
|
||||||
|
], [NAME, VERSION], [
|
||||||
/(windows)\snt\s6\.2;\s(arm)/i, // Windows RT
|
/(windows)\snt\s6\.2;\s(arm)/i, // Windows RT
|
||||||
/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i
|
/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i
|
||||||
], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [
|
], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [
|
||||||
@@ -431,6 +600,9 @@
|
|||||||
this.getBrowser = function () {
|
this.getBrowser = function () {
|
||||||
return mapper.rgx.apply(this, regexes.browser);
|
return mapper.rgx.apply(this, regexes.browser);
|
||||||
};
|
};
|
||||||
|
this.getCPU = function () {
|
||||||
|
return mapper.rgx.apply(this, regexes.cpu);
|
||||||
|
};
|
||||||
this.getDevice = function () {
|
this.getDevice = function () {
|
||||||
return mapper.rgx.apply(this, regexes.device);
|
return mapper.rgx.apply(this, regexes.device);
|
||||||
};
|
};
|
||||||
@@ -442,13 +614,15 @@
|
|||||||
};
|
};
|
||||||
this.getResult = function() {
|
this.getResult = function() {
|
||||||
return {
|
return {
|
||||||
|
ua : this.getUA(),
|
||||||
browser : this.getBrowser(),
|
browser : this.getBrowser(),
|
||||||
engine : this.getEngine(),
|
engine : this.getEngine(),
|
||||||
os : this.getOS(),
|
os : this.getOS(),
|
||||||
device : this.getDevice()
|
device : this.getDevice(),
|
||||||
|
cpu : this.getCPU()
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
this.getUA = function() {
|
this.getUA = function () {
|
||||||
return ua;
|
return ua;
|
||||||
};
|
};
|
||||||
this.setUA = function (uastring) {
|
this.setUA = function (uastring) {
|
||||||
@@ -464,21 +638,22 @@
|
|||||||
//////////
|
//////////
|
||||||
|
|
||||||
|
|
||||||
// check js environment
|
// check js environment
|
||||||
if (typeof(exports) !== UNDEF_TYPE) {
|
if (typeof(exports) !== UNDEF_TYPE) {
|
||||||
// nodejs env
|
// nodejs env
|
||||||
if (typeof(module) !== UNDEF_TYPE && module.exports) {
|
if (typeof(module) !== UNDEF_TYPE && module.exports) {
|
||||||
exports = module.exports = UAParser;
|
exports = module.exports = UAParser;
|
||||||
}
|
}
|
||||||
exports.UAParser = UAParser;
|
exports.UAParser = UAParser;
|
||||||
} else if (typeof(define) === FUNC_TYPE && define.amd) {
|
|
||||||
// requirejs env
|
|
||||||
define(function() {
|
|
||||||
return UAParser;
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// browser env
|
// browser env
|
||||||
window.UAParser = UAParser;
|
window.UAParser = UAParser;
|
||||||
|
// requirejs env (optional)
|
||||||
|
if (typeof(define) === FUNC_TYPE && define.amd) {
|
||||||
|
define(function () {
|
||||||
|
return UAParser;
|
||||||
|
});
|
||||||
|
}
|
||||||
// jQuery specific (optional)
|
// jQuery specific (optional)
|
||||||
if (typeof(window.jQuery) !== UNDEF_TYPE) {
|
if (typeof(window.jQuery) !== UNDEF_TYPE) {
|
||||||
var $ = window.jQuery;
|
var $ = window.jQuery;
|
||||||
@@ -487,7 +662,7 @@
|
|||||||
$.ua.get = function() {
|
$.ua.get = function() {
|
||||||
return parser.getUA();
|
return parser.getUA();
|
||||||
};
|
};
|
||||||
$.ua.set = function(uastring) {
|
$.ua.set = function (uastring) {
|
||||||
parser.setUA(uastring);
|
parser.setUA(uastring);
|
||||||
var result = parser.getResult();
|
var result = parser.getResult();
|
||||||
for (var prop in result) {
|
for (var prop in result) {
|
||||||
|
|||||||
8
src/ua-parser.min.js
vendored
8
src/ua-parser.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -14,7 +14,7 @@
|
|||||||
"ua" : "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB5; Avant Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
|
"ua" : "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB5; Avant Browser; .NET CLR 1.1.4322; .NET CLR 2.0.50727)",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
"name" : "Avant Browser",
|
"name" : "Avant ",
|
||||||
"version" : "undefined",
|
"version" : "undefined",
|
||||||
"major" : "undefined"
|
"major" : "undefined"
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
"ua" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; baidubrowser 1.x)",
|
"ua" : "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; baidubrowser 1.x)",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
"name" : "baidubrowser",
|
"name" : "baidu",
|
||||||
"version" : "1.x",
|
"version" : "1.x",
|
||||||
"major" : "1"
|
"major" : "1"
|
||||||
}
|
}
|
||||||
@@ -239,6 +239,26 @@
|
|||||||
"major" : "7"
|
"major" : "7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "IE 11 with IE token",
|
||||||
|
"ua" : "Mozilla/5.0 (IE 11.0; Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "IE",
|
||||||
|
"version" : "11.0",
|
||||||
|
"major" : "11"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "IE 11 without IE token",
|
||||||
|
"ua" : "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv 11.0) like Gecko",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "IE",
|
||||||
|
"version" : "11.0",
|
||||||
|
"major" : "11"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "K-Meleon",
|
"desc" : "K-Meleon",
|
||||||
"ua" : "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031016 K-Meleon/0.8.2",
|
"ua" : "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.5) Gecko/20031016 K-Meleon/0.8.2",
|
||||||
@@ -574,7 +594,7 @@
|
|||||||
"ua" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SlimBrowser)",
|
"ua" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; SlimBrowser)",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
"name" : "SlimBrowser",
|
"name" : "Slim",
|
||||||
"version" : "undefined",
|
"version" : "undefined",
|
||||||
"major" : "undefined"
|
"major" : "undefined"
|
||||||
}
|
}
|
||||||
@@ -628,4 +648,585 @@
|
|||||||
"version" : "1.0.1084.5402",
|
"version" : "1.0.1084.5402",
|
||||||
"major" : "1"
|
"major" : "1"
|
||||||
}
|
}
|
||||||
}]
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Coremedia",
|
||||||
|
"ua" : "Apple Mac OS X v10.6.4 CoreMedia v1.0.0.10F2108",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "CoreMedia",
|
||||||
|
"version" : "1.0.0.10F2108",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "AppleCoreMedia",
|
||||||
|
"ua" : "AppleCoreMedia/1.0.0.10A403 (iPad; U; CPU OS 6_0 like Mac OS X; it_it)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "AppleCoreMedia",
|
||||||
|
"version" : "1.0.0.10A403",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "AppleTv",
|
||||||
|
"ua" : "AppleTV/3.0.2 (Macintosh; Intel Mac OS X 10.4.7) AppleWebKit/528.18",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "WebKit",
|
||||||
|
"version" : "528.18",
|
||||||
|
"major" : "528"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Aqualung",
|
||||||
|
"ua" : "Aqualung/R-1114",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Aqualung",
|
||||||
|
"version" : "R-1114",
|
||||||
|
"major" : "undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Ares",
|
||||||
|
"ua" : "Ares 2.2.4.3048",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Ares",
|
||||||
|
"version" : "2.2.4.3048",
|
||||||
|
"major" : "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Audacious",
|
||||||
|
"ua" : "Audacious/3.2.2 neon/0.29.3",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Audacious",
|
||||||
|
"version" : "3.2.2",
|
||||||
|
"major" : "3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "AudiMusicStream",
|
||||||
|
"ua" : "AudiMusicStream/3020.130826151911",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "AudiMusicStream",
|
||||||
|
"version" : "3020.130826151911",
|
||||||
|
"major" : "3020"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "BASS",
|
||||||
|
"ua" : "BASS/2.4",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "BASS",
|
||||||
|
"version" : "2.4",
|
||||||
|
"major" : "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "BSPlayer",
|
||||||
|
"ua" : "BSPlayer/2",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "BSPlayer",
|
||||||
|
"version" : "2",
|
||||||
|
"major" : "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Core",
|
||||||
|
"ua" : "CORE/6.506.4.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "CORE",
|
||||||
|
"version" : "6.506.4.1",
|
||||||
|
"major" : "6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Clementine",
|
||||||
|
"ua" : "Clementine 1.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Clementine",
|
||||||
|
"version" : "1.1",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Dalvik",
|
||||||
|
"ua" : "Dalvik/1.2.0 (Linux; U; Android 2.2.1; GT-S5830L Build/FROYO)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Dalvik",
|
||||||
|
"version" : "1.2.0",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "NexPlayer",
|
||||||
|
"ua" : "E97510d/ Player/NexPlayer 4.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "NexPlayer",
|
||||||
|
"version" : "4.0",
|
||||||
|
"major" : "4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "FLRP",
|
||||||
|
"ua" : "FLRP/2.5 CFNetwork/609.1.4 Darwin/13.0.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Flip Player",
|
||||||
|
"version" : "2.5",
|
||||||
|
"major" : "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "FStream",
|
||||||
|
"ua" : "FStream",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "FStream",
|
||||||
|
"version" : "undefined",
|
||||||
|
"major" : "undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "GStreamer",
|
||||||
|
"ua" : "GStreamer souphttpsrc (compatible; LG NetCast.TV-2012) libsoup/2.34.2",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "GStreamer",
|
||||||
|
"version" : "2.34.2",
|
||||||
|
"major" : "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "GnomeMplayer",
|
||||||
|
"ua" : "GnomeMplayer/1.0.2",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "GnomeMplayer",
|
||||||
|
"version" : "1.0.2",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "HTC Streaming Player",
|
||||||
|
"ua" : "HTC Streaming Player htc_asia_wwe / 1.0 / endeavoru / 4.1.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "HTC Streaming Player",
|
||||||
|
"version" : "1.0",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "HTC One S",
|
||||||
|
"ua" : "HTC_One_S/3.16.111.10",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "HTC One S",
|
||||||
|
"version" : "3.16.111.10",
|
||||||
|
"major" : "3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Java",
|
||||||
|
"ua" : "Java/1.4.1_04",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Java",
|
||||||
|
"version" : "1.4.1_04",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "LG Player",
|
||||||
|
"ua" : "LG Player 1.0; Android",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "LG Player",
|
||||||
|
"version" : "1.0",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "NexPlayer",
|
||||||
|
"ua" : "LG-P700/V10k-DEC-12-2012 Player/NexPlayer 4.0 for Android",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "NexPlayer",
|
||||||
|
"version" : "4.0",
|
||||||
|
"major" : "4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "LG Player",
|
||||||
|
"ua" : "LGE400/V10b Player/LG Player 1.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "LG Player",
|
||||||
|
"version" : "1.0",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Lavf",
|
||||||
|
"ua" : "Lavf52.111.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Lavf",
|
||||||
|
"version" : "52.111.0",
|
||||||
|
"major" : "52"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Lyssna",
|
||||||
|
"ua" : "Lyssna/46 CFNetwork/609.1.4 Darwin/13.0.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Lyssna",
|
||||||
|
"version" : "46",
|
||||||
|
"major" : "46"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "MPlayer",
|
||||||
|
"ua" : "MPlayer 1.1-4.2.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "MPlayer",
|
||||||
|
"version" : "1.1-4.2.1",
|
||||||
|
"major" : ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "MPlayer SVN",
|
||||||
|
"ua" : "MPlayer SVN-r33713-4.6.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "MPlayer",
|
||||||
|
"version" : "r33713-4.6.1",
|
||||||
|
"major" : "undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "MPlayer ubuntu",
|
||||||
|
"ua" : "MPlayer svn r34540 (Ubuntu), built with gcc-4.6",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "MPlayer",
|
||||||
|
"version" : "r34540",
|
||||||
|
"major" : "undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "MoC",
|
||||||
|
"ua" : "Music On Console/2.5.0-beta1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Music On Console",
|
||||||
|
"version" : "2.5.0-beta1",
|
||||||
|
"major" : "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "MPD",
|
||||||
|
"ua" : "Music Player Daemon 0.17.4",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Music Player Daemon",
|
||||||
|
"version" : "0.17.4",
|
||||||
|
"major" : "0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "NSPlayer",
|
||||||
|
"ua" : "NSPlayer/11.0.5358.4827 WMFSDK/11.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "NSPlayer",
|
||||||
|
"version" : "11.0.5358.4827",
|
||||||
|
"major" : "11"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Nero Home",
|
||||||
|
"ua" : "Nero Home/1.5.3.0 (compatible; Nero AG; Nero Home 1.5.3.0)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Nero Home",
|
||||||
|
"version" : "1.5.3.0",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "NexPlayer",
|
||||||
|
"ua" : "NexPlayer 4.0 for Android( stagefright alternative )",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "NexPlayer",
|
||||||
|
"version" : "4.0",
|
||||||
|
"major" : "4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Nokia3xx",
|
||||||
|
"ua" : "Nokia303/14.87 CLDC-1.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Nokia303",
|
||||||
|
"version" : "14.87",
|
||||||
|
"major" : "14"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "MPlayer SVN Sherpya",
|
||||||
|
"ua" : "MPlayer Sherpya-SVN-r33124-4.2.5",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "MPlayer",
|
||||||
|
"version" : "r33124-4.2.5",
|
||||||
|
"major" : "undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Philips Songbird",
|
||||||
|
"ua" : "NotMoz/5.0 (Windows; U; Windows NT 5.1; it; rv:1.9.2.3) Gecko/20101207 Philips-Songbird/5.4.1980 Songbird/1.9.4 (20110302030555)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Songbird",
|
||||||
|
"version" : "1.9.4",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Ossproxy",
|
||||||
|
"ua" : "OSSProxy 1.3.336.320 (Build 336.320 Win32 en-us)(Aug 16 2013 17:38:43)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "OSSProxy",
|
||||||
|
"version" : "1.3.336.320",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Winamp3",
|
||||||
|
"ua" : "Nullsoft Winamp3 version 3.0 (compatible)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Winamp",
|
||||||
|
"version" : "3.0",
|
||||||
|
"major" : "3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "PSP",
|
||||||
|
"ua" : "PSP-InternetRadioPlayer/1.00",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "PSP-InternetRadioPlayer",
|
||||||
|
"version" : "1.00",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "urllib",
|
||||||
|
"ua" : "Python-urllib/2.7",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Python-urllib",
|
||||||
|
"version" : "2.7",
|
||||||
|
"major" : "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "QuickTime",
|
||||||
|
"ua" : "QuickTime/7.5.6 (qtver=7.5.6;cpu=IA32;os=Mac 10.5.8)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "QuickTime",
|
||||||
|
"version" : "7.5.6",
|
||||||
|
"major" : "7"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "RMA",
|
||||||
|
"ua" : "RMA/1.0 (compatible; RealMedia)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "RMA",
|
||||||
|
"version" : "1.0",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "RadioApp",
|
||||||
|
"ua" : "RadioApp/1.0 CFNetwork/609.1.4 Darwin/11.4.2",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "RadioApp",
|
||||||
|
"version" : "1.0",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "RadioClientApplication",
|
||||||
|
"ua" : "RadioClientApplication/20 CFNetwork/609.1.4 Darwin/13.0.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "RadioClientApplication",
|
||||||
|
"version" : "20",
|
||||||
|
"major" : "undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "stagefright",
|
||||||
|
"ua" : "Samsung GT-I9070 stagefright/1.1 (Linux;Android 2.3.6)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "stagefright",
|
||||||
|
"version" : "1.1",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Soundtap",
|
||||||
|
"ua" : "Soundtap/1.2.4 CFNetwork/672.0.2 Darwin/14.0.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Soundtap",
|
||||||
|
"version" : "1.2.4",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Streamium",
|
||||||
|
"ua" : "Streamium/1.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Streamium",
|
||||||
|
"version" : "1.0",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Totem",
|
||||||
|
"ua" : "Totem/3.0.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Totem",
|
||||||
|
"version" : "3.0.1",
|
||||||
|
"major" : "3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "VLC",
|
||||||
|
"ua" : "VLC media player - version 0.8.6c Janus - (c) 1996-2007 the VideoLAN team",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "VLC",
|
||||||
|
"version" : "0.8.6c",
|
||||||
|
"major" : "0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "VLC",
|
||||||
|
"ua" : "VLC/2.0.0 LibVLC/2.0.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "VLC",
|
||||||
|
"version" : "2.0.0",
|
||||||
|
"major" : "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Videos",
|
||||||
|
"ua" : "Videos/3.8.2",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Video",
|
||||||
|
"version" : "3.8.2",
|
||||||
|
"major" : "3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Wget",
|
||||||
|
"ua" : "Wget/1.12 (darwin10.7.0)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Wget",
|
||||||
|
"version" : "1.12",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Winamp",
|
||||||
|
"ua" : "Winamp 2.81",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Winamp",
|
||||||
|
"version" : "2.81",
|
||||||
|
"major" : "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Winamp",
|
||||||
|
"ua" : "WinampMPEG/2.00",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Winamp",
|
||||||
|
"version" : "2.00",
|
||||||
|
"major" : "2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Windows Media Player",
|
||||||
|
"ua" : "Windows-Media-Player/10.00.00.4019",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Windows Media Player",
|
||||||
|
"version" : "10.00.00.4019",
|
||||||
|
"major" : "10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "XBMC",
|
||||||
|
"ua" : "XBMC/12.0 Git:20130127-fb595f2 (Windows NT 6.1;WOW64;Win64;x64; http://www.xbmc.org)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "XBMC",
|
||||||
|
"version" : "12.0",
|
||||||
|
"major" : "12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "rad.io",
|
||||||
|
"ua" : "rad.io 1.18.1 rv:593 (iPhone 4S; iPhone OS 7.0.4; it_IT)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "rad.io",
|
||||||
|
"version" : "1.18.1",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "BE-Test",
|
||||||
|
"ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "BE Test",
|
||||||
|
"version" : "1.0",
|
||||||
|
"major" : "1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|||||||
122
test/cpu-test.json
Normal file
122
test/cpu-test.json
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"desc" : "i686",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:19.0) Gecko/20100101 Firefox/19.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "ia32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "i386",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7) Gecko/20040628 Epiphany/1.2.6",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "ia32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "x86-64",
|
||||||
|
"ua" : "Opera/9.80 (X11; Linux x86_64; U; Linux Mint; en) Presto/2.2.15 Version/10.10",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "amd64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "win64",
|
||||||
|
"ua" : "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; Win64; x64; Trident/6.0; .NET4.0E; .NET4.0C)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "amd64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "WOW64",
|
||||||
|
"ua" : "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "amd64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "ARMv6",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; U; Linux armv61; en-US; rv:1.9.1b2pre) Gecko/20081015 Fennec/1.0a1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "arm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Pocket PC",
|
||||||
|
"ua" : "Opera/9.7 (Windows Mobile; PPC; Opera Mobi/35166; U; en) Presto/2.2.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "arm"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Mac PowerPC",
|
||||||
|
"ua" : "Mozilla/4.0 (compatible; MSIE 4.5; Mac_PowerPC)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "ppc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Mac PowerPC",
|
||||||
|
"ua" : "Mozilla/4.0 (compatible; MSIE 5.17; Mac_PowerPC Mac OS; en)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "ppc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Mac PowerPC",
|
||||||
|
"ua" : "iCab/2.9.5 (Macintosh; U; PPC; Mac OS X)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "ppc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "UltraSPARC",
|
||||||
|
"ua" : "Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "sparc"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "QuickTime",
|
||||||
|
"ua" : "QuickTime/7.5.6 (qtver=7.5.6;cpu=IA32;os=Mac 10.5.8)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "ia32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "XBMC",
|
||||||
|
"ua" : "XBMC/12.0 Git:20130127-fb595f2 (Windows NT 6.1;WOW64;Win64;x64; http://www.xbmc.org)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "amd64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "KTB iPad",
|
||||||
|
"ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "KTB-Nexus 5",
|
||||||
|
"ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"architecture" : "undefined"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -18,4 +18,225 @@
|
|||||||
"model" : "Nexus 4",
|
"model" : "Nexus 4",
|
||||||
"type" : "mobile"
|
"type" : "mobile"
|
||||||
}
|
}
|
||||||
}]
|
},
|
||||||
|
{
|
||||||
|
"desc" : "LG Nexus 5",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "LG",
|
||||||
|
"model" : "Nexus 5",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Motorola Droid RAZR 4G",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; U; Android 2.3; xx-xx; DROID RAZR 4G Build/6.5.1-73_DHD-11_M1-29) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Motorola",
|
||||||
|
"model" : "DROID RAZR 4G",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "iPhone",
|
||||||
|
"ua" : "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Apple",
|
||||||
|
"model" : "iPhone",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Motorola Droid RAZR 4G",
|
||||||
|
"ua" : "Mozilla/5.0 (iPod touch; CPU iPhone OS 7_0_2 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A501 Safari/9537.53",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Apple",
|
||||||
|
"model" : "iPod touch",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "AppleCoreMedia",
|
||||||
|
"ua" : "AppleCoreMedia/1.0.0.10A403 (iPad; U; CPU OS 6_0 like Mac OS X; it_it)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Apple",
|
||||||
|
"model" : "iPad",
|
||||||
|
"type" : "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "AppleTV",
|
||||||
|
"ua" : "AppleTV/3.0.2 (Macintosh; Intel Mac OS X 10.4.7) AppleWebKit/528.18",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Apple",
|
||||||
|
"model" : "Apple TV",
|
||||||
|
"type" : "undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "AppleTV",
|
||||||
|
"ua" : "AppleCoreMedia/1.0.0.11B511d (Apple TV; U; CPU OS 7_0_3 like Mac OS X; es_es)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Apple",
|
||||||
|
"model" : "Apple TV",
|
||||||
|
"type" : "undefined"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Dalvik",
|
||||||
|
"ua" : "Dalvik/1.2.0 (Linux; U; Android 2.2.1; GT-S5830L Build/FROYO)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Samsung",
|
||||||
|
"model" : "GT-S5830L",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "GStreamer",
|
||||||
|
"ua" : "GStreamer souphttpsrc (compatible; LG NetCast.TV-2012) libsoup/2.34.2",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "LG",
|
||||||
|
"model" : "undefined",
|
||||||
|
"type" : "smarttv"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "HTC Streaming Player",
|
||||||
|
"ua" : "HTC Streaming Player htc_asia_wwe / 1.0 / endeavoru / 4.1.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "HTC",
|
||||||
|
"model" : "undefined",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "HTC One S",
|
||||||
|
"ua" : "HTC_One_S/3.16.111.10",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "HTC",
|
||||||
|
"model" : "One S",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "LG Player",
|
||||||
|
"ua" : "LG Player 1.0; Android",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "LG",
|
||||||
|
"model" : "undefined",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "NexPlayer",
|
||||||
|
"ua" : "LG-P700/V10k-DEC-12-2012 Player/NexPlayer 4.0 for Android",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "LG",
|
||||||
|
"model" : "P700",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "LG Player",
|
||||||
|
"ua" : "LGE400/V10b Player/LG Player 1.0",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "LG",
|
||||||
|
"model" : "E400",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Nokia3xx",
|
||||||
|
"ua" : "Nokia303/14.87 CLDC-1.1",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Nokia",
|
||||||
|
"model" : "303",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "KTB-iPhone",
|
||||||
|
"ua" : "APP-BE/1.0 (iPhone; Apple; CPU iPhone OS 7_0 like Mac OS X)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Apple",
|
||||||
|
"model" : "iPhone",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "stagefright",
|
||||||
|
"ua" : "Samsung GT-I9070 stagefright/1.1 (Linux;Android 2.3.6)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Samsung",
|
||||||
|
"model" : "GT-I9070",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "KTB-iPod Touch",
|
||||||
|
"ua" : "APP-BE/1.0 (iPod touch; Apple; CPU iPhone OS 7_0_2 like Mac OS X)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Apple",
|
||||||
|
"model" : "iPod touch",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "rad.io",
|
||||||
|
"ua" : "rad.io 1.18.1 rv:593 (iPhone 4S; iPhone OS 7.0.4; it_IT)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Apple",
|
||||||
|
"model" : "iPhone 4S",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "Kindle Fire HD",
|
||||||
|
"ua" : "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; KFTT Build/IML74K) AppleWebKit/535.19 (KHTML, like Gecko) Silk/3.4 Mobile Safari/535.19 Silk-Accelerated=true",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Amazon",
|
||||||
|
"model" : "KFTT",
|
||||||
|
"type" : "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "KTB-iPad",
|
||||||
|
"ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "Apple",
|
||||||
|
"model" : "iPad",
|
||||||
|
"type" : "tablet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "KTB-Nexus 5",
|
||||||
|
"ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"vendor" : "LG",
|
||||||
|
"model" : "Nexus 5",
|
||||||
|
"type" : "mobile"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|||||||
@@ -61,4 +61,24 @@
|
|||||||
"name" : "WebKit",
|
"name" : "WebKit",
|
||||||
"version" : "533.19.4"
|
"version" : "533.19.4"
|
||||||
}
|
}
|
||||||
}]
|
},
|
||||||
|
{
|
||||||
|
"desc" : "KTA Mobile App",
|
||||||
|
"ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Mobile-App",
|
||||||
|
"version" : "1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "KTB-Nexus 5",
|
||||||
|
"ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Mobile-App",
|
||||||
|
"version" : "1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|||||||
@@ -469,11 +469,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"desc" : "Mac OS",
|
"desc" : "Mac OS",
|
||||||
"ua" : "",
|
"ua" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36",
|
||||||
"expect" :
|
"expect" :
|
||||||
{
|
{
|
||||||
"name" : "",
|
"name" : "Mac OS X",
|
||||||
"version" : ""
|
"version" : "10.6.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -557,6 +557,15 @@
|
|||||||
"version" : ""
|
"version" : ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"desc" : "iTunes Windows Vista",
|
||||||
|
"ua" : "iTunes/10.7 (Windows; Microsoft Windows Vista Home Premium Edition Service Pack 1 (Build 6001)) AppleWebKit/536.26.9",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Windows",
|
||||||
|
"version" : "Vista"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"desc" : "",
|
"desc" : "",
|
||||||
"ua" : "",
|
"ua" : "",
|
||||||
@@ -565,4 +574,23 @@
|
|||||||
"name" : "",
|
"name" : "",
|
||||||
"version" : ""
|
"version" : ""
|
||||||
}
|
}
|
||||||
}]
|
},
|
||||||
|
{
|
||||||
|
"desc" : "iOS BE App",
|
||||||
|
"ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "iOS",
|
||||||
|
"version" : "7.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"desc" : "KTB-Nexus 5",
|
||||||
|
"ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)",
|
||||||
|
"expect" :
|
||||||
|
{
|
||||||
|
"name" : "Android",
|
||||||
|
"version" : "4.2.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|||||||
15
test/test.js
15
test/test.js
@@ -1,6 +1,7 @@
|
|||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var UAParser = require('./../src/ua-parser');
|
var UAParser = require('./../src/ua-parser');
|
||||||
var browsers = require('./browser-test.json');
|
var browsers = require('./browser-test.json');
|
||||||
|
var cpus = require('./cpu-test.json');
|
||||||
var devices = require('./device-test.json');
|
var devices = require('./device-test.json');
|
||||||
var engines = require('./engine-test.json');
|
var engines = require('./engine-test.json');
|
||||||
var os = require('./os-test.json');
|
var os = require('./os-test.json');
|
||||||
@@ -12,6 +13,12 @@ var methods = [
|
|||||||
list : browsers,
|
list : browsers,
|
||||||
properties : ['name', 'major', 'version']
|
properties : ['name', 'major', 'version']
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title : 'getCPU',
|
||||||
|
label : 'cpu',
|
||||||
|
list : cpus,
|
||||||
|
properties : ['architecture']
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title : 'getDevice',
|
title : 'getDevice',
|
||||||
label : 'device',
|
label : 'device',
|
||||||
@@ -43,13 +50,13 @@ for (var i in methods) {
|
|||||||
describe('[' + methods[i]['list'][j].desc + ']', function () {
|
describe('[' + methods[i]['list'][j].desc + ']', function () {
|
||||||
describe('"' + methods[i]['list'][j].ua + '"', function () {
|
describe('"' + methods[i]['list'][j].ua + '"', function () {
|
||||||
var expect = methods[i]['list'][j].expect;
|
var expect = methods[i]['list'][j].expect;
|
||||||
var result = parser.setUA(methods[i]['list'][j].ua).getResult()[methods[i]['label']];
|
var result = parser.setUA(methods[i]['list'][j].ua).getResult()[methods[i]['label']];
|
||||||
for (var k in methods[i]['properties']) {
|
|
||||||
var m = methods[i]['properties'][k];
|
methods[i]['properties'].forEach(function(m) {
|
||||||
it('should return ' + methods[i]['label'] + ' ' + m + ': ' + expect[m], function () {
|
it('should return ' + methods[i]['label'] + ' ' + m + ': ' + expect[m], function () {
|
||||||
assert.equal(result[m], expect[m] != 'undefined' ? expect[m] : undefined);
|
assert.equal(result[m], expect[m] != 'undefined' ? expect[m] : undefined);
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,32 @@
|
|||||||
{
|
{
|
||||||
"title": "UAParser.js",
|
"title": "UAParser.js",
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "0.5.25",
|
"version": "0.7.0",
|
||||||
"description": "Lightweight JavaScript-based user-agent string parser",
|
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"user-agent",
|
"user-agent",
|
||||||
"parser",
|
"parser",
|
||||||
"browser",
|
"browser",
|
||||||
"engine",
|
"engine",
|
||||||
"os",
|
"os",
|
||||||
"device"
|
"device",
|
||||||
],
|
"cpu"
|
||||||
"homepage": "https://faisalman.github.com/ua-parser-js",
|
],
|
||||||
"author": {
|
"homepage": "https://faisalman.github.com/ua-parser-js",
|
||||||
"name": "Faisal Salman",
|
"author": {
|
||||||
"email": "fyzlman@gmail.com"
|
"name": "Faisal Salman",
|
||||||
},
|
"email": "fyzlman@gmail.com"
|
||||||
"dependencies": {
|
},
|
||||||
"jquery": ">=1.5"
|
"dependencies": {
|
||||||
},
|
"jquery": ">=1.5"
|
||||||
"licenses": [
|
},
|
||||||
{
|
"licenses": [
|
||||||
"type": "MIT",
|
{
|
||||||
"url": "http://www.opensource.org/licenses/mit-license.php"
|
"type": "MIT",
|
||||||
}
|
"url": "http://www.opensource.org/licenses/mit-license.php"
|
||||||
],
|
}
|
||||||
"bugs": "https://github.com/faisalman/ua-parser-js/issues",
|
],
|
||||||
"docs": "https://github.com/faisalman/ua-parser-js",
|
"bugs": "https://github.com/faisalman/ua-parser-js/issues",
|
||||||
"download": "https://raw.github.com/faisalman/ua-parser-js/master/src/ua-parser.min.js"
|
"docs": "https://github.com/faisalman/ua-parser-js",
|
||||||
}
|
"download": "https://raw.github.com/faisalman/ua-parser-js/master/src/ua-parser.min.js"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user