From 7c1397cdcc0a3f9e9d8333318619ce9e1cd48711 Mon Sep 17 00:00:00 2001 From: Douglas Li Date: Wed, 4 Dec 2013 17:10:26 -0800 Subject: [PATCH] Add Nexus 5 to device list User agent string taken from Chrome (Beta) Desktop's user-agent override in its developer tools. Added to test plan. --- src/ua-parser.js | 7 ++++--- src/ua-parser.min.js | 2 +- test/device-test.json | 10 ++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/ua-parser.js b/src/ua-parser.js index 37e1bd2..8d376fb 100644 --- a/src/ua-parser.js +++ b/src/ua-parser.js @@ -207,7 +207,7 @@ /(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i, // Opera Mobi/Tablet /(opera).+version\/((\d+)?[\w\.]+)/i, // Opera > 9.80 /(opera)[\/\s]+((\d+)?[\w\.]+)/i // Opera < 9.80 - + ], [NAME, VERSION, MAJOR], [ /\s(opr)\/((\d+)?[\w\.]+)/i // Opera Webkit @@ -374,6 +374,7 @@ /android\s3\.[\s\w-;]{10}(lg?)-([06cv9]{3,4})/i // LG ], [[VENDOR, 'LG'], MODEL, [TYPE, TABLET]], [ /((nexus\s4))/i, + /((nexus\s5))/i, /(lg)[e;\s-\/]+(\w+)*/i ], [[VENDOR, 'LG'], MODEL, [TYPE, MOBILE]], [ @@ -508,7 +509,7 @@ ////////// - // check js environment + // check js environment if (typeof(exports) !== UNDEF_TYPE) { // nodejs env if (typeof(module) !== UNDEF_TYPE && module.exports) { @@ -517,7 +518,7 @@ exports.UAParser = UAParser; } else { // browser env - window.UAParser = UAParser; + window.UAParser = UAParser; // requirejs env (optional) if (typeof(define) === FUNC_TYPE && define.amd) { define(function () { diff --git a/src/ua-parser.min.js b/src/ua-parser.min.js index 4bfb7b5..fdd1838 100644 --- a/src/ua-parser.min.js +++ b/src/ua-parser.min.js @@ -1 +1 @@ -(function(window,undefined){"use strict";var EMPTY="",UNKNOWN="?",FUNC_TYPE="function",UNDEF_TYPE="undefined",OBJ_TYPE="object",MAJOR="major",MODEL="model",NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",ARCHITECTURE="architecture",CONSOLE="console",MOBILE="mobile",TABLET="tablet";var util={has:function(str1,str2){return str2.toLowerCase().indexOf(str1.toLowerCase())!==-1},lowerize:function(str){return str.toLowerCase()}};var mapper={rgx:function(){for(var result,i=0,j,k,p,q,matches,match,args=arguments;i0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){result[q[0]]=q[1].call(this,match)}else{result[q[0]]=q[1]}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){result[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{result[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length==4){result[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{result[q]=match?match:undefined}}break}}if(!!matches)break}return result},str:function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){result[q[0]]=q[1].call(this,match)}else{result[q[0]]=q[1]}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){result[q[0]]=match?q[1].call(this,match,q[2]):undefined}else{result[q[0]]=match?match.replace(q[1],q[2]):undefined}}else if(q.length==4){result[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined}}else{result[q]=match?match:undefined}}break}}if(!!matches)break}return result},str:function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j