diff web/views/top.tpl @ 251:b6079cb0c665

merge
author Matt Johnston <matt@ucc.asn.au>
date Wed, 27 May 2015 23:46:06 +0800
parents 141948a400a6
children 6c14e0573f50
line wrap: on
line diff
--- a/web/views/top.tpl	Thu May 21 00:01:09 2015 +0800
+++ b/web/views/top.tpl	Wed May 27 23:46:06 2015 +0800
@@ -14,16 +14,31 @@
  font-size: 70%;
  text-align: right;
 }
+
+#mainimage {
+	width: 100%;
+	max-width: {{graphwidth}}px;
+}
 //-->
 </style>
 <title></title>
 </head>
+<script type="text/javascript">
+function updatewidth() {
+	var width_input = document.getElementById("scaledwidth");
+	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" style="width: {{graphwidth}}" src="{{graphdata}}"/></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="{{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>