Add new OS: Firefox OS

This commit is contained in:
Faisal Salman 2013-01-28 18:35:51 +07:00
parent cea29e5c1b
commit 9a90d932ce
5 changed files with 20 additions and 8 deletions

View File

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

View File

@ -65,7 +65,7 @@ Extract detailed type of web browser, layout engine, operating system, and devic
console.log(parser.getResult().browser); // {name: "Chromium", major: "15", version: "15.0.874.106"}
console.log(parser.getResult().device); // {model: undefined, type: undefined, vendor: undefined}
console.log(parser.getResult().engine); // {name: "AppleWebKit", version: "535.2"}
console.log(parser.getResult().engine); // {name: "WebKit", version: "535.2"}
console.log(parser.getResult().os); // {name: "Ubuntu", version: "11.10"}
// let's take another test please
@ -88,7 +88,7 @@ var uaString = 'Mozilla/5.0 (PlayBook; U; RIM Tablet OS 1.0.0; en-US) AppleWe
console.log(parser.setUA(uaString).getDevice().model); // "PlayBook"
console.log(parser.getOS()) // {name: "RIM Tablet OS", version: "1.0.0"}
console.log(parser.getEngine().name); // "AppleWebKit"
console.log(parser.getEngine().name); // "WebKit"
```
## License

View File

@ -896,6 +896,15 @@ var os = [
version : ''
}
},
{
desc : 'Firefox OS',
ua : 'Mozilla/5.0 (Mobile; rv:14.0) Gecko/14.0 Firefox/14.0',
expect :
{
name : 'Firefox OS',
version : undefined
}
},
{
desc : 'Nintendo',
ua : '',

View File

@ -1,4 +1,4 @@
// UA-Parser.JS v0.5.1
// UA-Parser.JS v0.5.2
// Lightweight JavaScript-based User-Agent string parser
// https://github.com/faisalman/ua-parser-js
//
@ -12,13 +12,13 @@
var EMPTY = '',
FUNC = 'function',
UNDEF = 'undefined',
OBJ = 'object',
OBJ = 'object',
MAJOR = 'major',
MODEL = 'model',
NAME = 'name',
TYPE = 'type',
VENDOR = 'vendor',
VERSION = 'version',
VERSION = 'version',
CONSOLE = 'console',
MOBILE = 'mobile',
TABLET = 'tablet';
@ -318,7 +318,10 @@
], [NAME, VERSION], [
/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian
], [[NAME, 'Symbian'], VERSION],[
/mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS
], [[NAME, 'Firefox OS'], VERSION], [
// Console
/(nintendo|playstation)\s([wids3portablev]+)/i, // Nintendo/Playstation
// GNU/Linux based

4
ua-parser.min.js vendored

File diff suppressed because one or more lines are too long