diff web/views/top.tpl @ 250:141948a400a6

working zoom
author Matt Johnston <matt@ucc.asn.au>
date Wed, 27 May 2015 23:45:03 +0800
parents c490de0cf17e
children 6c14e0573f50
line wrap: on
line diff
--- a/web/views/top.tpl	Wed May 27 22:37:43 2015 +0800
+++ b/web/views/top.tpl	Wed May 27 23:45:03 2015 +0800
@@ -26,17 +26,19 @@
 <script type="text/javascript">
 function updatewidth() {
 	var width_input = document.getElementById("scaledwidth");
-	width_input.value = document.getElementById("mainimage").clientWidth;
+	var main_image = document.getElementById("mainimage");
+	width_input.value = main_image.clientWidth;
+	return true;
 }
 
 </script>
 <body>
-<form action="" method="get">
-<span class="no_selection"><input type="image" id="mainimage" src="{{graphdata}}" onclick="updatewidth();"/></span>
+<form action="" method="get" onsubmit="return updatewidth();">
+<span class="no_selection"><input type="image" id="mainimage" src="{{graphdata}}"/></span>
 <input type="hidden" name="length" value="{{length}}"/>
 <input type="hidden" name="end" value="{{end}}"/>
 <input type="hidden" name="zoom" value="yeah"/>
-<input type="hidden" name="scaledwidth" id="scaledwidth" value="-1"/>
+<input type="hidden" name="scaledwidth" id="scaledwidth" value="{{graphwidth}}"/>
 </form>
 <span class="codelink">Click to zoom in, click the left axis to zoom out. <a href="https://secure.ucc.asn.au/hg/templog/file/tip">Source code</a> for the Raspberry Pi controller and this web interface</a>. <a href="set">Adjustments</a> by phone.</span>
 </body>