-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
39 lines (32 loc) · 1.33 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
<html>
<head>
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0"/>
<title>Acasa</title>
<link rel="stylesheet" type="text/css" href="/style.css" />
</head>
<body>
<div class="maingate_button">
<span>Deschide poarta</span>
<div class="rotate"></div>
</div>
</body>
<script src="/socket.io/socket.io.js"></script>
<script>
const socket = io();
var mainGateButton = document.getElementsByClassName('maingate_button')[0];
mainGateButton.addEventListener('click', mainGateButtonHandler, true)
var buttonDisabled = false;
function mainGateButtonHandler() {
if (!buttonDisabled) {
buttonDisabled = true;
mainGateButton.removeEventListener('click', mainGateButtonHandler, true);
mainGateButton.classList.add('loading');
setTimeout(function(){ mainGateButton.classList.remove('loading'); mainGateButton.classList.add('checked')}, 1500)
setTimeout(function(){ mainGateButton.classList.remove('checked');}, 2500)
setTimeout(function(){ buttonDisabled = false; mainGateButton.addEventListener('click', mainGateButtonHandler, true)}, 3000)
socket.emit('mainGateButtonClick');
console.log('called frontend');
}
}
</script>
</html>