-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmenu.tpl
221 lines (195 loc) · 6.42 KB
/
menu.tpl
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="UTF-8">
<style>
/* -------------------------------------------------------
:: Colour definition
-------------------------------------------------------*/
:root {
--light-color: red;
--sound-color: green;
--video-color: blue;
}
/* -------------------------------------------------------*/
* {
margin: 0;
-webkit-transition: .3s;
transition: .3s ease 0s;
color: black;
background-color: #FFF;
}
.header {
margin: 12px auto;
}
h1 {
font: 20px Helvetica, sans-serif;
font-weight: lighter;
text-align: center;
}
h1 > #bold {
font-weight: bold;
}
.tabs > button.active {
border-bottom: medium solid rgba(255,100,0,.3);
font-size: 14px;
color: #111;
}
.tablink {
display:table-row-group;
border: none;
outline: none;
cursor: pointer;
padding: 8px 16px;
font-size: 13px;
width: 25%;
color: #666;
}
.tabs {
width: 100%;
margin: auto;
text-align: center;
position: fixed;
bottom: 0px;
padding-bottom: 10px;
}
.container > .tabcontent {
display: none;
padding: 20px;
text-align: center;
height: 100%;
width: 100%;
margin-bottom: 30px;
}
#light, #light > * {
color: var(--light-color);
}
#sound, #sound > * {
color: var(--sound-color);
}
#video, #video > * {
color: var(--video-color);
}
#light > button {
border-color: var(--light-color);
}
#sound > button {
border-color: var(--sound-color);
}
#video > button {
border-color: var(--video-color);
}
.container{
overflow: scroll;
display: flex;
flex-flow: row wrap;
justify-content: flex-end;
align-items: center;
}
.container > * {
margin: auto;
}
.tabcontent > button {
width: 120px;
height: 45px;
margin: 5px 5px;
border: .5px solid white;
border-radius: 2px;
}
.tabcontent > button:active {
color: #FFF;
border-top-width: 6px;
border-bottom-width: 6px;
-webkit-transition: .1s;
transition: .1s ease 0s;
}
*:focus { outline:0 !important; }
/* -------------------------------------------------------
:: Mobile Specific Styling
-------------------------------------------------------*/
/* -------------------------------------------------------
:: Desktop Specific Styling
-------------------------------------------------------*/
@media screen and (min-width: 1000px) {
.tabcontent > button{
width: 200px;
}
.tabs {
position: fixed;
bottom: 2px;
}
}
</style>
<title>Adressaparken Demo</title>
</head>
<body>
<div class="header">
<h1>ADRESSA<span id="bold">PARKEN</span> DEMO</h1>
</div>
<div class="container">
<div id="light" class="tabcontent">
<button onmousedown="httpGetAsync('lightrandom/1')">LED 1</button>
<button onmousedown="httpGetAsync('lightrandom/4')">LED 2</button>
<button onmousedown="httpGetAsync('lightrandom/7')">LED 3</button>
<button onmousedown="httpGetAsync('lightrandom/10')">LED 4</button>
<button onmousedown="httpGetAsync('lightrandom/13')">LED 5</button>
<button onmousedown="httpGetAsync('lightrandom/16')">LED 6</button>
<button onmousedown="httpGetAsync('lightrandom/19')">LED 7</button>
<button onmousedown="httpGetAsync('lightrandom/22')">LED 8</button>
<button onmousedown="httpGetAsync('lightrandom/25')">LED 9</button>
<button onmousedown="httpGetAsync('lightrandom/28')">LED 10</button>
<button onmousedown="httpGetAsync('lightall/0/0/40')">LED all blue</button>
<button onmousedown="httpGetAsync('lightall/255/255/255')">LED all white</button>
<button onmousedown="httpGetAsync('lightallrandom')">LED all random</button>
</div>
<div id="sound" class="tabcontent">
<button onmousedown="httpGetAsync('sound/3')">Speaker 1</button>
<button onmousedown="httpGetAsync('sound/4')">Speaker 2</button>
<button onmousedown="httpGetAsync('sound/5')">Speaker 3</button>
<button onmousedown="httpGetAsync('sound/6')">Speaker 4</button>
<button onmousedown="httpGetAsync('sound/7')">Speaker 5</button>
<button onmousedown="httpGetAsync('sound/8')">Speaker 6</button>
</div>
<div id="video" class="tabcontent">
<p> nothing yet </p>
</div>
</div>
<div class='tabs'>
<button class="tablink" onclick="openTab('light', event)" id="defaultOpen">Light</button>
<button class="tablink" onclick="openTab('sound', event)">Sound</button>
<button class="tablink" onclick="openTab('video', event)">Video</button>
</div>
<script>
function httpGetAsync(theUrl, callback)
{
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (callback!=null && xmlHttp.readyState == 4 && xmlHttp.status == 200)
callback(xmlHttp.responseText);
}
xmlHttp.open("GET", theUrl, true); // true for asynchronous
xmlHttp.send(null);
}
function openTab(name, evt) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="tablinks" and remove the class "active"
tablinks = document.getElementsByClassName("tablink");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
// Show the current tab, and add an "active" class to the button that opened the tab
document.getElementById(name).style.display = "block";
evt.currentTarget.className += " active";
}
// Get the element with id="defaultOpen" and click on it
document.getElementById("defaultOpen").click();
</script>
</body>
</html>