Add Touchpad to the Browser Object #2153

Closed
wants to merge 3 commits into
from
View
6 Source/Browser/Browser.js
@@ -19,9 +19,9 @@ provides: [Browser, Window, Document]
var document = this.document;
var window = document.window = this;
-var ua = navigator.userAgent.toLowerCase(),
+var ua = navigator.userAgent.toLowerCase().replace('hpwos', 'webos').replace('crmo', 'chrome'),
platform = navigator.platform.toLowerCase(),
- UA = ua.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || [null, 'unknown', 0],
+ UA = ua.match(/(opera|ie|firefox|chrome|webos|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || [null, 'unknown', 0],
mode = UA[1] == 'ie' && document.documentMode;
var Browser = this.Browser = {
@@ -30,7 +30,7 @@ var Browser = this.Browser = {
name: (UA[1] == 'version') ? UA[3] : UA[1],
- version: mode || parseFloat((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]),
+ version: mode || ((UA[1] == 'opera' && UA[4]) ? UA[4] : UA[2]),
Platform: {
name: ua.match(/ip(?:ad|od|hone)/) ? 'ios' : (ua.match(/(?:webos|android)/) || platform.match(/mac|win|linux/) || ['other'])[0]