mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 07:58:45 +03:00
Fix issue #14
This commit is contained in:
parent
ce8f4977c0
commit
4f2ee98dae
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ua-parser-js",
|
||||
"version": "0.5.24",
|
||||
"version": "0.5.25",
|
||||
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||
"keywords": ["user-agent", "parser", "browser", "engine", "os", "device"],
|
||||
"scripts": ["src/ua-parser.js"],
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"title": "UAParser.js",
|
||||
"name": "ua-parser-js",
|
||||
"version": "0.5.24",
|
||||
"version": "0.5.25",
|
||||
"author": "Faisal Salman <fyzlman@gmail.com> (http://faisalman.com)",
|
||||
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||
"keywords": [
|
||||
|
@ -190,7 +190,7 @@ $ bower install ua-parser-js
|
||||
|
||||
### 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
|
||||
// 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':
|
||||
|
@ -1,4 +1,4 @@
|
||||
// UAParser.js v0.5.24
|
||||
// UAParser.js v0.5.25
|
||||
// Lightweight JavaScript-based User-Agent string parser
|
||||
// https://github.com/faisalman/ua-parser-js
|
||||
//
|
||||
@ -334,6 +334,7 @@
|
||||
|
||||
/android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i // LG
|
||||
], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [
|
||||
/((nexus\s4))/i,
|
||||
/(lg)[e;\s-\/]+(\w+)*/i
|
||||
], [[VENDOR, 'LG'], MODEL, [TYPE, MOBILE]], [
|
||||
|
||||
|
4
src/ua-parser.min.js
vendored
4
src/ua-parser.min.js
vendored
File diff suppressed because one or more lines are too long
@ -8,4 +8,14 @@
|
||||
"model" : "Evo Shift 4G",
|
||||
"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"
|
||||
}
|
||||
}]
|
||||
|
@ -31,6 +31,11 @@ var methods = [
|
||||
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) {
|
||||
describe(methods[i]['title'], function () {
|
||||
for (var j in methods[i]['list']) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"title": "UAParser.js",
|
||||
"name": "ua-parser-js",
|
||||
"version": "0.5.24",
|
||||
"version": "0.5.25",
|
||||
"description": "Lightweight JavaScript-based user-agent string parser",
|
||||
"keywords": [
|
||||
"user-agent",
|
||||
|
Loading…
x
Reference in New Issue
Block a user