WEB UI -- Simplified listener mechanism in theme.js to match that of prefs.js
 - minor cleanup of app.js

Change-Id: I1a05c5cb43c994937747ef69841d24a863128f4d
diff --git a/web/gui/src/main/webapp/app/view/topo/topoForce.js b/web/gui/src/main/webapp/app/view/topo/topoForce.js
index 6af88a3..93e8ddc 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoForce.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoForce.js
@@ -1040,6 +1040,11 @@
         };
     }
 
+    function updateLinksAndNodes() {
+        updateLinks();
+        updateNodes();
+    }
+    
     angular.module('ovTopo')
     .factory('TopoForceService',
         ['$log', '$timeout', 'FnService', 'SvgUtilService',
@@ -1067,10 +1072,7 @@
             fltr = _fltr_;
             tls = _tls_;
 
-            var themeListener = ts.addListener(function () {
-                updateLinks();
-                updateNodes();
-            });
+            ts.addListener(updateLinksAndNodes);
 
             // forceG is the SVG group to display the force layout in
             // uplink is the api from the main topo source file
@@ -1138,8 +1140,7 @@
                 td3.destroyD3();
                 tms.destroyModel();
                 // note: no need to destroy overlay service
-                ts.removeListener(themeListener);
-                themeListener = null;
+                ts.removeListener(updateLinksAndNodes);
 
                 // clean up the DOM
                 svg.selectAll('g').remove();