Skip to content

Commit

Permalink
Merge pull request faisalman#334 from vladimyr/develop
Browse files Browse the repository at this point in the history
Detect Firefox Focus & Opera Touch
  • Loading branch information
faisalman authored Oct 6, 2018
2 parents 41cceca + bf79eab commit 46b9f0f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules/
npm-debug.log

### vim ###
.*.s[a-w][a-z]
*.un~
Expand All @@ -8,17 +9,20 @@ Session.vim
*~
.versions

### editors ###
.vscode
.idea
*.sublime-*

### OSX ###
.DS_Store
.AppleDouble
.LSOverride
Icon


# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes
.idea
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock=false
11 changes: 8 additions & 3 deletions src/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i // IE11
], [[NAME, 'IE'], VERSION], [

/(edge|edgios|edgea)\/((\d+)?[\w\.]+)/i // Microsoft Edge
/(edge|edgios|edga)\/((\d+)?[\w\.]+)/i // Microsoft Edge
], [[NAME, 'Edge'], VERSION], [

/(yabrowser)\/([\w\.]+)/i // Yandex
Expand All @@ -270,8 +270,13 @@
/(puffin)\/([\w\.]+)/i // Puffin
], [[NAME, 'Puffin'], VERSION], [

/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i
// UCBrowser
/(focus)\/([\w\.]+)/i // Firefox Focus
], [[NAME, 'Firefox Focus'], VERSION], [

/(opt)\/([\w\.]+)/i // Opera Touch
], [[NAME, 'Opera Touch'], VERSION], [

/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i // UCBrowser
], [[NAME, 'UCBrowser'], VERSION], [

/(comodo_dragon)\/([\w\.]+)/i // Comodo Dragon
Expand Down
29 changes: 29 additions & 0 deletions test/browser-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,15 @@
"major" : "1"
}
},
{
"desc": "Firefox Focus",
"ua": "Mozilla/5.0 (Linux; Android 7.0) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Focus/6.1.1 Chrome/68.0.3440.91 Mobile Safari/537.36",
"expect": {
"name": "Firefox Focus",
"version": "6.1.1",
"major": "6"
}
},
{
"desc" : "Flock",
"ua" : "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.3) Gecko/2008100716 Firefox/3.0.3 Flock/2.0",
Expand Down Expand Up @@ -719,6 +728,16 @@
"major" : "5"
}
},
{
"desc" : "Opera Touch",
"ua" : "Mozilla/5.0 (Linux; Android 7.0; Lenovo P2a42 Build/NRD90N) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/68.0.3440.91 Mobile Safari/537.36 OPT/1.10.33",
"expect" :
{
"name" : "Opera Touch",
"version" : "1.10.33",
"major" : "1"
}
},
{
"desc" : "PhantomJS",
"ua" : "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.2 Safari/534.34",
Expand Down Expand Up @@ -979,6 +998,16 @@
"major" : "12"
}
},
{
"desc" : "Microsoft Edge",
"ua" : "Mozilla/5.0 (Linux; Android 7.0; Lenovo P2a42 Build/NRD90N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.123 Mobile Safari/537.36 EdgA/42.0.0.2314",
"expect" :
{
"name" : "Edge",
"version" : "42.0.0.2314",
"major" : "42"
}
},
{
"desc" : "Iridium",
"ua" : "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Iridium/43.8 Safari/537.36 Chrome/43.0.2357.132",
Expand Down

0 comments on commit 46b9f0f

Please sign in to comment.