GUI -- Cleaned up user agent data injection
- function closure to prevent polluting global namespace
- d3 selection for cleaner setting of touch class

Change-Id: I2711ae32c2a32f051674024d7349e8de6f378d7c
diff --git a/web/gui/src/main/webapp/index.html b/web/gui/src/main/webapp/index.html
index b234057..79255b3 100644
--- a/web/gui/src/main/webapp/index.html
+++ b/web/gui/src/main/webapp/index.html
@@ -148,10 +148,13 @@
 
 <script>
     <!-- Inject user agent info into html element to allow CSS sensitivity. -->
-    var b = document.documentElement;
-    b.setAttribute('data-useragent',  navigator.userAgent);
-    b.setAttribute('data-platform', navigator.platform );
-    b.className += ((!!('ontouchstart' in window) || !!('onmsgesturechange' in window))?' touch':'');
+    (function () {
+        var t = !!('ontouchstart' in window) || !!('onmsgesturechange' in window);
+        d3.select(document.documentElement)
+            .attr('data-useragent', navigator.userAgent)
+            .attr('data-platform', navigator.platform)
+            .classed('touch', t);
+    }());
 </script>
 </body>
 </html>