Move Javascript and CSS code around
authorJoey Schulze <joey@infodrom.org>
Thu, 20 Aug 2009 14:51:47 +0000 (14:51 +0000)
committerJoey Schulze <joey@infodrom.org>
Thu, 20 Aug 2009 14:51:47 +0000 (14:51 +0000)
src/InfoCon/stempel/status.wml

index 339293c..7c65123 100644 (file)
@@ -1,70 +1,6 @@
 #include <infocon.style>
 #include "common.inc"
 
-<script type="text/javascript">
-function check(id, value)
-{
-  var form = document.forms[id];
-  var sum = document.getElementById('sum_'+id.toString()); 
-  var newval = 0;
-
-  for (i=0; i< form.elements.length; i++) {
-      if (form.elements[i].name.substr(0,4) == 'oid_') {
-         form.elements[i].checked = value;
-         if (value) {
-             var ta = form.elements[i].parentNode.nextSibling.innerHTML.split(':');
-             newval = newval + parseInt(ta[0]) * 60 + parseInt(ta[1]);
-         }
-      }
-  }
-
-  sum.innerHTML = newval.toString();
-}
-
-function plant(form)
-{
-  document.write('<div class="jscode">');
-  document.write('<a href="javascript:check('+form+',true)">Check all</a>');
-  document.write("&nbsp;/&nbsp;");
-  document.write('<a href="javascript:check('+form+',false)">Uncheck all</a>');
-  document.write("&nbsp;");
-  document.write('<span id="sum_'+form+'" class="sum">0</span>');
-  document.write("&nbsp;");
-  document.write('</div>');
-}
-
-var sum = array();
-function add_sum(form, checkbox)
-{
-    var sum = document.getElementById('sum_'+form.toString()); 
-    var newval;
-
-    var ta = checkbox.parentNode.nextSibling.innerHTML.split(':');
-    var time = parseInt(ta[0]) * 60 + parseInt(ta[1]);
-
-    if (checkbox.checked)
-       newval = parseInt(sum.innerHTML) + time;
-    else
-       newval = parseInt(sum.innerHTML) - time;
-    sum.innerHTML = newval.toString();
-}
-</script>
-
-<style type="text/css">
-div.jscode {
-  text-align: right;
-  margin-top: -13px;
-  font-size: 12px;
-}
-span.sum {
-  display: inline;
-  border: 1px solid #9b9b9b;
-  background: #d9e2ea;
-  width: 20px;
-  margin-left: 3px;
-}
-</style>
-
 <?
   function update_db()
   {
@@ -194,6 +130,70 @@ span.sum {
   }
 ?>
 
+<script type="text/javascript">
+function check(id, value)
+{
+  var form = document.forms[id];
+  var sum = document.getElementById('sum_'+id.toString()); 
+  var newval = 0;
+
+  for (i=0; i< form.elements.length; i++) {
+      if (form.elements[i].name.substr(0,4) == 'oid_') {
+         form.elements[i].checked = value;
+         if (value) {
+             var ta = form.elements[i].parentNode.nextSibling.innerHTML.split(':');
+             newval = newval + parseInt(ta[0]) * 60 + parseInt(ta[1]);
+         }
+      }
+  }
+
+  sum.innerHTML = newval.toString();
+}
+
+function plant(form)
+{
+  document.write('<div class="jscode">');
+  document.write('<a href="javascript:check('+form+',true)">Check all</a>');
+  document.write("&nbsp;/&nbsp;");
+  document.write('<a href="javascript:check('+form+',false)">Uncheck all</a>');
+  document.write("&nbsp;");
+  document.write('<span id="sum_'+form+'" class="sum">0</span>');
+  document.write("&nbsp;");
+  document.write('</div>');
+}
+
+var sum = array();
+function add_sum(form, checkbox)
+{
+    var sum = document.getElementById('sum_'+form.toString()); 
+    var newval;
+
+    var ta = checkbox.parentNode.nextSibling.innerHTML.split(':');
+    var time = parseInt(ta[0]) * 60 + parseInt(ta[1]);
+
+    if (checkbox.checked)
+       newval = parseInt(sum.innerHTML) + time;
+    else
+       newval = parseInt(sum.innerHTML) - time;
+    sum.innerHTML = newval.toString();
+}
+</script>
+
+<style type="text/css">
+div.jscode {
+  text-align: right;
+  margin-top: -13px;
+  font-size: 12px;
+}
+span.sum {
+  display: inline;
+  border: 1px solid #9b9b9b;
+  background: #d9e2ea;
+  width: 20px;
+  margin-left: 3px;
+}
+</style>
+
 <page func=InfoCon title="Stempeluhr">
 
 <?