changeset 2390:3ef5e7656f5e

Cleanup.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 06 Nov 2021 18:28:09 +0200
parents 9a95ee5f48ae
children c603badcad70
files src/util.js
diffstat 1 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/util.js	Sat Nov 06 18:11:50 2021 +0200
+++ b/src/util.js	Sat Nov 06 18:28:09 2021 +0200
@@ -145,17 +145,21 @@
     }
   }
 
-  var celem = document.getElementById(newLoc);
-  var mcelem = document.getElementById("m"+ newLoc);
-  if (celem && mcelem)
+  if (newLoc != null)
   {
-    celem.classList.add("nactive");
-    mcelem.classList.add("nactive");
+    var celem = document.getElementById(newLoc);
+    var mcelem = document.getElementById("m"+ newLoc);
+    if (celem && mcelem)
+    {
+      celem.classList.add("nactive");
+      mcelem.classList.add("nactive");
 
-    mapCurrLoc = newLoc;
-    mapCurrPos = mapFindElemCoords(celem);
+      mapCurrLoc = newLoc;
+      mapCurrPos = mapFindElemCoords(celem);
+    }
   }
 
+
   // Set the active item in the location dropdown
   var ssel = document.getElementById("slocation");
   if (ssel)
@@ -218,10 +222,10 @@
       {
         mapSetPosToElem(nelem);
       }
-
-      mapSetActiveLocation(newLoc);
     }
   }
+
+  mapSetActiveLocation(newLoc);
 }