changeset 913:32532d4de594

Cleanups; Make the "selected" location blink.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 23 Apr 2010 08:57:48 +0000
parents 6e074c0fb196
children 570524776a68
files tooltip.js
diffstat 1 files changed, 26 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/tooltip.js	Fri Apr 23 08:31:50 2010 +0000
+++ b/tooltip.js	Fri Apr 23 08:57:48 2010 +0000
@@ -5,24 +5,24 @@
 document.onmousemove = utt;
 
 // Change background style of given element
-function shc(n, k) {
+function shc(n, k)
+{
 	document.getElementById(n).style['background'] = k;
 }
 
 
 // Hilite map and list elements of given number
-function qh(n) {
-	if (myhl >= 0) {
-		qn(myhl);
-	}
-
+function qh(n)
+{
+	if (myhl >= 0) qn(myhl);
 	shc('maploc'+n, 'white');
 	shc('listloc'+n, 'white');
 	myhl = n;
 }
 
 // Unlite
-function qn(n) {
+function qn(n)
+{
 	shc('maploc'+n, 'black');
 	shc('listloc'+n, 'black');
 	myhl = -1;
@@ -30,7 +30,8 @@
 
 
 // Update the tooltip box
-function utt(e) {
+function utt(e)
+{
 	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
 	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
 	if (mytt != null) {
@@ -68,7 +69,8 @@
 }
 
 // Show tooltip
-function stt(id) {
+function stt(id)
+{
 	if (mytt) {
 		mytt.style.display = "none";
 	}
@@ -89,13 +91,25 @@
 
 
 // Highlight one location (by index number) during page load
+var httID;
+var httST = 0;
+function httBlink(id)
+{
+	httST = !httST;
+	var mcolor = httST ? "white" : "black";
+	shc("maploc"+id, mcolor);
+	shc("listloc"+id, mcolor);
+}
+
+
 function httOnLoad()
 {
 	var s = window.location.href;
 	if (s.indexOf("?") >= 0) {
-		var n = unescape(s.substr(s.indexOf("?")+1).toLowerCase());
-		shc('maploc'+n, 'red');
-		shc('listloc'+n, 'red');
+		var n = parseInt(unescape(s.substr(s.indexOf("?")+1).toLowerCase()));
+		if (n != NaN) {
+			httID = setInterval("httBlink("+n+")", 500);
+		}
 	}
 }