Change color when selecting a row
authorJoey Schulze <joey@infodrom.org>
Mon, 9 Aug 2010 19:53:30 +0000 (19:53 +0000)
committerJoey Schulze <joey@infodrom.org>
Mon, 9 Aug 2010 19:53:30 +0000 (19:53 +0000)
src/InfoCon/stempel/status.wml

index b3ca0f4..293b449 100644 (file)
 ?>
 
 <script type="text/javascript">
+var color_checked = '#c4ffc3';
 function format_int(value, width)
 {
   var s = value.toString();
@@ -202,7 +203,9 @@ function check(id, value)
          if (value) {
              var ta = form.elements[i].parentNode.nextSibling.innerHTML.split(':');
              newval = newval + parseInt(ta[0]) * 60 + parseInt(ta[1]);
-         }
+             form.elements[i].parentNode.parentNode.style.backgroundColor = color_checked;
+         } else
+             form.elements[i].parentNode.parentNode.style.backgroundColor = '';
       }
   }
 
@@ -227,10 +230,13 @@ function add_sum(form, checkbox)
     var time = strtime(checkbox.parentNode.nextSibling.innerHTML);
     var newval;
 
-    if (checkbox.checked)
+    if (checkbox.checked) {
        newval = strtime(sum.innerHTML) + time;
-    else
+       checkbox.parentNode.parentNode.style.backgroundColor = color_checked;
+    } else {
        newval = strtime(sum.innerHTML) - time;
+       checkbox.parentNode.parentNode.style.backgroundColor = '';
+    }
     sum.innerHTML = timestr(newval);
 }
 </script>