Compare commits

..

1 Commits

Author SHA1 Message Date
Faisal Salman
a21b0f2294 Increment minor version 2014-06-25 14:05:58 +07:00
18 changed files with 886 additions and 1505 deletions

3
.gitignore vendored
View File

@@ -1,5 +1,6 @@
node_modules/ node_modules/
npm-debug.log npm-debug.log
<<<<<<< HEAD
### vim ### ### vim ###
.*.s[a-w][a-z] .*.s[a-w][a-z]
*.un~ *.un~
@@ -20,4 +21,6 @@ Icon
# Files that might appear on external disk # Files that might appear on external disk
.Spotlight-V100 .Spotlight-V100
.Trashes .Trashes
=======
.idea .idea
>>>>>>> baf4bb99b4ef92c71419931e8fd334e34c051e52

View File

@@ -1,5 +1,6 @@
language: node_js language: node_js
node_js: node_js:
- "0.10" - 0.8
- 0.6
notifications: notifications:
email: false email: false

View File

@@ -1,6 +1,6 @@
{ {
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "0.7.3", "version": "0.7.0",
"authors": [ "authors": [
"Faisal Salman <fyzlman@gmail.com>" "Faisal Salman <fyzlman@gmail.com>"
], ],
@@ -16,26 +16,20 @@
"contributors": [ "contributors": [
"Faisal Salman <fyzlman@gmail.com>", "Faisal Salman <fyzlman@gmail.com>",
"Benjamin Bertrand <bertrand.design@gmail.com>", "Benjamin Bertrand <bertrand.design@gmail.com>",
"Carl C Von Lewin <carlchristianlewin@gmail.com>",
"Christopher De Cairos <chris.decairos@gmail.com>", "Christopher De Cairos <chris.decairos@gmail.com>",
"Davit Barbakadze <jayarjo@gmail.com>", "Davit Barbakadze <jayarjo@gmail.com>",
"Dmitry Tyschenko <dtyschenko@gmail.com>", "Dmitry Tyschenko <dtyschenko@gmail.com>",
"Douglas Li <doug@knotch.it>", "Douglas Li <doug@knotch.it>",
"Dumitru Uzun <duzun@mail.ru>",
"Erik Hesselink <hesselink@gmail.com>", "Erik Hesselink <hesselink@gmail.com>",
"Fabian Becker <halfdan@xnorfz.de>", "Fabian Becker <halfdan@xnorfz.de>",
"Hendrik Helwich <h.helwich@iplabs.de>",
"Jackpoll <jackpoll123456@gmail.com>", "Jackpoll <jackpoll123456@gmail.com>",
"Jake Mc <startswithaj@users.noreply.github.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>", "John Yanarella <jmy@codecatalyst.com>",
"Jon Buckley <jon@jbuckley.ca>", "Jon Buckley <jon@jbuckley.ca>",
"Kendall Buchanan <kendall@kendagriff.com>",
"Lee Treveil <leetreveil@gmail.com>", "Lee Treveil <leetreveil@gmail.com>",
"Leonardo <leofiore@libero.it>", "Leonardo <leofiore@libero.it>",
"Max Maurer <maxemanuel.maurer@gmail.com>",
"Michael Hess <mhess@connectify.me>", "Michael Hess <mhess@connectify.me>",
"OtakuSiD <otakusid@gmail.com>",
"Ross Noble <rosshnoble@gmail.com>", "Ross Noble <rosshnoble@gmail.com>",
"Sandro Sonntag <sandro.sonntag@adorsys.de>" "Sandro Sonntag <sandro.sonntag@adorsys.de>"
], ],

View File

@@ -33,5 +33,5 @@ echo "Running test..."
$MOCHA_DIR -R nyan test/test.js $MOCHA_DIR -R nyan test/test.js
echo "Minifying script..." echo "Minifying script..."
$UGLIFY_DIR src/ua-parser.js > dist/ua-parser.min.js --comments '/UAParser\.js/' $UGLIFY_DIR src/ua-parser.js > src/ua-parser.min.js
echo "OK" echo "OK"

View File

@@ -1,6 +1,6 @@
{ {
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "0.7.3", "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", "cpu"], "keywords": ["user-agent", "parser", "browser", "engine", "os", "device", "cpu"],
"scripts": ["src/ua-parser.js"], "scripts": ["src/ua-parser.js"],

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{ {
"title": "UAParser.js", "title": "UAParser.js",
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "0.7.3", "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": [
@@ -17,26 +17,20 @@
"contributors": [ "contributors": [
"Faisal Salman <fyzlman@gmail.com>", "Faisal Salman <fyzlman@gmail.com>",
"Benjamin Bertrand <bertrand.design@gmail.com>", "Benjamin Bertrand <bertrand.design@gmail.com>",
"Carl C Von Lewin <carlchristianlewin@gmail.com>",
"Christopher De Cairos <chris.decairos@gmail.com>", "Christopher De Cairos <chris.decairos@gmail.com>",
"Davit Barbakadze <jayarjo@gmail.com>", "Davit Barbakadze <jayarjo@gmail.com>",
"Dmitry Tyschenko <dtyschenko@gmail.com>", "Dmitry Tyschenko <dtyschenko@gmail.com>",
"Douglas Li <doug@knotch.it>", "Douglas Li <doug@knotch.it>",
"Dumitru Uzun <duzun@mail.ru>",
"Erik Hesselink <hesselink@gmail.com>", "Erik Hesselink <hesselink@gmail.com>",
"Fabian Becker <halfdan@xnorfz.de>", "Fabian Becker <halfdan@xnorfz.de>",
"Hendrik Helwich <h.helwich@iplabs.de>",
"Jackpoll <jackpoll123456@gmail.com>", "Jackpoll <jackpoll123456@gmail.com>",
"Jake Mc <startswithaj@users.noreply.github.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>", "John Yanarella <jmy@codecatalyst.com>",
"Jon Buckley <jon@jbuckley.ca>", "Jon Buckley <jon@jbuckley.ca>",
"Kendall Buchanan <kendall@kendagriff.com>",
"Lee Treveil <leetreveil@gmail.com>", "Lee Treveil <leetreveil@gmail.com>",
"Leonardo <leofiore@libero.it>", "Leonardo <leofiore@libero.it>",
"Max Maurer <maxemanuel.maurer@gmail.com>",
"Michael Hess <mhess@connectify.me>", "Michael Hess <mhess@connectify.me>",
"OtakuSiD <otakusid@gmail.com>",
"Ross Noble <rosshnoble@gmail.com>", "Ross Noble <rosshnoble@gmail.com>",
"Sandro Sonntag <sandro.sonntag@adorsys.de>" "Sandro Sonntag <sandro.sonntag@adorsys.de>"
], ],
@@ -46,7 +40,7 @@
}, },
"devDependencies": { "devDependencies": {
"jshint": "~1.1.0", "jshint": "~1.1.0",
"mocha": "~1.8.0", "mocha": "~1.7.1",
"uglify-js": "~1.3.4" "uglify-js": "~1.3.4"
}, },
"repository" : { "repository" : {
@@ -67,8 +61,7 @@
"node": "*" "node": "*"
}, },
"directories": { "directories": {
"dist": "dist", "lib": "src",
"src": "src",
"test": "test" "test": "test"
} }
} }

View File

@@ -1,16 +1,16 @@
# UAParser.js # UAParser.js
Lightweight JavaScript-based User-Agent string parser. Supports browser & node.js environment. Also available as jQuery/Zepto plugin, Component package, Bower package, & AMD module Lightweight JavaScript-based User-Agent string parser. Supports browser & node.js environment. Also available as Component package, Bower package, jQuery.ua, & AMD module
[![Build Status](https://travis-ci.org/faisalman/ua-parser-js.svg?branch=master)](https://travis-ci.org/faisalman/ua-parser-js) [![Build Status](https://travis-ci.org/faisalman/ua-parser-js.png?branch=master)](https://travis-ci.org/faisalman/ua-parser-js)
* Author : Faisal Salman <<fyzlman@gmail.com>> * Author : Faisalman <<fyzlman@gmail.com>>
* Demo : http://faisalman.github.io/ua-parser-js * Demo : http://faisalman.github.com/ua-parser-js
* Source : https://github.com/faisalman/ua-parser-js * Source : https://github.com/faisalman/ua-parser-js
## Features ## Features
Extract detailed type of web browser, layout engine, operating system, cpu architecture, and device type/model purely from user-agent string with relatively lightweight footprint (~11KB minified / ~4KB 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.
![It's over 9000](https://pbs.twimg.com/media/A9LpEG6CIAA5VrT.jpg) ![It's over 9000](https://pbs.twimg.com/media/A9LpEG6CIAA5VrT.jpg)
@@ -38,13 +38,12 @@ Tizen, UCBrowser, w3m, Yandex
``` ```
# Possible 'device.type': # Possible 'device.type':
console, mobile, tablet, smarttv, wearable, embedded console, mobile, tablet
# Possible 'device.vendor': # Possible 'device.vendor':
Acer, Alcatel, Amazon, Apple, Archos, Asus, BenQ, BlackBerry, Dell, GeeksPhone, Acer, Alcatel, Apple, Asus, BenQ, BlackBerry, Dell, GeeksPhone, HP, HTC, Huawei,
Google, HP, HTC, Huawei, Jolla, Lenovo, LG, Meizu, Microsoft, Motorola, Nexian, Lenovo, LG, Meizu, Motorola, Nexian, Nintendo, Nokia, Palm, Panasonic,
Nintendo, Nokia, Nvidia, Ouya, Palm, Panasonic, Polytron, RIM, Samsung, Sharp, RIM, Samsung, Siemens, Sony-Ericsson, Sprint, ZTE
Siemens, Sony-Ericsson, Sprint, Xbox, ZTE
# 'device.model' determined dynamically # 'device.model' determined dynamically
``` ```
@@ -65,12 +64,12 @@ Trident, w3m, WebKit
``` ```
# Possible 'os.name' # Possible 'os.name'
AIX, Amiga OS, Android, Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS, Contiki, AIX, Amiga OS, Android, Arch, Bada, BeOS, BlackBerry, CentOS, Chromium OS,
Fedora, Firefox OS, FreeBSD, Debian, DragonFly, Gentoo, GNU, Haiku, Hurd, iOS, Fedora, Firefox OS, FreeBSD, Debian, DragonFly, Gentoo, GNU, Haiku, Hurd, iOS,
Joli, Linpus, Linux, Mac OS, Mageia, Mandriva, MeeGo, Minix, Mint, Morph OS, NetBSD, Joli, Linux, Mac OS, Mandriva, MeeGo, Minix, Mint, Morph OS, NetBSD, Nintendo,
Nintendo, OpenBSD, OpenVMS, OS/2, Palm, PCLinuxOS, Plan9, Playstation, QNX, RedHat, OpenBSD, OS/2, Palm, PCLinuxOS, Plan9, Playstation, QNX, RedHat, RIM Tablet OS,
RIM Tablet OS, RISC OS, Sailfish, Series40, Slackware, Solaris, SUSE, Symbian, Tizen, RISC OS, Slackware, Solaris, SUSE, Symbian, Tizen, Ubuntu, UNIX, WebOS,
Ubuntu, UNIX, VectorLinux, WebOS, Windows [Phone/Mobile], Zenwalk Windows [Phone/Mobile], Zenwalk
# 'os.version' determined dynamically # 'os.version' determined dynamically
``` ```
@@ -80,16 +79,13 @@ Ubuntu, UNIX, VectorLinux, WebOS, Windows [Phone/Mobile], Zenwalk
``` ```
# Possible 'cpu.architecture' # Possible 'cpu.architecture'
68k, amd64, arm, arm64, avr, ia32, ia64, irix, irix64, mips, mips64, pa-risc, 68k, amd64, arm, ia32, ia64, irix, irix64, mips, mips64, pa-risc, ppc, sparc, sparc64
ppc, sparc, sparc64
``` ```
* `getResult()` * `getResult()`
* returns `{ ua: '', browser: {}, cpu: {}, 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)`
* set & parse UA string * set & parse UA string
@@ -167,20 +163,6 @@ ppc, sparc, sparc64
</html> </html>
``` ```
### Extending regex patterns
* `UAParser(uastring[, extensions])`
Pass your own regexes to extend the limited matching rules.
```js
// Example:
var uaString = 'ownbrowser/1.3';
var ownBrowser = [[/(ownbrowser)\/((\d+)?[\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION, UAParser.BROWSER.MAJOR]];
var parser = new UAParser(uaString, {browser: ownBrowser});
console.log(parser.getBrowser()); // {name: "ownbrowser", major: "1", version: "1.3"}
```
### Using node.js ### Using node.js
```sh ```sh
@@ -221,9 +203,9 @@ console.log(parser.getResult());
$ bower install ua-parser-js $ bower install ua-parser-js
``` ```
### Using jQuery/Zepto ($.ua) ### Using jQuery.ua
Although written in vanilla js (which means it doesn't depends on jQuery), this library will automatically detect if jQuery/Zepto 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)`. 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':
@@ -246,20 +228,25 @@ console.log(parseInt($.ua.browser.version.split('.')[0], 10)); // 4
## Development ## Development
Install dependencies
```sh
$ npm install jshint
$ npm install mocha
$ npm install uglify-js
```
Verify, test, & minify script Verify, test, & minify script
```sh ```sh
$ npm test $ ./build/build.sh
``` ```
Then submit a pull request to https://github.com/faisalman/ua-parser-js under `develop` branch.
## License ## License
Dual licensed under GPLv2 & MIT Dual licensed under GPLv2 & MIT
Copyright © 2012-2014 Faisal Salman <<fyzlman@gmail.com>> Copyright © 2012-2013 Faisalman <<fyzlman@gmail.com>>
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in this software and associated documentation files (the "Software"), to deal in

View File

@@ -1,11 +1,9 @@
/** // UAParser.js v0.7.0
* UAParser.js v0.7.3 // 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 //
* // Copyright © 2012-2013 Faisalman <fyzlman@gmail.com>
* Copyright © 2012-2014 Faisal Salman <fyzlman@gmail.com> // Dual licensed under GPLv2 & MIT
* Dual licensed under GPLv2 & MIT
*/
(function (window, undefined) { (function (window, undefined) {
@@ -16,8 +14,7 @@
///////////// /////////////
var LIBVERSION = '0.7.3', var EMPTY = '',
EMPTY = '',
UNKNOWN = '?', UNKNOWN = '?',
FUNC_TYPE = 'function', FUNC_TYPE = 'function',
UNDEF_TYPE = 'undefined', UNDEF_TYPE = 'undefined',
@@ -32,9 +29,7 @@
CONSOLE = 'console', CONSOLE = 'console',
MOBILE = 'mobile', MOBILE = 'mobile',
TABLET = 'tablet', TABLET = 'tablet',
SMARTTV = 'smarttv', SMARTTV = 'smarttv';
WEARABLE = 'wearable',
EMBEDDED = 'embedded';
/////////// ///////////
@@ -43,14 +38,6 @@
var util = { var util = {
extend : function (regexes, extensions) {
for (var i in extensions) {
if ("browser cpu device engine os".indexOf(i) !== -1 && extensions[i].length % 2 === 0) {
regexes[i] = extensions[i].concat(regexes[i]);
}
}
return regexes;
},
has : function (str1, str2) { has : function (str1, str2) {
if (typeof str1 === "string") { if (typeof str1 === "string") {
return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1; return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
@@ -71,10 +58,8 @@
rgx : function () { rgx : function () {
var result, i = 0, j, k, p, q, matches, match, args = arguments;
// loop through all regexes maps // loop through all regexes maps
while (i < args.length && !matches) { for (var result, i = 0, j, k, p, q, matches, match, args = arguments; i < args.length; i += 2) {
var regex = args[i], // even sequence (0,2,4,..) var regex = args[i], // even sequence (0,2,4,..)
props = args[i + 1]; // odd sequence (1,3,5,..) props = args[i + 1]; // odd sequence (1,3,5,..)
@@ -93,9 +78,8 @@
} }
// try matching uastring with regexes // try matching uastring with regexes
j = k = 0; for (j = k = 0; j < regex.length; j++) {
while (j < regex.length && !matches) { matches = regex[j].exec(this.getUA());
matches = regex[j++].exec(this.getUA());
if (!!matches) { if (!!matches) {
for (p = 0; p < props.length; p++) { for (p = 0; p < props.length; p++) {
match = matches[++k]; match = matches[++k];
@@ -126,9 +110,11 @@
result[q] = match ? match : undefined; result[q] = match ? match : undefined;
} }
} }
break;
} }
} }
i += 2;
if(!!matches) break; // break the loop immediately if match found
} }
return result; return result;
}, },
@@ -180,11 +166,6 @@
}, },
device : { device : {
amazon : {
model : {
'Fire Phone' : ['SD', 'KF']
}
},
sprint : { sprint : {
model : { model : {
'Evo Shift 4G' : '7373KT' 'Evo Shift 4G' : '7373KT'
@@ -208,7 +189,6 @@
'7' : 'NT 6.1', '7' : 'NT 6.1',
'8' : 'NT 6.2', '8' : 'NT 6.2',
'8.1' : 'NT 6.3', '8.1' : 'NT 6.3',
'10' : 'NT 6.4',
'RT' : 'ARM' 'RT' : 'ARM'
} }
} }
@@ -225,6 +205,9 @@
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
@@ -261,10 +244,8 @@
/(comodo_dragon)\/((\d+)?[\w\.]+)/i // Comodo Dragon /(comodo_dragon)\/((\d+)?[\w\.]+)/i // Comodo Dragon
], [[NAME, /_/g, ' '], VERSION, MAJOR], [ ], [[NAME, /_/g, ' '], VERSION, MAJOR], [
/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i, /(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i
// Chrome/OmniWeb/Arora/Tizen/Nokia // Chrome/OmniWeb/Arora/Tizen/Nokia
/(uc\s?browser|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i
//UCBrowser/QQBrowser
], [NAME, VERSION, MAJOR], [ ], [NAME, VERSION, MAJOR], [
/(dolfin)\/((\d+)?[\w\.]+)/i // Dolphin /(dolfin)\/((\d+)?[\w\.]+)/i // Dolphin
@@ -297,19 +278,13 @@
/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla /(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla
// Other // Other
/(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,
// 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], [
/* /////////////////////
// Media players BEGIN
////////////////////////
, [
/(apple(?:coremedia|))\/((\d+)[\w\._]+)/i, // Generic Apple CoreMedia /(apple(?:coremedia|))\/((\d+)[\w\._]+)/i, // Generic Apple CoreMedia
/(coremedia) v((\d+)[\w\._]+)/i /(coremedia) v((\d+)[\w\._]+)/i
@@ -348,14 +323,14 @@
/(lavf)((\d+)[\d\.]+)/i // Lavf (FFMPEG) /(lavf)((\d+)[\d\.]+)/i // Lavf (FFMPEG)
], [NAME, VERSION, MAJOR], [ ], [NAME, VERSION, MAJOR], [
/(htc_one_s)\/((\d+)[\d\.]+)/i // HTC One S /(htc_one_s)\/((\d+)[\d\.]+)/i, // HTC One S
], [[NAME, /_/g, ' '], VERSION, MAJOR], [ ], [[NAME, /_/g, ' '], VERSION, MAJOR], [
/(mplayer)(?:\s|\/)(?:(?:sherpya-){0,1}svn)(?:-|\s)(r\d+(?:-\d+[\w\.-]+){0,1})/i /(mplayer)(?:\s|\/)(?:(?:sherpya-){0,1}svn)(?:-|\s)(r\d+(?:-\d+[\w\.-]+){0,1})/i,
// MPlayer SVN // MPlayer SVN
], [NAME, VERSION], [ ], [NAME, VERSION], [
/(mplayer)(?:\s|\/|[unkow-]+)((\d+)[\w\.-]+)/i // MPlayer /(mplayer)(?:\s|\/|[unkow-]+)((\d+)[\w\.-]+)/i, // MPlayer
], [NAME, VERSION, MAJOR], [ ], [NAME, VERSION, MAJOR], [
/(mplayer)/i, // MPlayer (no other info) /(mplayer)/i, // MPlayer (no other info)
@@ -400,7 +375,7 @@
/(windows-media-player)\/((\d+)[\w\.-]+)/i /(windows-media-player)\/((\d+)[\w\.-]+)/i
], [[NAME, /-/g, ' '], VERSION, MAJOR], [ ], [[NAME, /-/g, ' '], VERSION, MAJOR], [
/windows\/((\d+)[\w\.-]+) upnp\/[\d\.]+ dlnadoc\/[\d\.]+ (home media server)/i /windows\/((\d+)[\w\.-]+) upnp\/[\d\.]+ dlnadoc\/[\d\.]+ (home media server)/i,
// Windows Media Server // Windows Media Server
], [VERSION, MAJOR, [NAME, 'Windows']], [ ], [VERSION, MAJOR, [NAME, 'Windows']], [
@@ -411,10 +386,6 @@
/(radio.(?:de|at|fr))\s((\d+)[\d\.]+)/i /(radio.(?:de|at|fr))\s((\d+)[\d\.]+)/i
], [[NAME, 'rad.io'], VERSION, MAJOR] ], [[NAME, 'rad.io'], VERSION, MAJOR]
//////////////////////
// Media players END
////////////////////*/
], ],
cpu : [[ cpu : [[
@@ -438,9 +409,9 @@
/(sun4\w)[;\)]/i // SPARC /(sun4\w)[;\)]/i // SPARC
], [[ARCHITECTURE, 'sparc']], [ ], [[ARCHITECTURE, 'sparc']], [
/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+;))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i /(ia64(?=;)|68k(?=\))|arm(?=v\d+;)|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i
// IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC // IA64, 68K, ARM, IRIX, MIPS, SPARC, PA-RISC
], [[ARCHITECTURE, util.lowerize]] ], [ARCHITECTURE, util.lowerize]
], ],
device : [[ device : [[
@@ -454,17 +425,14 @@
/(apple\s{0,1}tv)/i // Apple TV /(apple\s{0,1}tv)/i // Apple TV
], [[MODEL, 'Apple TV'], [VENDOR, 'Apple']], [ ], [[MODEL, 'Apple TV'], [VENDOR, 'Apple']], [
/(archos)\s(gamepad2?)/i, // Archos
/(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]], [
/(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i // Kindle Fire HD /(kf[A-z]+)\sbuild\/[\w\.]+.*silk\//i, // Kindle Fire HD
], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [ ], [MODEL, [VENDOR, 'Amazon'], [TYPE, TABLET]], [
/(sd|kf)[0349hijorstuw]+\sbuild\/[\w\.]+.*silk\//i // Fire Phone
], [[MODEL, mapper.str, maps.device.amazon.model], [VENDOR, 'Amazon'], [TYPE, MOBILE]], [
/\((ip[honed|\s\w*]+);.+(apple)/i // iPod/iPhone /\((ip[honed|\s\w*]+);.+(apple)/i // iPod/iPhone
], [MODEL, VENDOR, [TYPE, MOBILE]], [ ], [MODEL, VENDOR, [TYPE, MOBILE]], [
@@ -472,100 +440,76 @@
], [MODEL, [VENDOR, 'Apple'], [TYPE, MOBILE]], [ ], [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|polytron)[\s_-]?([\w-]+)*/i, /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|huawei|meizu|motorola)[\s_-]?([\w-]+)*/i,
// BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Huawei/Meizu/Motorola/Polytron // BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Huawei/Meizu/Motorola
/(hp)\s([\w\s]+\w)/i, // HP iPAQ /(hp)\s([\w\s]+\w)/i, // HP iPAQ
/(asus)-?(\w+)/i // Asus /(asus)-?(\w+)/i // Asus
], [VENDOR, MODEL, [TYPE, MOBILE]], [ ], [VENDOR, MODEL, [TYPE, MOBILE]], [
/\(bb10;\s(\w+)/i // BlackBerry 10 /\((bb10);\s(\w+)/i // BlackBerry 10
], [MODEL, [VENDOR, 'BlackBerry'], [TYPE, MOBILE]], [ ], [[VENDOR, 'BlackBerry'], MODEL, [TYPE, MOBILE]], [
// Asus Tablets // Asus Tablets
/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7)/i /android.+((transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7))/i
], [MODEL, [VENDOR, 'Asus'], [TYPE, TABLET]], [ ], [[VENDOR, 'Asus'], MODEL, [TYPE, TABLET]], [
/(sony)\s(tablet\s[ps])/i // Sony Tablets /(sony)\s(tablet\s[ps])/i // Sony Tablets
], [VENDOR, MODEL, [TYPE, TABLET]], [ ], [VENDOR, MODEL, [TYPE, TABLET]], [
/\s(ouya)\s/i, // Ouya
/(nintendo)\s([wids3u]+)/i // Nintendo /(nintendo)\s([wids3u]+)/i // Nintendo
], [VENDOR, MODEL, [TYPE, CONSOLE]], [ ], [VENDOR, MODEL, [TYPE, CONSOLE]], [
/android.+;\s(shield)\sbuild/i // Nvidia /((playstation)\s[3portablevi]+)/i // Playstation
], [MODEL, [VENDOR, 'Nvidia'], [TYPE, CONSOLE]], [ ], [[VENDOR, 'Sony'], MODEL, [TYPE, CONSOLE]], [
/(playstation\s[3portablevi]+)/i // Playstation
], [MODEL, [VENDOR, 'Sony'], [TYPE, CONSOLE]], [
/(sprint\s(\w+))/i // Sprint Phones /(sprint\s(\w+))/i // Sprint Phones
], [[VENDOR, mapper.str, maps.device.sprint.vendor], [MODEL, mapper.str, maps.device.sprint.model], [TYPE, MOBILE]], [ ], [[VENDOR, mapper.str, maps.device.sprint.vendor], [MODEL, mapper.str, maps.device.sprint.model], [TYPE, MOBILE]], [
/(lenovo)\s?(S(?:5000|6000)+(?:[-][\w+]))/i // Lenovo tablets
], [VENDOR, MODEL, [TYPE, TABLET]], [
/(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|(?=;\s)sony)[_\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\(;](xbox(?:\sone)?)[\s\);]/i // Microsoft Xbox
], [MODEL, [VENDOR, 'Microsoft'], [TYPE, CONSOLE]], [
/(kin\.[onetw]{3})/i // Microsoft Kin
], [[MODEL, /\./g, ' '], [VENDOR, 'Microsoft'], [TYPE, MOBILE]], [
// Motorola // Motorola
/\s((milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?(:?\s4g)?))[\w\s]+build\//i, /\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
], [MODEL, [VENDOR, 'Motorola'], [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|nexus 10))/i, /android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n8000|sgh-t8[56]9|nexus 10))/i
/((SM-T\w+))/i
], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [ // Samsung ], [[VENDOR, 'Samsung'], MODEL, [TYPE, TABLET]], [ // Samsung
/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-n900))/i, /((s[cgp]h-\w+|gt-\w+|galaxy\snexus))/i,
/(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i, /(sam[sung]*)[\s-]*(\w+-?[\w-]*)*/i,
/sec-((sgh\w+))/i /sec-((sgh\w+))/i
], [[VENDOR, 'Samsung'], MODEL, [TYPE, MOBILE]], [ ], [[VENDOR, 'Samsung'], MODEL, [TYPE, MOBILE]], [
/(samsung);smarttv/i /(sie)-(\w+)*/i // Siemens
], [VENDOR, MODEL, [TYPE, SMARTTV]], [ ], [[VENDOR, 'Siemens'], MODEL, [TYPE, MOBILE]], [
/\(dtv[\);].+(aquos)/i // Sharp
], [MODEL, [VENDOR, 'Sharp'], [TYPE, SMARTTV]], [
/sie-(\w+)*/i // Siemens
], [MODEL, [VENDOR, 'Siemens'], [TYPE, MOBILE]], [
/(maemo|nokia).*(n900|lumia\s\d+)/i, // Nokia /(maemo|nokia).*(n900|lumia\s\d+)/i, // Nokia
/(nokia)[\s_-]?([\w-]+)*/i /(nokia)[\s_-]?([\w-]+)*/i
], [[VENDOR, 'Nokia'], MODEL, [TYPE, MOBILE]], [ ], [[VENDOR, 'Nokia'], MODEL, [TYPE, MOBILE]], [
/android\s3\.[\s\w-;]{10}(a\d{3})/i // Acer /android\s3\.[\s\w-;]{10}((a\d{3}))/i // Acer
], [MODEL, [VENDOR, 'Acer'], [TYPE, TABLET]], [ ], [[VENDOR, 'Acer'], MODEL, [TYPE, TABLET]], [
/android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i // LG Tablet /android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i // LG Tablet
], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [ ], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [
/(lg) netcast\.tv/i // LG SmartTV /(lg) netcast\.tv/i // LG SmartTV
], [VENDOR, MODEL, [TYPE, SMARTTV]], [ ], [VENDOR, [TYPE, SMARTTV]], [
/(nexus\s[45])/i, // LG /((nexus\s[45]))/i, // LG
/lg[e;\s\/-]+(\w+)*/i /(lg)[e;\s-\/]+(\w+)*/i
], [MODEL, [VENDOR, 'LG'], [TYPE, MOBILE]], [ ], [[VENDOR, 'LG'], MODEL, [TYPE, MOBILE]], [
/android.+(ideatab[a-z0-9\-\s]+)/i // Lenovo /android.+((ideatab[a-z0-9\-\s]+))/i // Lenovo
], [MODEL, [VENDOR, 'Lenovo'], [TYPE, TABLET]], [ ], [[VENDOR, 'Lenovo'], MODEL, [TYPE, TABLET]], [
/linux;.+((jolla));/i // Jolla
], [VENDOR, MODEL, [TYPE, MOBILE]], [
/((pebble))app\/[\d\.]+\s/i // Pebble
], [VENDOR, MODEL, [TYPE, WEARABLE]], [
/android.+;\s(glass)\s\d/i // Google Glass
], [MODEL, [VENDOR, 'Google'], [TYPE, WEARABLE]], [
/(mobile|tablet);.+rv\:.+gecko\//i // Unidentifiable /(mobile|tablet);.+rv\:.+gecko\//i // Unidentifiable
], [[TYPE, util.lowerize], 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
@@ -580,7 +524,7 @@
os : [[ os : [[
// Windows based // Windows based
/microsoft\s(windows)\s(vista|xp)/i // Windows (iTunes) /microsoft\s(windows)\s(vista|xp)/i, // Windows (iTunes)
], [NAME, VERSION], [ ], [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
@@ -592,15 +536,12 @@
/\((bb)(10);/i // BlackBerry 10 /\((bb)(10);/i // BlackBerry 10
], [[NAME, 'BlackBerry'], VERSION], [ ], [[NAME, 'BlackBerry'], VERSION], [
/(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry /(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry
/(tizen)[\/\s]([\w\.]+)/i, // Tizen /(tizen)\/([\w\.]+)/i, // Tizen
/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego|contiki)[\/\s-]?([\w\.]+)*/i, /(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i
// Android/WebOS/Palm/QNX/Bada/RIM/MeeGo/Contiki // Android/WebOS/Palm/QNX/Bada/RIM/MeeGo
/linux;.+(sailfish);/i // Sailfish OS
], [NAME, VERSION], [ ], [NAME, VERSION], [
/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian /(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian
], [[NAME, 'Symbian'], VERSION], [ ], [[NAME, 'Symbian'], VERSION],[
/\((series40);/i // Series 40
], [NAME], [
/mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS /mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS
], [[NAME, 'Firefox OS'], VERSION], [ ], [[NAME, 'Firefox OS'], VERSION], [
@@ -609,10 +550,9 @@
// GNU/Linux based // GNU/Linux based
/(mint)[\/\s\(]?(\w+)*/i, // Mint /(mint)[\/\s\(]?(\w+)*/i, // Mint
/(mageia|vectorlinux)[;\s]/i, // Mageia/VectorLinux /(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,
/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?([\w\.-]+)*/i,
// Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware // Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware
// Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus // Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk
/(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux /(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux
/(gnu)\s?([\w\.]+)*/i // GNU /(gnu)\s?([\w\.]+)*/i // GNU
], [NAME, VERSION], [ ], [NAME, VERSION], [
@@ -631,16 +571,14 @@
/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i // iOS /(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i // iOS
], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [ ], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [
/(mac\sos\sx)\s?([\w\s\.]+\w)*/i, /(mac\sos\sx)\s?([\w\s\.]+\w)*/i // Mac OS
/(macintosh|mac(?=_powerpc)\s)/i // Mac OS ], [NAME, [VERSION, /_/g, '.']], [
], [[NAME, 'Mac OS'], [VERSION, /_/g, '.']], [
// Other // Other
/((?:open)?solaris)[\/\s-]?([\w\.]+)*/i, // Solaris
/(haiku)\s(\w+)/i, // Haiku /(haiku)\s(\w+)/i, // Haiku
/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX /(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX
/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms)/i, /(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos)/i,
// Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS/OpenVMS // Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS
/(unix)\s?([\w\.]+)*/i // UNIX /(unix)\s?([\w\.]+)*/i // UNIX
], [NAME, VERSION] ], [NAME, VERSION]
] ]
@@ -652,29 +590,27 @@
//////////////// ////////////////
var UAParser = function (uastring, extensions) { var UAParser = function (uastring) {
if (!(this instanceof UAParser)) {
return new UAParser(uastring, extensions).getResult();
}
var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY); var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
var rgxmap = extensions ? util.extend(regexes, extensions) : regexes;
if (!(this instanceof UAParser)) {
return new UAParser(uastring).getResult();
}
this.getBrowser = function () { this.getBrowser = function () {
return mapper.rgx.apply(this, rgxmap.browser); return mapper.rgx.apply(this, regexes.browser);
}; };
this.getCPU = function () { this.getCPU = function () {
return mapper.rgx.apply(this, rgxmap.cpu); return mapper.rgx.apply(this, regexes.cpu);
}; };
this.getDevice = function () { this.getDevice = function () {
return mapper.rgx.apply(this, rgxmap.device); return mapper.rgx.apply(this, regexes.device);
}; };
this.getEngine = function () { this.getEngine = function () {
return mapper.rgx.apply(this, rgxmap.engine); return mapper.rgx.apply(this, regexes.engine);
}; };
this.getOS = function () { this.getOS = function () {
return mapper.rgx.apply(this, rgxmap.os); return mapper.rgx.apply(this, regexes.os);
}; };
this.getResult = function() { this.getResult = function() {
return { return {
@@ -696,35 +632,6 @@
this.setUA(ua); this.setUA(ua);
}; };
UAParser.VERSION = LIBVERSION;
UAParser.BROWSER = {
NAME : NAME,
MAJOR : MAJOR,
VERSION : VERSION
};
UAParser.CPU = {
ARCHITECTURE : ARCHITECTURE
};
UAParser.DEVICE = {
MODEL : MODEL,
VENDOR : VENDOR,
TYPE : TYPE,
CONSOLE : CONSOLE,
MOBILE : MOBILE,
SMARTTV : SMARTTV,
TABLET : TABLET,
WEARABLE: WEARABLE,
EMBEDDED: EMBEDDED
};
UAParser.ENGINE = {
NAME : NAME,
VERSION : VERSION
};
UAParser.OS = {
NAME : NAME,
VERSION : VERSION
};
/////////// ///////////
// Export // Export
@@ -747,9 +654,9 @@
return UAParser; return UAParser;
}); });
} }
// jQuery/Zepto specific (optional) // jQuery specific (optional)
var $ = window.jQuery || window.Zepto; if (typeof(window.jQuery) !== UNDEF_TYPE) {
if (typeof($) !== UNDEF_TYPE) { var $ = window.jQuery;
var parser = new UAParser(); var parser = new UAParser();
$.ua = parser.getResult(); $.ua = parser.getResult();
$.ua.get = function() { $.ua.get = function() {

1
src/ua-parser.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -648,5 +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"
}
} }
] ]

View File

@@ -102,5 +102,21 @@
{ {
"architecture" : "amd64" "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"
}
} }
] ]

View File

@@ -59,6 +59,106 @@
"type" : "mobile" "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", "desc" : "Nokia3xx",
"ua" : "Nokia303/14.87 CLDC-1.1", "ua" : "Nokia303/14.87 CLDC-1.1",
@@ -69,6 +169,46 @@
"type" : "mobile" "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", "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", "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",
@@ -80,33 +220,23 @@
} }
}, },
{ {
"desc" : "Samsung SM-T231", "desc" : "KTB-iPad",
"ua" : "Mozilla/5.0 (Linux; Android 4.4.2; SM-T231 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", "ua" : "APP-BE Test/1.0 (iPad; Apple; CPU iPhone OS 7_0_2 like Mac OS X)",
"expect" : "expect" :
{ {
"vendor" : "Samsung", "vendor" : "Apple",
"model" : "SM-T231", "model" : "iPad",
"type" : "tablet" "type" : "tablet"
} }
}, },
{ {
"desc" : "Samsung SM-T700", "desc" : "KTB-Nexus 5",
"ua" : "Mozilla/5.0 (Linux; Android 4.4.2; SM-T700 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36", "ua" : "APP-My App/1.0 (Linux; Android 4.2.1; Nexus 5 Build/JOP40D)",
"expect" : "expect" :
{ {
"vendor" : "Samsung", "vendor" : "LG",
"model" : "SM-T700", "model" : "Nexus 5",
"type" : "tablet" "type" : "mobile"
}
},
{
"desc" : "Samsung SM-T520",
"ua" : "Mozilla/5.0 (Linux; Android 4.4.2; SM-T520 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.135 Safari/537.36",
"expect" :
{
"vendor" : "Samsung",
"model" : "SM-T520",
"type" : "tablet"
} }
} }
] ]

View File

@@ -61,5 +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"
}
} }
] ]

View File

@@ -472,7 +472,7 @@
"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", "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" : "Mac OS", "name" : "Mac OS X",
"version" : "10.6.8" "version" : "10.6.8"
} }
}, },

