Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

useragent.js

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

useragent.js - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

.travis.yml

13

gruntfile.js

@@ -14,6 +14,5 @@ 'use strict';

base: {
files: [{
src: ['lib/*.js', 'index.js'],
dest: 'dist/tmp/'
}]
src: ['lib/*.js', 'index.js'],
dest: 'dist/tmp/',
expand: true
},

@@ -43,3 +42,3 @@ asp: {

},
closurecompiler: {
uglify: {
dist: {

@@ -108,3 +107,3 @@ options: {

grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-closurecompiler');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-transcoding');

@@ -121,3 +120,3 @@ grunt.loadNpmTasks('grunt-contrib-clean');

if (!doNotCompile) {
tasks.push('closurecompiler');
tasks.push('uglify');
}

@@ -124,0 +123,0 @@

@@ -9,5 +9,5 @@ (function(root) {

userAgent.version = "0.1";
userAgent.publishDate = "20150217";
userAgent.version = "0.2";
userAgent.publishDate = "20150626";
userAgent.analyze = function(uaString) {

@@ -34,3 +34,8 @@ var returnObject = {};

if (NODE) {
requireFunction(userAgent, require('./lib/os'), require('./lib/device'), require('./lib/browser'));
if (process.env.UAJS_COV) {
requireFunction(userAgent, require('./lib-cov/os'), require('./lib-cov/device'), require('./lib-cov/browser'));
} else {
requireFunction(userAgent, require('./lib/os'), require('./lib/device'), require('./lib/browser'));
}
module.exports = userAgent;

@@ -37,0 +42,0 @@ }

(function(root) {
var BROWSER = {};

@@ -47,23 +46,5 @@ var browserRegEx = new RegExp([

].join("|"), "i");
var defaultBrowserList = {
"114browser": {
"title": "{%114Browser%}",
"image": "114browser"
},
"115browser": {
"title": "{%115Browser%}",
"image": "115browser"
},
"2345explorer": {
"title": "{%2345Explorer%}",
"image": "2345explorer"
},
"2345chrome": {
"title": "{%2345Chrome%}",
"image": "2345chrome"
},
"360se": {
"title": "360 Explorer",
"image": "360se"
"title": "360 Explorer"
},

@@ -79,4 +60,3 @@ "360ee": {

"abolimba": {
"title": "Abolimba",
"image": "abolimba"
"title": "Abolimba"
},

@@ -87,10 +67,2 @@ "acoo browser": {

},
"alienforce": {
"title": "{%Alienforce%}",
"image": "alienforce"
},
"amaya": {
"title": "{%Amaya%}",
"image": "amaya"
},
"amiga-aweb": {

@@ -101,4 +73,3 @@ "title": "Amiga {%AWeb%}",

"antfresco": {
"title": "ANT {%Fresco%}",
"image": "antfresco"
"title": "ANT {%Fresco%}"
},

@@ -118,13 +89,7 @@ "mrchrome": {

"amigavoyager": {
"title": "Amiga {%Voyager%}",
"image": "amigavoyager"
"title": "Amiga {%Voyager%}"
},
"aol": {
"title": "{%AOL%}",
"image": "aol"
"title": "{%AOL%}"
},
"arora": {
"title": "{%Arora%}",
"image": "arora"
},
"atomicbrowser": {

@@ -138,23 +103,6 @@ "title": "{%AtomicBrowser%}",

},
"barca": {
"title": "{%Barca%}",
"image": "barca"
},
"beamrise": {
"title": "{%Beamrise%}",
"image": "beamrise"
},
"beonex": {
"title": "{%Beonex%}",
"image": "beonex"
},
// Baidu Browser Spark does not have own UA.
"baidubrowser": {
"title": "{%baidubrowser%}",
"image": "bidubrowser"
},
"bidubrowser": {
"title": "{%bidubrowser%}",
"image": "bidubrowser"
},
"baiduhd": {

@@ -164,18 +112,5 @@ "title": "{%BaiduHD%}",

},
"blackbird": {
"title": "{%Blackbird%}",
"image": "blackbird"
},
"blackhawk": {
"title": "{%BlackHawk%}",
"image": "blackhawk"
"title": "{%BlackHawk%}"
},
"blazer": {
"title": "{%Blazer%}",
"image": "blazer"
},
"bolt": {
"title": "{%Bolt%}",
"image": "bolt"
},
"bonecho": {

@@ -186,17 +121,4 @@ "title": "{%BonEcho%}",

"browsex": {
"title": "BrowseX",
"image": "browsex"
"title": "BrowseX"
},
"browzar": {
"title": "{%Browzar%}",
"image": "browzar"
},
"bunjalloo": {
"title": "{%Bunjalloo%}",
"image": "bunjalloo"
},
"camino": {
"title": "{%Camino%}",
"image": "camino"
},
"cayman browser": {

@@ -207,20 +129,15 @@ "title": "Cayman {%Browser%}",

"charon": {
"title": "{%Charon%}",
"image": "null"
},
"cheshire": {
"title": "{%Cheshire%}",
"image": "aol"
},
"chimera": {
"title": "{%Chimera%}",
"image": "null"
},
"chromeframe": {
"title": "{%chromeframe%}",
"image": "chrome"
},
"chromeplus": {
"title": "{%ChromePlus%}",
"image": "chromeplus"
"title": "{%ChromePlus%}"
},

@@ -231,21 +148,4 @@ "iron": {

},
"chromium": {
"title": "{%Chromium%}",
"image": "chromium"
},
"classilla": {
"title": "{%Classilla%}",
"image": "classilla"
},
"coast": {
"title": "{%Coast%}",
"image": "coast"
},
"columbus": {
"title": "{%Columbus%}",
"image": "columbus"
},
"cometbird": {
"title": "{%CometBird%}",
"image": "cometbird"
"title": "{%CometBird%}"
},

@@ -256,13 +156,7 @@ "comodo_dragon": {

},
"conkeror": {
"title": "{%Conkeror%}",
"image": "conkeror"
},
"coolnovo": {
"title": "{%CoolNovo%}",
"image": "coolnovo"
"title": "{%CoolNovo%}"
},
"corom": {
"title": "{%CoRom%}",
"image": "corom"
"title": "{%CoRom%}"
},

@@ -277,10 +171,2 @@ "crazy browser": {

},
"cruz": {
"title": "{%Cruz%}",
"image": "cruz"
},
"cyberdog": {
"title": "{%Cyberdog%}",
"image": "cyberdog"
},
"dplus": {

@@ -294,14 +180,5 @@ "title": "{%DPlus%}",

},
"demeter": {
"title": "{%Demeter%}",
"image": "demeter"
},
"deskbrowse": {
"title": "{%DeskBrowse%}",
"image": "deskbrowse"
"title": "{%DeskBrowse%}"
},
"dillo": {
"title": "{%Dillo%}",
"image": "dillo"
},
"docomo": {

@@ -312,29 +189,10 @@ "title": "{%DoCoMo%}",

"doczilla": {
"title": "{%DocZilla%}",
"image": "doczilla"
"title": "{%DocZilla%}"
},
"dolfin": {
"title": "{%Dolfin%}",
"image": "samsung"
},
"dooble": {
"title": "{%Dooble%}",
"image": "dooble"
},
"doris": {
"title": "{%Doris%}",
"image": "doris"
},
"dorothy": {
"title": "{%Dorothy%}",
"image": "dorothybrowser"
},
"edbrowse": {
"title": "{%Edbrowse%}",
"image": "edbrowse"
},
"elinks": {
"title": "{%Elinks%}",
"image": "elinks"
},
"element browser": {

@@ -353,25 +211,10 @@ "title": "Element {%Browser%}",

"epic": {
"title": "{%Epic%}",
"image": "epicbrowser"
},
"epiphany": {
"title": "{%Epiphany%}",
"image": "epiphany"
},
"escape": {
"title": "{%Escape%}",
"image": "espialtvbrowser"
},
"espial": {
"title": "{%Espial%}",
"image": "espialtvbrowser"
},
"fennec": {
"title": "{%Fennec%}",
"image": "fennec"
},
"firebird": {
"title": "{%Firebird%}",
"image": "firebird"
},
"fireweb navigator": {

@@ -381,21 +224,7 @@ "title": "{%Fireweb Navigator%}",

},
"flock": {
"title": "{%Flock%}",
"image": "flock"
},
"fluid": {
"title": "{%Fluid%}",
"image": "fluid"
},
"galeon": {
"title": "{%Galeon%}",
"image": "galeon"
},
"globalmojo": {
"title": "{%GlobalMojo%}",
"image": "globalmojo"
"title": "{%GlobalMojo%}"
},
"gobrowser": {
"title": "GO {%Browser%}",
"image": "gobrowser"
"title": "GO {%Browser%}"
},

@@ -407,4 +236,3 @@ "google wireless transcoder": {

"gosurf": {
"title": "{%GoSurf%}",
"image": "gosurf"
"title": "{%GoSurf%}"
},

@@ -416,17 +244,7 @@ "granparadiso": {

"greenbrowser": {
"title": "{%GreenBrowser%}",
"image": "greenbrowser"
"title": "{%GreenBrowser%}"
},
"hana": {
"title": "{%Hana%}",
"image": "hana"
},
"hotjava": {
"title": "{%HotJava%}",
"image": "hotjava"
"title": "{%HotJava%}"
},
"hv3": {
"title": "{%Hv3%}",
"image": "hv3"
},
"hydra browser": {

@@ -436,6 +254,2 @@ "title": "Hydra Browser",

},
"iris": {
"title": "{%Iris%}",
"image": "iris"
},
"ibm webexplorer": {

@@ -446,40 +260,27 @@ "title": "IBM {%WebExplorer%}",

"juzibrowser": {
"title": "JuziBrowser",
"image": "juzibrowser"
"title": "JuziBrowser"
},
"miuibrowser": {
"title": "{%MiuiBrowser%}",
"image": "miuibrowser"
"title": "{%MiuiBrowser%}"
},
"mxnitro": {
"title": "{%MxNitro%}",
"image": "mxnitro"
"title": "{%MxNitro%}"
},
"ibrowse": {
"title": "{%IBrowse%}",
"image": "ibrowse"
"title": "{%IBrowse%}"
},
"icab": {
"title": "{%iCab%}",
"image": "icab"
"title": "{%iCab%}"
},
"icebrowser": {
"title": "{%IceBrowser%}",
"image": "icebrowser"
"title": "{%IceBrowser%}"
},
"iceape": {
"title": "{%Iceape%}",
"image": "iceape"
},
"icecat": {
"title": "GNU {%IceCat%}",
"image": "icecat"
"title": "GNU {%IceCat%}"
},
"icedragon": {
"title": "{%IceDragon%}",
"image": "icedragon"
"title": "{%IceDragon%}"
},
"iceweasel": {
"title": "{%IceWeasel%}",
"image": "iceweasel"
"title": "{%IceWeasel%}"
},

@@ -491,11 +292,8 @@ "inet browser": {

"irider": {
"title": "{%iRider%}",
"image": "irider"
"title": "{%iRider%}"
},
"internetsurfboard": {
"title": "{%InternetSurfboard%}",
"image": "internetsurfboard"
"title": "{%InternetSurfboard%}"
},
"jasmine": {
"title": "{%Jasmine%}",
"image": "samsung"

@@ -511,10 +309,2 @@ },

},
"kapiko": {
"title": "{%Kapiko%}",
"image": "kapiko"
},
"kazehakase": {
"title": "{%Kazehakase%}",
"image": "kazehakase"
},
"strata": {

@@ -525,12 +315,6 @@ "title": "Kirix {%Strata%}",

"kkman": {
"title": "{%KKman%}",
"image": "kkman"
"title": "{%KKman%}"
},
"kinza": {
"title": "{%Kinza%}",
"image": "kinza"
},
"kmail": {
"title": "{%KMail%}",
"image": "kmail"
"title": "{%KMail%}"
},

@@ -541,24 +325,12 @@ "kmlite": {

},
"konqueror": {
"title": "{%Konqueror%}",
"image": "konqueror"
},
"kylo": {
"title": "{%Kylo%}",
"image": "kylo"
},
"lbrowser": {
"title": "{%LBrowser%}",
"image": "lbrowser"
"title": "{%LBrowser%}"
},
"links": {
"title": "{%Links%}",
"image": "null"
},
"lbbrowser": {
"title": "Liebao Browser",
"image": "lbbrowser"
"title": "Liebao Browser"
},
"liebaofast": {
"title": "{%Liebaofast%}",
"image": "lbbrowser"

@@ -571,8 +343,6 @@ },

"lobo": {
"title": "{%Lobo%}",
"image": "lobo"
"title": "{%Lobo%}"
},
"lolifox": {
"title": "{%lolifox%}",
"image": "lolifox"
"title": "{%lolifox%}"
},

@@ -583,14 +353,2 @@ "lorentz": {

},
"lunascape": {
"title": "{%Lunascape%}",
"image": "lunascape"
},
"lynx": {
"title": "{%Lynx%}",
"image": "lynx"
},
"madfox": {
"title": "{%Madfox%}",
"image": "madfox"
},
"maemo browser": {

@@ -600,6 +358,2 @@ "title": "{%Maemo Browser%}",

},
"maxthon": {
"title": "{%Maxthon%}",
"image": "maxthon"
},
" mib/": {

@@ -617,22 +371,5 @@ "title": "{%MIB%}",

},
"midori": {
"title": "{%Midori%}",
"image": "midori"
},
"minefield": {
"title": "{%Minefield%}",
"image": "minefield"
},
"minibrowser": {
"title": "{%MiniBrowser%}",
"image": "minibrowser"
"title": "{%MiniBrowser%}"
},
"minimo": {
"title": "{%Minimo%}",
"image": "minimo"
},
"mosaic": {
"title": "{%Mosaic%}",
"image": "mosaic"
},
"mozilladeveloperpreview": {

@@ -655,7 +392,5 @@ "title": "{%MozillaDeveloperPreview%}",

"myie2": {
"title": "{%MyIE2%}",
"image": "myie2"
"title": "{%MyIE2%}"
},
"namoroka": {
"title": "{%Namoroka%}",
"image": "firefoxdevpre"

@@ -668,28 +403,18 @@ },

"netbox": {
"title": "{%NetBox%}",
"image": "netbox"
"title": "{%NetBox%}"
},
"netcaptor": {
"title": "{%NetCaptor%}",
"image": "netcaptor"
"title": "{%NetCaptor%}"
},
"netfront": {
"title": "{%NetFront%}",
"image": "netfront"
"title": "{%NetFront%}"
},
"netnewswire": {
"title": "{%NetNewsWire%}",
"image": "netnewswire"
"title": "{%NetNewsWire%}"
},
"netpositive": {
"title": "{%NetPositive%}",
"image": "netpositive"
"title": "{%NetPositive%}"
},
"netscape": {
"title": "{%Netscape%}",
"image": "netscape"
},
"netsurf": {
"title": "{%NetSurf%}",
"image": "netsurf"
"title": "{%NetSurf%}"
},

@@ -712,26 +437,11 @@ "nf-browser": {

},
"obigo": {
"title": "{%Obigo%}",
"image": "obigo"
},
"offbyone": {
"title": "Off By One",
"image": "offbyone"
"title": "Off By One"
},
"omniweb": {
"title": "{%OmniWeb%}",
"image": "omniweb"
"title": "{%OmniWeb%}"
},
"onebrowser": {
"title": "{%OneBrowser%}",
"image": "onebrowser"
"title": "{%OneBrowser%}"
},
"orca": {
"title": "{%Orca%}",
"image": "orca"
},
"oregano": {
"title": "{%Oregano%}",
"image": "oregano"
},
"origyn web browser": {

@@ -745,6 +455,2 @@ "title": "Oregano Web Browser",

},
"otter": {
"title": "{%Otter%}",
"image": "otter"
},
" pre/": {

@@ -755,4 +461,3 @@ "title": "Palm {%Pre%}",

"palemoon": {
"title": "Pale {%Moon%}",
"image": "palemoon"
"title": "Pale {%Moon%}"
},

@@ -763,14 +468,5 @@ "patriott::browser": {

},
"perk": {
"title": "{%Perk%}",
"image": "perk"
},
"phaseout": {
"title": "Phaseout",
"image": "phaseout"
"title": "Phaseout"
},
"phoenix": {
"title": "{%Phoenix%}",
"image": "phoenix"
},
"playstation 4": {

@@ -780,6 +476,2 @@ "title": "PS4 Web Browser",

},
"podkicker": {
"title": "{%Podkicker%}",
"image": "podkicker"
},
"podkicker pro": {

@@ -789,25 +481,7 @@ "title": "{%Podkicker Pro%}",

},
"pogo": {
"title": "{%Pogo%}",
"image": "pogo"
},
"polaris": {
"title": "{%Polaris%}",
"image": "polaris"
},
"polarity": {
"title": "{%Polarity%}",
"image": "polarity"
},
"prism": {
"title": "{%Prism%}",
"image": "prism"
},
"qqbrowser": {
"title": "{%QQBrowser%}",
"image": "qqbrowser"
"title": "{%QQBrowser%}"
},
"qq": {
"title": "{%QQ%}",
"image": "qq"
"title": "{%QQ%}"
},

@@ -823,8 +497,6 @@ "qtweb internet browser": {

"qupzilla": {
"title": "{%QupZilla%}",
"image": "qupzilla"
"title": "{%QupZilla%}"
},
"rekonq": {
"title": "rekonq",
"image": "rekonq"
"title": "rekonq"
},

@@ -836,16 +508,9 @@ "retawq": {

"rockmelt": {
"title": "{%RockMelt%}",
"image": "rockmelt"
"title": "{%RockMelt%}"
},
"ryouko": {
"title": "{%Ryouko%}",
"image": "ryouko"
},
"saayaa": {
"title": "SaaYaa Explorer",
"image": "saayaa"
"title": "SaaYaa Explorer"
},
"seamonkey": {
"title": "{%SeaMonkey%}",
"image": "seamonkey"
"title": "{%SeaMonkey%}"
},

@@ -860,6 +525,2 @@ "semc-browser": {

},
"shiira": {
"title": "{%Shiira%}",
"image": "shiira"
},
"shiretoko": {

@@ -870,33 +531,16 @@ "title": "{%Shiretoko%}",

"sitekiosk": {
"title": "{%SiteKiosk%}",
"image": "sitekiosk"
"title": "{%SiteKiosk%}"
},
"skipstone": {
"title": "{%SkipStone%}",
"image": "skipstone"
"title": "{%SkipStone%}"
},
"skyfire": {
"title": "{%Skyfire%}",
"image": "skyfire"
},
"sleipnir": {
"title": "{%Sleipnir%}",
"image": "sleipnir"
},
"silk": {
"title": "Amazon {%Silk%}",
"image": "silk"
"title": "Amazon {%Silk%}"
},
"slimboat": {
"title": "{%SlimBoat%}",
"image": "slimboat"
"title": "{%SlimBoat%}"
},
"slimbrowser": {
"title": "{%SlimBrowser%}",
"image": "slimbrowser"
"title": "{%SlimBrowser%}"
},
"superbird": {
"title": "{%Superbird%}",
"image": "superbird"
},
"smarttv": {

@@ -906,13 +550,4 @@ "title": "{%SmartTV%}",

},
"songbird": {
"title": "{%Songbird%}",
"image": "songbird"
},
"stainless": {
"title": "{%Stainless%}",
"image": "stainless"
},
"substream": {
"title": "{%SubStream%}",
"image": "substream"
"title": "{%SubStream%}"
},

@@ -923,22 +558,2 @@ "sulfur": {

},
"sundance": {
"title": "{%Sundance%}",
"image": "sundance"
},
"sunrise": {
"title": "{%Sunrise%}",
"image": "sunrise"
},
"surf": {
"title": "{%Surf%}",
"image": "surf"
},
"swiftfox": {
"title": "{%Swiftfox%}",
"image": "swiftfox"
},
"swiftweasel": {
"title": "{%Swiftweasel%}",
"image": "swiftweasel"
},
"sylera": {

@@ -949,41 +564,22 @@ "title": "{%Sylera%}",

"taobrowser": {
"title": "{%TaoBrowser%}",
"image": "taobrowser"
"title": "{%TaoBrowser%}"
},
"tear": {
"title": "Tear",
"image": "tear"
"title": "Tear"
},
"teashark": {
"title": "{%TeaShark%}",
"image": "teashark"
"title": "{%TeaShark%}"
},
"teleca": {
"title": "{%Teleca%}",
"image": "obigo"
},
"tencenttraveler": {
"title": "Tencent {%Traveler%}",
"image": "tencenttraveler"
"title": "Tencent {%Traveler%}"
},
"tenfourfox": {
"title": "{%TenFourFox%}",
"image": "tenfourfox"
"title": "{%TenFourFox%}"
},
"theworld": {
"title": "TheWorld Browser",
"image": "theworld"
"title": "TheWorld Browser"
},
"thunderbird": {
"title": "{%Thunderbird%}",
"image": "thunderbird"
},
"tizen": {
"title": "{%Tizen%}",
"image": "tizen"
},
"tjusig": {
"title": "{%Tjusig%}",
"image": "tjusig"
},
"ubrowser": {

@@ -994,4 +590,3 @@ "title": "{%UBrowser%}",

"ucbrowser": {
"title": "{%UCBrowser%}",
"image": "ucbrowser"
"title": "{%UCBrowser%}"
},

@@ -1007,4 +602,3 @@ "uc browser": {

"ultrabrowser": {
"title": "{%UltraBrowser%}",
"image": "ultrabrowser"
"title": "{%UltraBrowser%}"
},

@@ -1019,9 +613,4 @@ "up.browser": {

},
"usejump": {
"title": "{%Usejump%}",
"image": "usejump"
},
"uzardweb": {
"title": "{%uZardWeb%}",
"image": "uzardweb"
"title": "{%uZardWeb%}"
},

@@ -1033,4 +622,3 @@ "uzard": {

"uzbl": {
"title": "uzbl",
"image": "uzbl"
"title": "uzbl"
},

@@ -1041,6 +629,2 @@ "vimprobable": {

},
"vivaldi": {
"title": "{%Vivaldi%}",
"image": "vivaldi"
},
"vonkeror": {

@@ -1051,4 +635,3 @@ "title": "{%Vonkeror%}",

"w3m": {
"title": "{%W3M%}",
"image": "w3m"
"title": "{%W3M%}"
},

@@ -1068,12 +651,9 @@ "wget": {

"waterfox": {
"title": "{%WaterFox%}",
"image": "waterfox"
"title": "{%WaterFox%}"
},
"webianshell": {
"title": "Webian {%Shell%}",
"image": "webianshell"
"title": "Webian {%Shell%}"
},
"webrender": {
"title": "Webrender",
"image": "webrender"
"title": "Webrender"
},

@@ -1089,19 +669,11 @@ "weltweitimnetzbrowser": {

"wkiosk": {
"title": "wKiosk",
"image": "wkiosk"
"title": "wKiosk"
},
"worldwideweb": {
"title": "{%WorldWideWeb%}",
"image": "worldwideweb"
"title": "{%WorldWideWeb%}"
},
"wyzo": {
"title": "{%Wyzo%}",
"image": "Wyzo"
},
"x-smiles": {
"title": "{%X-Smiles%}",
"image": "x-smiles"
"title": "{%X-Smiles%}"
},
"xiino": {
"title": "{%Xiino%}",
"image": "null"

@@ -1114,17 +686,10 @@ },

"zbrowser": {
"title": "{%zBrowser%}",
"image": "zbrowser"
"title": "{%zBrowser%}"
},
"zipzap": {
"title": "{%ZipZap%}",
"image": "zipzap"
"title": "{%ZipZap%}"
},
"abrowse": {
"title": "ABrowse {%Browser%}",
"image": "abrowse"
"title": "ABrowse {%Browser%}"
},
"firefox": {
"title": "{%Firefox%}",
"image": "firefox"
},
"none": {

@@ -1134,5 +699,105 @@ "title": "Unknown",

}
};
var displayNameList = {
"msie": {
callback: function(rep, ret) {
if (ret.version == "7.0" && /Trident\/4.0/i.test(ret.ua)) {
ret.name = " 8.0 (Compatibility Mode)";
ret.version = "";
} else {
ret.name = "";
}
}
},
"nf-browser": {
name: "NetFront"
},
"semc-browser": {
name: "SEMC Browser"
},
"ucweb": {
name: "UC Browser"
},
"ubrowser": {
name: "UC Browser"
},
"ucbrowser": {
name: "UC Browser"
},
"uc browser": {
name: "UC Browser"
},
"bidubrowser": {
name: "Baidu Browser"
},
"baidubrowser": {
name: "Baidu Browser"
},
"baiduhd": {
name: "Baidu Browser"
},
"up.browser": {
name: "Openwave Mobile Browser"
},
"up.link": {
name: "Openwave Mobile Browser"
},
"chromeframe": {
name: "Google Chrome Frame"
},
"mozilladeveloperpreview": {
name: "Mozilla Developer Preview"
},
"opera mobi": {
name: "Opera Mobile"
},
"osb-browser": {
name: "Gtk+ WebCore"
},
"tablet browser": {
name: "MicroB"
},
"crmo": {
name: "Chrome Mobile"
},
"smarttv": {
name: "Maple Browser"
},
"atomicbrowser": {
name: "Atomic Web Browser"
},
"barcapro": {
name: "Barca Pro"
},
"dplus": {
name: "D+"
},
"micromessenger": {
name: "WeChat"
},
"nichrome/self": {
name: "NiChrome"
},
"opera labs": {
callback: function(rep, ret) {
rep = ret.ua.match(/Edition\ Labs([\ ._0-9a-zA-Z]+);/i);
if (rep !== null) {
ret.version = rep[1];
} else {
ret.version = "";
}
}
},
"qtcarbrowser": {
name: "Tesla Car Browser",
version: ""
},
"iceweasel": {
callback: function(rep, ret) {
if (ret.version == "Firefox") {
ret.version = "";
}
}
}
};
var setRetName = function(ret, rep) {

@@ -1144,28 +809,19 @@ ret.image = rep.image;

};
var getVersion = function(ret, title) {
var lowerTitle = title.toLowerCase();
var start = lowerTitle;
ret.name = title;
var start = lowerTitle;
if ((lowerTitle == "opera" || lowerTitle == "opera next" || lowerTitle == "opera labs") && /Version/i.test(ret.ua)) {
start = "Version";
} else if ((lowerTitle == "opera" || lowerTitle == "opera next" || lowerTitle == "opera developer") && /OPR/i.test(ret.ua)) {
if ((lowerTitle == "opera" || lowerTitle == "opera next" || lowerTitle == "opera developer") && /OPR/i.test(ret.ua)) {
start = "OPR";
} else if (lowerTitle == "opera mobi" && /Version/i.test(ret.ua)) {
} else if (
((lowerTitle == "opera" || lowerTitle == "opera next" || lowerTitle == "opera labs") && /Version/i.test(ret.ua)) ||
((lowerTitle == "opera mobi" && /Version/i.test(ret.ua))) ||
((lowerTitle == "safari" && /Version/i.test(ret.ua))) ||
((lowerTitle == "pre" && /Version/i.test(ret.ua))) ||
((lowerTitle == "android webkit"))
) {
start = "Version";
} else if (lowerTitle == "safari" && /Version/i.test(ret.ua)) {
start = "Version";
} else if (lowerTitle == "pre" && /Version/i.test(ret.ua)) {
start = "Version";
} else if (lowerTitle == "android webkit") {
start = "Version";
} else if (lowerTitle == "links") {
start = "Links (";
} else if (lowerTitle == "uc browser") {
start = "UC Browser";
} else if (lowerTitle == "tenfourfox") {
start = " rv";
} else if (lowerTitle == "classilla") {
start = " rv";
} else if (lowerTitle == "smarttv") {

@@ -1175,13 +831,13 @@ start = "WebBrowser";

start = "UCBrowser";
} else if (lowerTitle == "msie" && /\ rv:([.0-9a-zA-Z]+)/i.test(ret.ua)) {
} else if (
lowerTitle == "tenfourfox" ||
lowerTitle == "classilla" ||
lowerTitle == "msie" && /\ rv:([.0-9a-zA-Z]+)/i.test(ret.ua)
) {
// We have IE11 or newer
start = " rv";
} else if (lowerTitle == "spartan") {
start = "edge";
} else if (lowerTitle == "nichrome/self") {
start = "self";
}
start = start.replace(new RegExp('[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]', 'g'), '\\$&');
var regEx = new RegExp(start + '[\ |\/|\:]?([.0-9a-zA-Z]+)', 'i');

@@ -1194,76 +850,13 @@ var rep = ret.ua.match(regEx);

}
if (lowerTitle == "msie" && ret.version == "7.0" && /Trident\/4.0/i.test(ret.ua)) {
return " 8.0 (Compatibility Mode)";
} else if (lowerTitle == "msie") {
return " " + ret.version;
} else if (lowerTitle == "nf-browser") {
ret.name = "NetFront";
return "NetFront " + ret.version;
} else if (lowerTitle == "semc-browser") {
ret.name = "SEMC Browser";
return "SEMC Browser " + ret.version;
} else if (lowerTitle == "ucweb" || lowerTitle == "ubrowser" || lowerTitle == "ucbrowser" || lowerTitle == "uc browser") {
ret.name = "UC Browser";
return "UC Browser " + ret.version;
} else if (lowerTitle == "bidubrowser" || lowerTitle == "baidubrowser" || lowerTitle == "baiduhd") {
ret.name = "Baidu Browser";
return "Baidu Browser " + ret.version;
} else if (lowerTitle == "up.browser" || lowerTitle == "up.link") {
ret.name = "Openwave Mobile Browser";
return "Openwave Mobile Browser " + ret.version;
} else if (lowerTitle == "chromeframe") {
ret.name = "Google Chrome Frame";
return "Google Chrome Frame " + ret.version;
} else if (lowerTitle == "mozilladeveloperpreview") {
ret.name = "Mozilla Developer Preview";
return "Mozilla Developer Preview " + ret.version;
} else if (lowerTitle == "opera mobi") {
ret.name = "Opera Mobile";
return "Opera Mobile " + ret.version;
} else if (lowerTitle == "osb-browser") {
ret.name = "Gtk+ WebCore";
return "Gtk+ WebCore " + ret.version;
} else if (lowerTitle == "tablet browser") {
ret.name = "MicroB";
return "MicroB " + ret.version;
} else if (lowerTitle == "crmo") {
ret.name = "Chrome Mobile";
return "Chrome Mobile " + ret.version;
} else if (lowerTitle == "smarttv") {
ret.name = "Maple Browser";
return "Maple Browser " + ret.version;
} else if (lowerTitle == "atomicbrowser") {
ret.name = "Atomic Web Browser";
return "Atomic Web Browser " + ret.version;
} else if (lowerTitle == "barcapro") {
ret.name = "Barca Pro";
return "Barca Pro " + ret.version;
} else if (lowerTitle == "dplus") {
ret.name = "D+";
return "D+ " + ret.version;
} else if (lowerTitle == "micromessenger") {
ret.name = "WeChat";
return "WeChat " + ret.version;
} else if (lowerTitle == "nichrome/self") {
ret.name = "NiChrome";
return "NiChrome " + ret.version;
} else if (lowerTitle == "opera labs") {
rep = ret.ua.match(/Edition\ Labs([\ ._0-9a-zA-Z]+);/i);
if (rep !== null) {
ret.version = rep[1];
if (lowerTitle in displayNameList) {
if ('callback' in displayNameList[lowerTitle]) {
displayNameList[lowerTitle].callback(rep, ret);
} else {
ret.version = "";
for (var tempVar in displayNameList[lowerTitle]) {
ret[tempVar] = displayNameList[lowerTitle][tempVar];
}
}
return ret.name + " " + ret.version;
} else if (lowerTitle == 'qtcarbrowser') {
return "Tesla Car Browser";
} else if (lowerTitle == "iceweasel") {
if (ret.version == "Firefox") {
ret.version = "";
}
return ret.name + " " + ret.version;
} else {
return ret.name + " " + ret.version;
}
return ret.name + (ret.version !== "" ? (" " + ret.version) : "");
};

@@ -1280,13 +873,18 @@

};
var res = uaString.match(browserRegEx);
var rep = null;
if (res !== null) {
var name = res[0].toLowerCase();
rep = {};
if (typeof defaultBrowserList[name] !== 'undefined') {
rep = defaultBrowserList[name];
} else {
rep = defaultBrowserList.none;
}
if (typeof rep.title == "undefined") {
rep.title = "{%" + name.toLowerCase().replace(/[a-z]/, function(m) {
return m.toUpperCase(); // Repeat dirty code...
}) + "%}";
}
if (typeof rep.image == "undefined") {
rep.image = name;
}
setRetName(ret, rep);

@@ -1302,8 +900,2 @@ } else if (/Galaxy/i.test(ret.ua) && !/Chrome/i.test(ret.ua)) {

ret.image = "opera-2";
} else if (/Opera Labs/i.test(ret.ua) || (/Opera/i.test(ret.ua) && /Edition Labs/i.test(ret.ua))) {
ret.full = getVersion(ret, 'Opera Labs');
ret.image = "opera-next";
} else if (/Opera Next/i.test(ret.ua) || (/Opera/i.test(ret.ua) && /Edition Next/i.test(ret.ua))) {
ret.full = getVersion(ret, 'Opera Next');
ret.image = "opera-next";
} else if (/Opera/i.test(ret.ua)) {

@@ -1326,8 +918,2 @@ ret.full = getVersion(ret, 'Opera');

}
} else if (/Series60/i.test(ret.ua) && !/Symbian/i.test(ret.ua)) {
ret.full = "Nokia " + getVersion(ret, 'Series60');
ret.image = "s60";
} else if (/S60/i.test(ret.ua) && !/Symbian/i.test(ret.ua)) {
ret.full = "Nokia " + getVersion(ret, 'S60');
ret.image = "s60";
} else if (/SE\ /i.test(ret.ua) && /MetaSr/i.test(ret.ua)) {

@@ -1346,10 +932,8 @@ ret.name = ret.full = "Sogou Explorer";

ret.image = "android-webkit";
} else if (/Windows.+Chrome.+Edge/i.test(ret.ua)) {
// Project Spartan
ret.full = getVersion(ret, 'Edge');
ret.image = "edge";
} else if (/Chrome|crios/i.test(ret.ua)) {
// Note: For IE11 Experimental Web Platform Features in Windows 10
// Spartan? Who knows.
if (/Windows NT 1.+Edge/i.test(ret.ua)) {
ret.full = "Internet Explorer " + getVersion(ret, 'Spartan');
ret.image = "msie11";
} else if (/crios/i.test(ret.ua)) {
if (/crios/i.test(ret.ua)) {
ret.full = "Google " + getVersion(ret, 'CriOS');

@@ -1363,3 +947,2 @@ ret.image = "chrome";

ret.name = "Safari";
if (/Version/i.test(ret.ua)) {

@@ -1374,3 +957,2 @@ ret.full = getVersion(ret, 'Safari');

}
ret.image = "safari";

@@ -1417,9 +999,9 @@ } else if (/Nokia/i.test(ret.ua) && !/Trident/i.test(ret.ua)) {

};
// Node.js
//#JSCOVERAGE_IF typeof module !== 'undefined' && module.exports
if (typeof module !== 'undefined' && module.exports) {
module.exports = BROWSER;
}
//#JSCOVERAGE_ENDIF
//#JSCOVERAGE_IF typeof define !== 'undefined' && define.amd
// AMD

@@ -1431,2 +1013,4 @@ else if (typeof define !== 'undefined' && define.amd) {

}
//#JSCOVERAGE_ENDIF
//#JSCOVERAGE_IF typeof define !== 'undefined' && define.cmd
// CMD

@@ -1437,2 +1021,4 @@ else if (typeof define !== 'undefined' && define.cmd) {

});
//#JSCOVERAGE_ENDIF
//#JSCOVERAGE_IF typeof define === 'undefined' && typeof module === 'undefined'
} else {

@@ -1442,3 +1028,3 @@ root.USERAGENT_BROWSER = function() {};

}
//#JSCOVERAGE_ENDIF
})(this);
(function(root) {
var analyze = function(ret) {
var rep = null;
// meizu
if (/(MEIZU (MX|M9)|M030)|MX-3/i.test(ret.ua)) {
ret.name = "Meizu";
ret.image = "meizu";
var deviceList = [{
regEx: /(MEIZU (MX|M9)|M030)|MX-3/i,
name: "Meizu",
image: "meizu"
}, {
regEx: /MI-ONE|MI \d|HM NOTE/i,
name: "Xiaomi",
image: "xiaomi",
childItem: [{
regEx: /HM NOTE ([A-Z0-9]+)/i,
name: "HM-NOTE $1"
}, {
regEx: /MI ([A-Z0-9]+)/i,
name: "$1"
}, {
regEx: /MI-ONE/i,
name: "1"
}]
}, {
regEx: /BlackBerry/i,
name: "BlackBerry",
image: "blackberry",
version: {
start: "blackberry ?"
}
// xiaomi
else if (/MI-ONE|MI \d|HM NOTE/i.test(ret.ua)) {
ret.name = "Xiaomi";
if (rep = ret.ua.match(/HM NOTE ([A-Z0-9]+)/i)) {
ret.name += " HM-NOTE " + rep[1];
} else if (rep = ret.ua.match(/MI ([A-Z0-9]+)/i)) {
ret.name += " " + rep[1];
} else if (rep = ret.ua.match(/MI-ONE/i)) {
ret.name += " 1";
}
ret.image = "xiaomi";
}, {
regEx: /Coolpad/i,
name: "CoolPad",
image: "coolpad",
version: {
start: "CoolPad( |\_)?",
item: 2
}
// BlackBerry
else if (/BlackBerry/i.test(ret.ua)) {
ret.name = "BlackBerry";
if (rep = ret.ua.match(/blackberry ?([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[1];
}, {
regEx: /Dell/i,
name: "Dell",
image: "dell",
childItem: [{
regEx: /Dell Streak/i,
name: "Streak"
}]
}, {
regEx: /HTC|Desire|Rhodium|WMD\-50433/i,
name: "HTC",
image: "htc",
childItem: [{
regEx: /Desire/i,
name: "Desire"
}, {
regEx: /Rhodium|WMD\-50433|HTC[_|\ ]Touch[_|\ ]Pro2/i,
name: "Touch Pro2"
}, {
regEx: /HTC[_|\ ]Touch[_|\ ]Pro/i,
name: "Touch Pro"
}, {
regEx: /Windows Phone .+ by HTC/i,
version: {
start: "Windows Phone ",
end: " by HTC"
}
ret.image = "blackberry";
}],
version: {
start: "HTC[ |_|-]?"
}
// Coolpad
else if (/Coolpad/i.test(ret.ua)) {
ret.name = "CoolPad";
if (rep = ret.ua.match(/CoolPad( |\_)?([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[2];
}
ret.image = "coolpad";
}, {
regEx: /huawei/i,
name: "Huawei",
image: "huawei",
version: {
start: "HUAWEI( |\_)?",
item: 2
}
// Dell
else if (/Dell Streak/i.test(ret.ua)) {
ret.name = "Dell Streak";
ret.image = "dell";
} else if (/Dell/i.test(ret.ua)) {
ret.name = "Dell";
ret.image = "dell";
}, {
regEx: /Kindle/i,
name: "Kindle",
image: "kindle",
version: {
start: "Kindle\/"
}
// HTC
else if (/Desire/i.test(ret.ua)) {
ret.name = "HTC Desire";
ret.image = "htc";
} else if (/Rhodium/i.test(ret.ua) || /HTC[_|\ ]Touch[_|\ ]Pro2/i.test(ret.ua) || /WMD-50433/i.test(ret.ua)) {
ret.name = "HTC Touch Pro2";
ret.image = "htc";
} else if (/HTC[_|\ ]Touch[_|\ ]Pro/i.test(ret.ua)) {
ret.name = "HTC Touch Pro";
ret.image = "htc";
} else if (/Windows Phone .+ by HTC/i.test(ret.ua)) {
ret.name = "HTC";
if (rep = ret.ua.match(/Windows Phone ([0-9A-Za-z]+) by HTC/i)) {
ret.name += " " + rep[1];
}
ret.image = "htc";
} else if (/HTC/i.test(ret.ua)) {
ret.name = "HTC";
if (rep = ret.ua.match(/HTC[\ |_|-]?([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[1];
} else if (rep = ret.ua.match(/HTC([._0-9a-zA-Z]+)/i)) {
ret.name += rep[1].repalce(/_/g, " ");
}
ret.image = "htc";
}, {
regEx: /K-Touch/i,
name: "K-Touch",
image: "k-touch",
version: {
start: "k-touch[ _]"
}
// huawei
else if (/Huawei/i.test(ret.ua)) {
ret.name = "Huawei";
ret.image = "huawei";
if (rep = ret.ua.match(/HUAWEI( |\_)?([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[2];
}
}, {
regEx: /Lenovo|lepad/i,
name: "Lenovo",
image: "lenovo",
childItem: [{
regEx: "lepad",
name: "LePad"
}],
version: {
start: "Lenovo[\ |\-|\/|\_]"
}
// Kindle
else if (/Kindle/i.test(ret.ua)) {
ret.name = "Kindle";
if (rep = ret.ua.match(/Kindle\/([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[1];
}
ret.image = "kindle";
}, {
regEx: /LG/i,
name: "LG",
image: "lg",
version: {
start: "LGE?([- \/])",
item: 2
}
// K-Touch
else if (/k-touch/i.test(ret.ua)) {
ret.name = "K-Touch";
ret.image = "k-touch";
if (rep = ret.ua.match(/k-touch[ _]([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[1];
}, {
regEx: / Droid|XT720|MOT-|MIB|XOOM/i,
name: "Motorola",
image: "motorola",
childItem: [{
regEx: / Droid/i,
name: "Droid"
}, {
regEx: /MOT\-|MIB/i,
version: {
start: "MOT(O|-)",
item: 2
}
}, {
regEx: /XOOM/i,
name: "Xoom"
}, {
regEx: /XT720/i,
name: "XT720"
}]
}, {
regEx: /Nintendo/i,
name: "Nintendo",
image: "nintendo",
childItem: [{
regEx: /DSi/,
name: "DSi",
image: "nintendodsi"
}, {
regEx: /DS/,
name: "DS",
image: "nintendods"
}, {
regEx: /WiiU/,
name: "Wii U",
image: "nintendowiiu"
}, {
regEx: /Wii/,
name: "Wii",
image: "nintendowii"
}]
}, {
regEx: /Nokia/i,
name: "Nokia",
image: "nokia",
childItem: [{
regEx: /Nokia 909/i,
name: "Lumia 1020"
}, {
regEx: /IEMobile|WPDesktop|Edge/i,
name: "Lumia",
version: {
start: "(Nokia |Lumia |Nokia;)",
item: 2
}
}],
version: {
start: "Nokia",
item: 1
}
// Lenovo
else if (/Lenovo|lepad/i.test(ret.ua)) {
ret.name = "Lenovo";
if (rep = ret.ua.match(/Lenovo[\ |\-|\/|\_]([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[1];
} else if (/lepad/i.test(ret.ua)) {
ret.name += ' LePad';
}, {
regEx: /Onda/i,
name: "Onda",
image: "onda"
}, {
regEx: /oppo/i,
name: "OPPO",
image: "oppo"
}, {
regEx: / Pixi\/| Pre\/|Palm|webos/i,
name: "Palm",
image: "palm",
childItem: [{
regEx: /Pixi/i,
name: "Pixi"
}, {
regEx: /Pre/i,
name: "Pre"
}]
}, {
regEx: /Galaxy Nexus|Smart-?TV|GT-|Samsung/i,
name: "Samsung",
image: "samsung",
childItem: [{
regEx: /Smart-?TV/i,
name: "Smart TV"
}, {
regEx: /Galaxy Nexus/i,
name: "Galaxy Nexus"
}, {
regEx: /GT-/i,
version: {
start: "GT-"
}
ret.image = "lenovo";
}],
version: {
start: "Samsung-(SCH-)?",
item: 2
}
// LG
else if (/LG/i.test(ret.ua)) {
ret.name = "LG";
if (rep = ret.ua.match(/LGE?([- \/])([0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[2];
}
ret.image = "lg";
}, {
regEx: /PlayStation/i,
name: "PlayStation",
image: "playstation",
version: {
start: "PlayStation "
}
// Motorola
else if (/\ Droid/i.test(ret.ua)) {
ret.name += "Motorola Droid";
ret.image = "motorola";
} else if (/XT720/i.test(ret.ua)) {
ret.name += "Motorola XT720";
ret.image = "motorola";
} else if (/MOT-/i.test(ret.ua) || /MIB/i.test(ret.ua)) {
ret.name = "Motorola";
if (rep = ret.ua.match(/MOTO([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[1];
}
if (rep = ret.ua.match(/MOT-([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[1];
}
ret.image = "motorola";
} else if (/XOOM/i.test(ret.ua)) {
ret.name += "Motorola Xoom";
ret.image = "motorola";
}, {
regEx: /SonyEricsson/i,
name: "SonyEricsson",
image: "sonyericsson",
version: {
start: "SonyEricsson"
}
// Nintendo
else if (/Nintendo/i.test(ret.ua)) {
ret.name = "Nintendo";
ret.image = "nintendo";
if (/Nintendo DSi/i.test(ret.ua)) {
ret.name += " DSi";
ret.image = "nintendodsi";
} else if (/Nintendo DS/i.test(ret.ua)) {
ret.name += " DS";
ret.image = "nintendods";
} else if (/Nintendo WiiU/i.test(ret.ua)) {
ret.name += " Wii U";
ret.image = "nintendowiiu";
} else if (/Nintendo Wii/i.test(ret.ua)) {
ret.name += " Wii";
ret.image = "nintendowii";
}
}, {
regEx: /vivo/i,
name: "vivo",
image: "vivo",
version: {
start: "VIVO "
}
// Nokia
else if (/Nokia/i.test(ret.ua)) {
ret.name = "Nokia";
ret.image = "nokia";
if (rep = ret.ua.match(/Nokia(E|N| )?([0-9]+)/i)) {
if (/IEMobile|WPDesktop/i.test(ret.ua)) {
// Nokia Windows Phone
if (rep[2] == '909') {
rep[2] = '1020';
}
// Lumia 1020
ret.name += " Lumia " + rep[2];
} else {
ret.name += " " + (typeof rep[1] === "undefined" ? "" : rep[1]) + rep[2];
}
} else if (rep = ret.ua.match(/Lumia ([0-9]+)/i)) {
ret.name += " Lumia " + rep[1];
}
}, {
regEx: /Xperia/i,
name: "Xperia",
image: "xperia",
version: {
start: "Xperia(-T)?( |\_|\-)?",
item: 3
}
// Onda
else if (/onda/i.test(ret.ua)) {
ret.name = "Onda";
ret.image = "onda";
}, {
regEx: /zte/i,
name: "ZTE",
image: "zte",
version: {
start: "ZTE "
}
// Onda
else if (/oppo/i.test(ret.ua)) {
ret.name = "OPPO";
ret.image = "oppo";
}, {
regEx: /Ubuntu; (Mobile|Tablet)/i,
name: "Ubuntu",
image: "ubuntutouch",
childItem: [{
regEx: /Mobile/i,
name: "Phone"
}, {
regEx: /Tablet/i,
name: "Tablet"
}]
}, {
regEx: /Nexus/i,
name: "Nexus",
image: "google-nexusone",
version: {
start: "Nexus "
}
}];
// Palm
else if (/\ Pixi\//i.test(ret.ua)) {
ret.name = "Palm Pixi";
ret.image = "palm";
} else if (/\ Pre\//i.test(ret.ua)) {
ret.name = "Palm Pre";
ret.image = "palm";
} else if (/Palm/i.test(ret.ua)) {
ret.name = "Palm";
ret.image = "palm";
} else if (/webos/i.test(ret.ua)) {
ret.name = "Palm";
ret.image = "palm";
}
var analyzeVersion = function(ret, deviceItem) {
var rep;
// Playstation
else if (/PlayStation/i.test(ret.ua)) {
ret.name = "PlayStation";
if (!('end' in deviceItem.version)) deviceItem.version.end = "";
if (!('item' in deviceItem.version)) deviceItem.version.item = 1;
if (/[PS|PlayStation\ ]3/i.test(ret.ua)) {
ret.name += " 3";
} else if (/[PS|PlayStation\ ]4/i.test(ret.ua)) {
ret.name += " 4";
} else if (/PlayStation Portable|PSP/i.test(ret.ua)) {
ret.name += " Portable";
} else if (/PlayStation Vita|PSVita/i.test(ret.ua)) {
ret.name += " Vita";
} else {}
var versionRegEx = new RegExp(deviceItem.version.start + "([.0-9a-zA-Z]+)" + deviceItem.version.end, "i");
ret.image = "playstation";
if (rep = ret.ua.match(versionRegEx)) {
ret.name += " " + rep[deviceItem.version.item].replace(/_/g, "");
//ret.addChild = false; // If it has some supplementary name then do not check child.
}
// Samsung
else if (/Galaxy Nexus/i.test(ret.ua)) {
ret.name = "Galaxy Nexus";
ret.image = "samsung";
} else if (/Smart-?TV/i.test(ret.ua)) {
ret.name = "Samsung Smart TV";
ret.image = "samsung";
} else if (/GT-/i.test(ret.ua)) {
ret.name = "Samsung";
};
if (rep = ret.ua.match(/GT-([.\-0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[1];
}
var analyzeItem = function(ret, deviceList) {
var rep = null;
var fixedName = "";
var i = 0;
var deviceItem = null;
for (var device in deviceList) { // We can use forEach instead on IE9+.
deviceItem = deviceList[device];
if (!(rep = ret.ua.match(deviceItem.regEx))) continue;
ret.image = "samsung";
} else if (/Samsung/i.test(ret.ua)) {
ret.name = "Samsung";
for (var singleName in deviceItem) {
var singleItem = deviceItem[singleName];
switch (singleName) {
case "childItem":
case "version":
case "regEx":
// Do nothing..
break;
case "name":
if (rep.length === 0) continue; // Didn't match
if (rep = ret.ua.match(/Samsung-([.\-0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[1];
if (ret[singleName] !== "") {
ret[singleName] += " ";
}
fixedName = singleItem;
for (i = 1; i < rep.length; i++) { // rep[0] is useless
fixedName = fixedName.replace(new RegExp("\\$" + i, "g"), rep[i]);
}
ret[singleName] += fixedName;
break;
default:
ret[singleName] = singleItem;
break;
}
}
ret.image = "samsung";
}
// Sony Ericsson
else if (/SonyEricsson/i.test(ret.ua)) {
ret.name = "SonyEricsson";
if (rep = ret.ua.match(/SonyEricsson([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[1];
var checkVersionSwitch = ('version' in deviceItem);
if ('childItem' in deviceItem) {
if (analyzeItem(ret, deviceItem.childItem)) {
checkVersionSwitch = false;
}
}
ret.image = "sonyericsson";
}
// vivo
else if (/vivo/i.test(ret.ua)) {
ret.name = "vivo";
ret.image = "vivo";
if (rep = ret.ua.match(/VIVO ([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[1];
if (checkVersionSwitch) {
analyzeVersion(ret, deviceItem);
}
}
// Xperia
else if (/Xperia/i.test(ret.ua)) {
ret.name = "Xperia";
ret.image = "xperia";
if (rep = ret.ua.match(/Xperia(-T)?( |\_|\-)?([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[3];
}
delete ret.addVersion;
return true;
}
// ZTE
else if (/zte/i.test(ret.ua)) {
ret.name = "ZTE";
ret.image = "zte";
if (rep = ret.ua.match(/ZTE(-T)?( |\_|\-)?([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[3];
}
}
return false;
};
// Ubuntu Phone/Tablet
else if (/Ubuntu\;\ Mobile/i.test(ret.ua)) {
ret.name = "Ubuntu Phone";
ret.image = "ubuntutouch";
} else if (/Ubuntu\;\ Tablet/i.test(ret.ua)) {
ret.name = "Ubuntu Tablet";
ret.image = "ubuntutouch";
}
var analyze = function(ret) {
var deviceItem = null;
var singleName = null;
var singleItem = null;
// Google
else if (/Nexus/i.test(ret.ua)) {
ret.name = "Nexus";
ret.image = "google-nexusone";
if (rep = ret.ua.match(/Nexus ([.0-9a-zA-Z]+)/i)) {
ret.name += " " + rep[1];
}
if (analyzeItem(ret, deviceList)) {
return;
}
// Apple

@@ -377,5 +397,8 @@ else if (/iPad/i.test(ret.ua)) {

// Node.js
//#JSCOVERAGE_IF typeof module !== 'undefined' && module.exports
if (typeof module !== 'undefined' && module.exports) {
module.exports = DEVICE;
}
//#JSCOVERAGE_ENDIF
//#JSCOVERAGE_IF typeof define !== 'undefined' && define.amd
// AMD

@@ -387,2 +410,4 @@ else if (typeof define !== 'undefined' && define.amd) {

}
//#JSCOVERAGE_ENDIF
//#JSCOVERAGE_IF typeof define !== 'undefined' && define.cmd
// CMD

@@ -393,2 +418,4 @@ else if (typeof define !== 'undefined' && define.cmd) {

});
//#JSCOVERAGE_ENDIF
//#JSCOVERAGE_IF typeof define === 'undefined' && typeof module === 'undefined'
} else {

@@ -398,3 +425,4 @@ root.USERAGENT_DEVICE = function() {};

}
//#JSCOVERAGE_ENDIF
})(this);

@@ -56,2 +56,3 @@ (function(root) {

break;
//#JSCOVERAGE_IF false
case "5.01":

@@ -61,2 +62,3 @@ ret.full = "Windows 2000 Service Pack 1";

break;
//#JSCOVERAGE_ENDIF
case "5.0":

@@ -84,3 +86,2 @@ ret.full = "Windows 2000";

ret.image = "win-2";
// @codeCoverageIgnoreStart
} else if (/Windows 2000/i.test(ret.ua)) {

@@ -122,3 +123,3 @@ ret.version = "5.0";

ret.image = "win-2";
// @codeCoverageIgnoreStart
//#JSCOVERAGE_IF false
} else if (/WM5/i.test(ret.ua)) {

@@ -129,2 +130,3 @@ ret.name += " Mobile";

ret.image = "win-phone";
//#JSCOVERAGE_ENDIF
} else if (/WindowsMobile/i.test(ret.ua)) {

@@ -135,3 +137,2 @@ ret.name += " Mobile";

}
// @codeCoverageIgnoreEnd
};

@@ -145,6 +146,40 @@

var rep = null;
var linuxRegEx = new RegExp([
"Arch ?Linux", "Chakra", "Crunchbang", "Debian", "Gentoo", "Kanotix", "Knoppix",
"LindowsOS", "Linspire", "Mageia", "Pardus", "Rosa", "Sabayon",
"Slackware", "Suse", "VectorLinux", "Venenux", "Xandros", "Zenwalk"
].join("|"), "i");
var defaultLinuxList = {
"arch linux": {
image: "archlinux",
name: "Arch Linux"
},
archlinux: {
name: "Arch Linux"
},
suse: {
name: "openSUSE"
},
lindowsos: {
name: "LindowsOS"
},
linspire: {
image: "lindowsos"
}
};
if (/[^A-Za-z]Arch/i.test(ret.ua)) {
ret.name = "Arch Linux";
ret.image = "archlinux";
var res = ret.ua.match(linuxRegEx);
if (res !== null) {
var name = res[0].toLowerCase();
ret.name = name.replace(/(\w)/, function(string) {
return string.toUpperCase();
});
ret.image = name;
if (typeof defaultLinuxList[name] !== 'undefined') {
ret.name = defaultLinuxList[name].name || ret.name;
ret.image = defaultLinuxList[name].image || ret.image;
}
} else if (/CentOS/i.test(ret.ua)) {

@@ -158,30 +193,3 @@ ret.name = "CentOS";

ret.image = "centos";
// @codeCoverageIgnoreStart
} else if (/Chakra/i.test(ret.ua)) {
ret.name = "Chakra Linux";
ret.image = "chakra";
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreStart
} else if (/Crunchbang/i.test(ret.ua)) {
ret.name = "Crunchbang";
ret.image = "crunchbang";
// @codeCoverageIgnoreEnd
} else if (/Debian/i.test(ret.ua)) {
ret.name = "Debian GNU/Linux";
ret.image = "debian";
// @codeCoverageIgnoreStart
} else if (/Edubuntu/i.test(ret.ua)) {
ret.name = "Edubuntu";
if (rep = ret.ua.match(/Edubuntu[\/|\ ]([.0-9a-zA-Z]+)/i)) {
ret.version = rep[1];
}
if (parseInt(ret.version) < 10) {
ret.image = "edubuntu-1";
} else {
ret.image = "edubuntu-2";
}
// @codeCoverageIgnoreEnd
} else if (/Fedora/i.test(ret.ua)) {

@@ -203,39 +211,3 @@ ret.name = "Fedora";

ret.image = "foresight";
} else if (/Gentoo/i.test(ret.ua)) {
ret.name = "Gentoo";
ret.image = "gentoo";
} else if (/Kanotix/i.test(ret.ua)) {
ret.name = "Kanotix";
ret.image = "kanotix";
// @codeCoverageIgnoreStart
} else if (/Knoppix/i.test(ret.ua)) {
ret.name = "Knoppix";
ret.image = "knoppix";
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreStart
} else if (/Kubuntu/i.test(ret.ua)) {
ret.name = "Kubuntu";
if (rep = ret.ua.match(/Kubuntu[\/|\ ]([.0-9]+)/i)) {
ret.version = rep[1];
if (parseInt(ret.version) < 10) {
ret.image = "kubuntu-1";
} else {
ret.image = "kubuntu-2";
}
} else {
ret.image = "kubuntu-2";
}
// @codeCoverageIgnoreEnd
} else if (/LindowsOS/i.test(ret.ua)) {
ret.name = "LindowsOS";
ret.image = "lindowsos";
} else if (/Linspire/i.test(ret.ua)) {
ret.name = "Linspire";
ret.image = "lindowsos";
} else if (/Linux\ Mint/i.test(ret.ua)) {

@@ -249,28 +221,7 @@ ret.name = "Linux Mint";

ret.image = "linuxmint";
// @codeCoverageIgnoreStart
//#JSCOVERAGE_IF false
} else if (/Lubuntu/i.test(ret.ua)) {
ret.name = "Lubuntu";
if (rep = ret.ua.match(/Lubuntu[\/|\ ]([.0-9a-zA-Z]+)/i)) {
ret.version = rep[1];
}
if (parseInt(ret.version) < 10) {
ret.image = "lubuntu-1";
} else {
ret.image = "lubuntu-2";
}
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreStart
} else if (/Mageia/i.test(ret.ua)) {
ret.name = "Mageia";
ret.image = "mageia";
// @codeCoverageIgnoreEnd
} else if (/Mandriva/i.test(ret.ua)) {
ret.name = "Mandriva";
// @codeCoverageIgnoreStart
//#JSCOVERAGE_IF false

@@ -280,3 +231,3 @@ if (rep = ret.ua.match(/mdv([.0-9a-zA-Z]+)/i)) {

}
// @codeCoverageIgnoreEnd
//#JSCOVERAGE_ENDIF

@@ -301,3 +252,3 @@ ret.image = "mandriva";

ret.image = "nova";
// @codeCoverageIgnoreStart
//#JSCOVERAGE_IF false

@@ -314,8 +265,5 @@ } else if (/Oracle/i.test(ret.ua)) {

ret.image = "oracle";
// @codeCoverageIgnoreEnd
//#JSCOVERAGE_ENDIF
} else if (/Pardus/i.test(ret.ua)) {
ret.name = "Pardus";
ret.image = "pardus";
// @codeCoverageIgnoreStart
//#JSCOVERAGE_IF false

@@ -330,3 +278,3 @@ } else if (/PCLinuxOS/i.test(ret.ua)) {

ret.image = "pclinuxos";
// @codeCoverageIgnoreEnd
//#JSCOVERAGE_ENDIF

@@ -342,59 +290,6 @@ } else if (/Red\ Hat/i.test(ret.ua) || /RedHat/i.test(ret.ua)) {

ret.image = "red-hat";
// @codeCoverageIgnoreStart
} else if (/Rosa/i.test(ret.ua)) {
ret.name = "Rosa Linux";
ret.image = "rosa";
// @codeCoverageIgnoreEnd
// Pulled out of order to help ensure better detection for above platforms
} else if (/(L|K|X|Ed)?Ubuntu/i.test(ret.ua)) {
// @codeCoverageIgnoreStart
} else if (/Sabayon/i.test(ret.ua)) {
ret.name = "Sabayon Linux";
ret.image = "sabayon";
// @codeCoverageIgnoreEnd
} else if (/Slackware/i.test(ret.ua)) {
ret.name = "Slackware";
ret.image = "slackware";
} else if (/Suse/i.test(ret.ua)) {
ret.name = "openSUSE";
ret.image = "suse";
// @codeCoverageIgnoreStart
} else if (/VectorLinux/i.test(ret.ua)) {
ret.name = "VectorLinux";
ret.image = "vectorlinux";
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreStart
} else if (/Venenux/i.test(ret.ua)) {
ret.name = "Venenux GNU Linux";
ret.image = "venenux";
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreStart
} else if (/Xandros/i.test(ret.ua)) {
ret.name = "Xandros";
ret.image = "xandros";
// @codeCoverageIgnoreEnd
// @codeCoverageIgnoreStart
} else if (/Xubuntu/i.test(ret.ua)) {
ret.name = "Xubuntu";
if (rep = ret.ua.match(/Xubuntu[\/|\ ]([.0-9a-zA-Z]+)/i)) {
ret.version = rep[1];
}
if (parseInt(ret.version) < 10) {
ret.image = "xubuntu-1";
} else {
ret.image = "xubuntu-2";
}
// @codeCoverageIgnoreEnd
} else if (/Zenwalk/i.test(ret.ua)) {
ret.name = "Zenwalk GNU Linux";
ret.image = "zenwalk";
}
// Pulled out of order to help ensure better detection for above platforms
else if (/Ubuntu/i.test(ret.ua)) {
ret.name = "Ubuntu";

@@ -413,2 +308,11 @@

if (rep = ret.ua.match(/(L|K|X|Ed)Ubuntu/i)) {
var childUbuntuVersion = rep[1].toLowerCase();
ret.name = childUbuntuVersion + ret.name;
ret.name = ret.name.toLowerCase().replace(/(\w)/, function(m) {
return m.toUpperCase();
});
ret.image = childUbuntuVersion + ret.image;
}
} else {

@@ -433,4 +337,61 @@ ret.name = "GNU/Linux";

var osRegEx = new RegExp([
"BB10", "BeOS", "DragonFly", "FreeBSD", "Inferno",
"SunOS", "Solaris", "J2ME\/MIDP",
"MorphOS", "NetBSD", "OpenBSD", "Unix", "webOS"
].join("|"), "i");
var defaultOSList = {
bb10: {
name: "BlackBerry OS 10",
image: "blackberry"
},
dragonfly: {
name: "DragonFly BSD",
image: "dragonflybsd"
},
freebsd: {
name: "FreeBSD"
},
morphos: {
name: "MorphOS"
},
openbsd: {
name: "OpenBSD"
},
netbsd: {
name: "NetBSD"
},
beos: {
name: "BeOS"
},
webos: {
name: "Palm webOS",
image: "palm"
},
sunos: {
name: "Solaris",
image: "solaris"
},
"j2me\/midp": {
name: "J2ME/MIDP Device",
image: "java"
}
};
var res = ret.ua.match(osRegEx);
if (res !== null) {
var name = res[0].toLowerCase();
ret.name = name.replace(/(\w)/, function(string) {
return string.toUpperCase();
});
ret.image = name;
if (typeof defaultOSList[name] !== 'undefined') {
ret.name = defaultOSList[name].name || ret.name;
ret.image = defaultOSList[name].image || ret.image;
}
}
// Opera's Useragent does not contains 'Linux'
if (/Android|ADR /i.test(ret.ua)) {
else if (/Android|ADR /i.test(ret.ua)) {
ret.name = "Android";

@@ -447,20 +408,5 @@ ret.image = "android";

ret.image = "amigaos";
} else if (/BB10/i.test(ret.ua)) {
ret.name = "BlackBerry OS 10";
ret.image = "blackberry";
} else if (/BeOS/i.test(ret.ua)) {
ret.name = "BeOS";
ret.image = "beos";
} else if (/\b(?!Mi)CrOS(?!oft)/i.test(ret.ua)) {
ret.name = "Google Chrome OS";
ret.image = "chromeos";
} else if (/DragonFly/i.test(ret.ua)) {
ret.name = "DragonFly BSD";
ret.image = "dragonflybsd";
} else if (/FreeBSD/i.test(ret.ua)) {
ret.name = "FreeBSD";
ret.image = "freebsd";
} else if (/Inferno/i.test(ret.ua)) {
ret.name = "Inferno";
ret.image = "inferno";
} else if (/IRIX/i.test(ret.ua)) {

@@ -496,11 +442,2 @@ ret.name = "IRIX";

}
} else if (/MorphOS/i.test(ret.ua)) {
ret.name = "MorphOS";
ret.image = "morphos";
} else if (/NetBSD/i.test(ret.ua)) {
ret.name = "NetBSD";
ret.image = "netbsd";
} else if (/OpenBSD/i.test(ret.ua)) {
ret.name = "OpenBSD";
ret.image = "openbsd";
} else if (/RISC OS/i.test(ret.ua)) {

@@ -512,5 +449,2 @@ ret.name = "RISC OS";

}
} else if (/Solaris|SunOS/i.test(ret.ua)) {
ret.name = "Solaris";
ret.image = "solaris";
} else if (/Symb(ian)?(OS)?/i.test(ret.ua)) {

@@ -522,12 +456,2 @@ ret.name = "SymbianOS";

ret.image = "symbian";
} else if (/Unix/i.test(ret.ua)) {
ret.name = "Unix";
ret.image = "unix";
// @codeCoverageIgnoreStart
} else if (/webOS/i.test(ret.ua)) {
ret.name = "Palm webOS";
ret.image = "palm";
} else if (/J2ME\/MIDP/i.test(ret.ua)) {
ret.name = "J2ME/MIDP Device";
ret.image = "java";
} else {

@@ -549,3 +473,3 @@ ret.name = "Unknown";

"ua": uaString,
"name": "",
name: "",
"version": "",

@@ -583,5 +507,8 @@ "full": "",

// Node.js
//#JSCOVERAGE_IF typeof module !== 'undefined' && module.exports
if (typeof module !== 'undefined' && module.exports) {
module.exports = OS;
}
//#JSCOVERAGE_ENDIF
//#JSCOVERAGE_IF typeof define !== 'undefined' && define.amd
// AMD

@@ -593,2 +520,4 @@ else if (typeof define !== 'undefined' && define.amd) {

}
//#JSCOVERAGE_ENDIF
//#JSCOVERAGE_IF typeof define !== 'undefined' && define.cmd
// CMD

@@ -599,2 +528,4 @@ else if (typeof define !== 'undefined' && define.cmd) {

});
//#JSCOVERAGE_ENDIF
//#JSCOVERAGE_IF typeof define === 'undefined' && typeof module === 'undefined'
} else {

@@ -604,3 +535,5 @@ root.USERAGENT_OS = function() {};

}
//#JSCOVERAGE_ENDIF
})(this);
{
"name": "useragent.js",
"version": "0.1.1",
"version": "0.2.0",
"description": "A simple project that allows you to display details about a computer's operating system or web browser with a user-agent.",
"main": "index.js",
"scripts": {
"test": "nodeunit test/test.js"
"test": "nodeunit test",
"coveralls": "jscoverage lib && UAJS_COV=1 nodeunit --reporter=lcov test | coveralls"
},

@@ -17,3 +18,3 @@ "repository": {

"author": "zsx <zsx@zsxsoft.com>",
"license": "ISC",
"license": "MIT",
"bugs": {

@@ -23,14 +24,19 @@ "url": "https://github.com/zsxsoft/useragent.js/issues"

"devDependencies": {
"nodeunit": "*",
"coveralls": "^2.11.2",
"grunt": "~0.4.1",
"grunt-closurecompiler": "~0.9.9",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-closurecompiler": "~0.9.9",
"grunt-text-replace": "*",
"grunt-contrib-copy": "*",
"grunt-transcoding": "*",
"grunt-contrib-clean": "*",
"grunt-contrib-jshint": "*",
"grunt-contrib-nodeunit": "*"
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-jshint": "^0.11.2",
"grunt-contrib-nodeunit": "^0.4.1",
"grunt-contrib-uglify": "^0.9.1",
"grunt-text-replace": "^0.4.0",
"grunt-transcoding": "^0.1.3",
"jscoverage": "^0.5.9",
"nodeunit": "^0.9.1"
},
"homepage": "https://github.com/zsxsoft/useragent.js"
}
"homepage": "https://github.com/zsxsoft/useragent.js",
"dependencies": {
}
}
useragent.js
===========
[![Coverage Status](https://coveralls.io/repos/zsxsoft/useragent.js/badge.svg)](https://coveralls.io/r/zsxsoft/useragent.js)
[![Build Status](https://travis-ci.org/zsxsoft/useragent.js.svg?branch=master)](https://travis-ci.org/zsxsoft/useragent.js)
A simple project that allows you to display details about a computer's operating system or web browser with a user-agent.

@@ -9,5 +13,6 @@

##Installion
```bash
$ npm install useragent.js
```
npm: ``$ npm install useragent.js``
bower: ``$ bower install useragent.js``
If you are using in your browser, you can run ```grunt``` to compress it.

@@ -14,0 +19,0 @@

@@ -1,4 +0,4 @@

var userAgent = require('../index.js');
var userAgent = require('../');
exports.testUserAgents = function(test) {
var testUAList = require('./ualist.js');
var testUAList = require('./resources/ualist.js');
for (var index in testUAList) {

@@ -5,0 +5,0 @@ var item = testUAList[index];

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc