mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 07:58:45 +03:00
Add new OS: Firefox OS
This commit is contained in:
parent
cea29e5c1b
commit
9a90d932ce
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"title": "UA-Parser.JS",
|
"title": "UA-Parser.JS",
|
||||||
"name": "ua-parser-js",
|
"name": "ua-parser-js",
|
||||||
"version": "0.5.1",
|
"version": "0.5.2",
|
||||||
"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": [
|
||||||
|
@ -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().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().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"}
|
console.log(parser.getResult().os); // {name: "Ubuntu", version: "11.10"}
|
||||||
|
|
||||||
// let's take another test please
|
// 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.setUA(uaString).getDevice().model); // "PlayBook"
|
||||||
console.log(parser.getOS()) // {name: "RIM Tablet OS", version: "1.0.0"}
|
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
|
## License
|
||||||
|
9
test.js
9
test.js
@ -896,6 +896,15 @@ var os = [
|
|||||||
version : ''
|
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',
|
desc : 'Nintendo',
|
||||||
ua : '',
|
ua : '',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// UA-Parser.JS v0.5.1
|
// UA-Parser.JS v0.5.2
|
||||||
// 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
|
||||||
//
|
//
|
||||||
@ -12,13 +12,13 @@
|
|||||||
var EMPTY = '',
|
var EMPTY = '',
|
||||||
FUNC = 'function',
|
FUNC = 'function',
|
||||||
UNDEF = 'undefined',
|
UNDEF = 'undefined',
|
||||||
OBJ = 'object',
|
OBJ = 'object',
|
||||||
MAJOR = 'major',
|
MAJOR = 'major',
|
||||||
MODEL = 'model',
|
MODEL = 'model',
|
||||||
NAME = 'name',
|
NAME = 'name',
|
||||||
TYPE = 'type',
|
TYPE = 'type',
|
||||||
VENDOR = 'vendor',
|
VENDOR = 'vendor',
|
||||||
VERSION = 'version',
|
VERSION = 'version',
|
||||||
CONSOLE = 'console',
|
CONSOLE = 'console',
|
||||||
MOBILE = 'mobile',
|
MOBILE = 'mobile',
|
||||||
TABLET = 'tablet';
|
TABLET = 'tablet';
|
||||||
@ -318,7 +318,10 @@
|
|||||||
], [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],[
|
||||||
|
/mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS
|
||||||
|
], [[NAME, 'Firefox OS'], VERSION], [
|
||||||
|
|
||||||
|
// Console
|
||||||
/(nintendo|playstation)\s([wids3portablev]+)/i, // Nintendo/Playstation
|
/(nintendo|playstation)\s([wids3portablev]+)/i, // Nintendo/Playstation
|
||||||
|
|
||||||
// GNU/Linux based
|
// GNU/Linux based
|
||||||
|
4
ua-parser.min.js
vendored
4
ua-parser.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user