View File

@@ -43,15 +43,6 @@ describe('UAParser()', function () {
assert.deepEqual(UAParser(ua), new UAParser().setUA(ua).getResult()); assert.deepEqual(UAParser(ua), new UAParser().setUA(ua).getResult());
}); });
describe('Injected Browser', function () {
var uaString = 'ownbrowser/1.3';
var ownBrowser = [[/(ownbrowser)\/((\d+)?[\w\.]+)/i], [UAParser.BROWSER.NAME, UAParser.BROWSER.VERSION, UAParser.BROWSER.MAJOR]];
var parser = new UAParser(uaString, {browser: ownBrowser});
assert.equal(parser.getBrowser().name, 'ownbrowser');
assert.equal(parser.getBrowser().major, '1');
assert.equal(parser.getBrowser().version, '1.3');
});
for (var i in methods) { for (var i in methods) {
describe(methods[i]['title'], function () { describe(methods[i]['title'], function () {
for (var j in methods[i]['list']) { for (var j in methods[i]['list']) {

View File

@@ -1,7 +1,7 @@
{ {
"title": "UAParser.js", "title": "UAParser.js",
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "0.7.3", "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",
@@ -28,5 +28,5 @@
], ],
"bugs": "https://github.com/faisalman/ua-parser-js/issues", "bugs": "https://github.com/faisalman/ua-parser-js/issues",
"docs": "https://github.com/faisalman/ua-parser-js", "docs": "https://github.com/faisalman/ua-parser-js",
"download": "https://raw.github.com/faisalman/ua-parser-js/master/dist/ua-parser.min.js" "download": "https://raw.github.com/faisalman/ua-parser-js/master/src/ua-parser.min.js"
} }