From 50d304022dd0d068a8e29bd33f47b86df3fd52ce Mon Sep 17 00:00:00 2001 From: Chad Weider Date: Sun, 15 Jan 2012 19:03:03 -0800 Subject: [PATCH] Change calculation of `userAgent`. Default to 'node-js' only if no user agent can be found the normal way. --- static/js/ace2_common.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/static/js/ace2_common.js b/static/js/ace2_common.js index 4561b9192..1414f855a 100644 --- a/static/js/ace2_common.js +++ b/static/js/ace2_common.js @@ -80,14 +80,8 @@ function isArray(testObject) return testObject && typeof testObject === 'object' && !(testObject.propertyIsEnumerable('length')) && typeof testObject.length === 'number'; } -if (typeof exports !== "undefined") -{ - userAgent = "node-js"; -} -else -{ - userAgent = navigator.userAgent.toLowerCase(); -} +var userAgent = (((function () {return this;})().navigator || {}).userAgent || 'node-js').toLowerCase(); + // Figure out what browser is being used (stolen from jquery 1.2.1) var browser = { version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],