summaryrefslogtreecommitdiffstats
path: root/Lasers_und_stuff/templates/status.html
blob: 0b1b24dbba098b7036cbdd2ee8e9b64c65d46da8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{% extends "layout.html" %}
{% block body %}
<script type=text/javascript src="{{url_for('static', filename='jquery.min.js') }}"> </script>
<script type=text/javascript>
	
	function update() {
  		update_status();
    	window.setTimeout(update, 100000000);
	}
	
	$("document").ready(function(data) {
		update();
	});
	
	function move_right() {
		$.post("/right/20", function(data) {
  			update_status();
		});
	}
	
	function move_left() {
		$.post("/left/20", function(data) {
  			update_status();
		});
	}
	
	function move_down() {
		$.post("/down/20", function(data) {
  			update_status();
		});
	}
	
	function move_up() {
		$.post("{{url_for('move_up', amount="20")}}", function(data) {
			update_status();
		});
	}
	
	function fire() {
		$.post("/fire", function(data) {
			
		});
	}
	
	function stop_fire() {
		$.post("/stop_fire", function(data) {
			
		});
	}
	
	function update_status() {
		$.get("/status", function(data) {
				$('#status').html(data);
  			});
	}
	
</script>
  	<div style="width: 400px; height: 400px; margin-top: -200px; margin-left: -200px; position: absolute; top: 50%; left: 50%;">
            <h2>Hello in cannon controller, adjust angles!</h2>
            <p>Angles can be in range 0:255</p>
            <a  onclick="move_up()">Up</a>
            <a onclick="move_down()">Down</a>
            <a onclick="move_left()">Left</a>
            <a onclick="move_right()">Right</a>
            <p><a onclick="fire()">Fire!</a> <a onclick="stop_fire()">Stop</a></p>
            
            <h2>Status: </h2> <p id="status">{{data}}</p></div>
    </body>
    
{% endblock %}