changeset 1748:1b00969757d9

Make currently selected location marker pulse via CSS animation.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 18 Oct 2017 15:42:04 +0300
parents fb8c0c724a18
children 5958640cdd13
files colormap.c util.js
diffstat 2 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/colormap.c	Wed Oct 18 15:41:44 2017 +0300
+++ b/colormap.c	Wed Oct 18 15:42:04 2017 +0300
@@ -266,6 +266,14 @@
     "    font-weight: bold;\n"
     "    transform: scale(1.1);\n"
     "  }\n"
+    "  i.marker.nactive {\n"
+    "    animation: pulse 1s ease infinite;\n"
+    "  }\n"
+    "  @keyframes pulse {\n"
+    "    0%% { background: #000; }\n"
+    "    50%% { background: #f00; }\n"
+    "    100%% { background: #000; }\n"
+    "  }\n"
     );
     }
 
--- a/util.js	Wed Oct 18 15:41:44 2017 +0300
+++ b/util.js	Wed Oct 18 15:42:04 2017 +0300
@@ -4,7 +4,8 @@
 //
 
 var currLoc = "";
-var currClass;
+var currClass = "";
+var currMClass = "";
 
 var scrollTimerID = -1;
 var scrollPos0, scrollPos1;
@@ -94,15 +95,26 @@
 
 function jsSetActiveElem(nelem, newLoc)
 {
-  var celem;
+  var celem, mcelem;
   if (currLoc)
+  {
     celem = document.getElementById(currLoc);
+    mcelem = document.getElementById("m"+ currLoc);
+  }
+
+  var nmelem = document.getElementById("m"+ newLoc);
 
   if (celem && currClass != "")
     celem.className = currClass;
 
+  if (mcelem && currMClass != "")
+    mcelem.className = currMClass;
+
   currClass = nelem.className;
+  currMClass = nmelem.className;
   nelem.className += " nactive";
+  nmelem.className += " nactive";
+
 
   var opts = document.forms[0].slocation.options;
   var found = false;