-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
124 lines (115 loc) · 3.91 KB
/
index.html
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!doctype html>
<html lang="en">
<head>
<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content = "height = device-height, width = 420, user-scalable = no" />
<link rel="stylesheet" type="text/css" href="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">
<title>heftruck</title>
<style type="text/css">
p {font-size: x-large}
button {
display: block;margin: 5px 5px 5px 5px;width: 300px;height: 100px;
font-size: 32pt;font-weight: bold;color: yellow;}
</style>
</head>
<body>
<header>
<p STYLE="color: green;"><b>Thomas More heftruck !</b></p>
</header>
<form method="GET">
<br><br><br>        
<input class="btn btn-success btn-lg" id="voor" value="voor" type="button">
        
<input class="btn btn-warning btn-lg" id="op" value="op" type="button"><br><br>
 
<input class="btn btn-info btn-lg" id="links" value="links" type="button"> 
<input class="btn btn-danger btn-lg" id="stop" value="stop" type="button"> 
<input class="btn btn-info btn-lg" id="rechts" value="rechts" type="button"><br><br>
       
<input class="btn btn-success btn-lg" id="achter" value="achter" type="button">
       
<input class="btn btn-success btn-lg" id="neer" value="neer" type="button"><br><br><br>
<img src="Heftruck.jpg" width="300" height="200" />
</form>
<!-- including the latest PubNub JavaScript SDK -->
<script src="//cdn.pubnub.com/pubnub-3.7.1.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
(function() {
// This is the channel name you choose in python
var channel = 'knop';
// Init
var p = PUBNUB.init({
subscribe_key: 'sub-c-0ebf3c70-c03d-11e5-8a35-0619f8945a4f',
publish_key: 'pub-c-9e2fd6cb-ef65-42c7-9707-87f997023175'
});
// Sending data
$('#voor').on('touchstart', function ledon(){p.publish({
channel : channel,
message : {knop: 1}
});})
$('#voor').on('touchend', function ledoff(){p.publish({
channel : channel,
message : {knop: 0}
});})
$('#achter').on('touchstart', function ledon(){p.publish({
channel : channel,
message : {knop: 2}
});})
$('#achter').on('touchend', function ledoff(){p.publish({
channel : channel,
message : {knop: 0}
});})
$('#links').on('touchstart', function ledoff(){p.publish({
channel : channel,
message : {knop: 3}
});})
$('#links').on('touchend', function ledoff(){p.publish({
channel : channel,
message : {knop: 0}
});})
$('#rechts').on('touchstart', function ledon(){p.publish({
channel : channel,
message : {knop: 4}
});})
$('#rechts').on('touchend', function ledoff(){p.publish({
channel : channel,
message : {knop: 0}
});})
$('#op').on('touchstart', function ledon(){p.publish({
channel : channel,
message : {knop: 5}
});})
$('#op').on('touchend', function ledoff(){p.publish({
channel : channel,
message : {knop: 0}
});})
$('#neer').on('touchstart', function ledon(){p.publish({
channel : channel,
message : {knop: 6}
});})
$('#neer').on('touchend', function ledoff(){p.publish({
channel : channel,
message : {knop: 0}
});})
p.subscribe({
channel: 'knop',
message: function(m){
console.log(m);
}
});
p.history({
channel: 'knop',
callback: function(m){
console.log(JSON.stringify(m))
},
count: 5, // 100 is the default
reverse: false // false is the default
});
})();
$(function(){
});
</script>
</body>
</html>