This commit is contained in:
Faisal Salman 2013-03-22 13:23:24 +07:00
parent ce8f4977c0
commit 4f2ee98dae
8 changed files with 23 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "0.5.24", "version": "0.5.25",
"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"],
"scripts": ["src/ua-parser.js"], "scripts": ["src/ua-parser.js"],

View File

@ -1,7 +1,7 @@
{ {
"title": "UAParser.js", "title": "UAParser.js",
"name": "ua-parser-js", "name": "ua-parser-js",
"version": "0.5.24", "version": "0.5.25",
"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": [

View File

@ -190,7 +190,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. In case you need, `UAParser` constructor is still present in global though. 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), 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)`.
```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':

View File

@ -1,4 +1,4 @@
// UAParser.js v0.5.24 // UAParser.js v0.5.25
// 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
// //
@ -334,6 +334,7 @@
/android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i // LG /android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i // LG
], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [ ], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [
/((nexus\s4))/i,
/(lg)[e;\s-\/]+(\w+)*/i /(lg)[e;\s-\/]+(\w+)*/i
], [[VENDOR, 'LG'], MODEL, [TYPE, MOBILE]], [ ], [[VENDOR, 'LG'], MODEL, [TYPE, MOBILE]], [

File diff suppressed because one or more lines are too long

View File

@ -8,4 +8,14 @@
"model" : "Evo Shift 4G", "model" : "Evo Shift 4G",
"type" : "mobile" "type" : "mobile"
} }
},
{
"desc" : "LG Nexus 4",
"ua" : "Mozilla/5.0 (Linux; Android 4.2.1; Nexus 4 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19",
"expect" :
{
"vendor" : "LG",
"model" : "Nexus 4",
"type" : "mobile"
}
}] }]

View File

@ -31,6 +31,11 @@ var methods = [
properties : ['name', 'version'] properties : ['name', 'version']
}]; }];
describe('UAParser()', function () {
var ua = 'Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6';
assert.deepEqual(UAParser(ua), new UAParser().setUA(ua).getResult());
});
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.5.24", "version": "0.5.25",
"description": "Lightweight JavaScript-based user-agent string parser", "description": "Lightweight JavaScript-based user-agent string parser",
"keywords": [ "keywords": [
"user-agent", "user-agent",