Index: templates/chromeInfo.js.tmpl |
diff --git a/templates/chromeInfo.js.tmpl b/templates/chromeInfo.js.tmpl |
index b2ad41c79cb4a20a178e56b11ff6eb40283a3c2a..4217d8375640591d67621f7a7f57ad901b39493e 100644 |
--- a/templates/chromeInfo.js.tmpl |
+++ b/templates/chromeInfo.js.tmpl |
@@ -4,63 +4,61 @@ |
"use strict"; |
-(function() { |
- var platform = "chromium"; |
- var platformVersion = null; |
- var application = null; |
- var applicationVersion; |
+let platform = "chromium"; |
+let platformVersion = null; |
+let application = null; |
+let applicationVersion; |
- var regexp = /(\S+)\/(\S+)(?:\s*\(.*?\))?/g; |
- var match; |
+let regexp = /(\S+)\/(\S+)(?:\s*\(.*?\))?/g; |
+let match; |
- while (match = regexp.exec(navigator.userAgent)) |
- { |
- var app = match[1]; |
- var ver = match[2]; |
+while (match = regexp.exec(navigator.userAgent)) |
+{ |
+ let app = match[1]; |
+ let ver = match[2]; |
- if (app == "Chrome") |
- { |
- platformVersion = ver; |
- } |
- else if (app == "Edge") |
- { |
- platform = "edgehtml"; |
- platformVersion = ver; |
- application = "edge"; |
- applicationVersion = "0"; |
- } |
- else if (app != "Mozilla" && app != "AppleWebKit" && app != "Safari") |
- { |
- // For compatibility with legacy websites, Chrome's UA |
- // also includes a Mozilla, AppleWebKit and Safari token. |
- // Any further name/version pair indicates a fork. |
- application = app == "OPR" ? "opera" : app.toLowerCase(); |
- applicationVersion = ver; |
- } |
+ if (app == "Chrome") |
+ { |
+ platformVersion = ver; |
} |
- |
- // not a Chromium-based UA, probably modifed by the user |
- if (!platformVersion) |
+ else if (app == "Edge") |
{ |
- application = "unknown"; |
- applicationVersion = platformVersion = "0"; |
+ platform = "edgehtml"; |
+ platformVersion = ver; |
+ application = "edge"; |
+ applicationVersion = "0"; |
} |
- |
- // no additional name/version, so this is upstream Chrome |
- if (!application) |
+ else if (app != "Mozilla" && app != "AppleWebKit" && app != "Safari") |
{ |
- application = "chrome"; |
- applicationVersion = platformVersion; |
+ // For compatibility with legacy websites, Chrome's UA |
+ // also includes a Mozilla, AppleWebKit and Safari token. |
+ // Any further name/version pair indicates a fork. |
+ application = app == "OPR" ? "opera" : app.toLowerCase(); |
+ applicationVersion = ver; |
} |
+} |
+ |
+// not a Chromium-based UA, probably modifed by the user |
+if (!platformVersion) |
+{ |
+ application = "unknown"; |
+ applicationVersion = platformVersion = "0"; |
+} |
+ |
+// no additional name/version, so this is upstream Chrome |
+if (!application) |
+{ |
+ application = "chrome"; |
+ applicationVersion = platformVersion; |
+} |
- require.scopes.info = { |
- addonName: {{ metadata.get('general', 'basename')|json }}, |
- addonVersion: {{ version|json }}, |
+module.exports = { |
+ addonName: {{ basename|json }}, |
+ addonVersion: {{ version|json }}, |
- application: application, |
- applicationVersion: applicationVersion, |
+ application, |
+ applicationVersion, |
- platform: platform, |
- platformVersion: platformVersion |
- }; |
-})(); |
+ platform, |
+ platformVersion |
+}; |