|
|
|
@ -9,47 +9,8 @@
|
|
|
|
|
<link href="style.css" rel="stylesheet">
|
|
|
|
|
<!-- <script src="js/p5.js"></script>
|
|
|
|
|
<script src="js/p5.geolocation.js"></script> -->
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.4.0/socket.io.js"></script>
|
|
|
|
|
<script>
|
|
|
|
|
const socket = io();
|
|
|
|
|
|
|
|
|
|
socket.on('node-data', function(data) {
|
|
|
|
|
console.log(data);
|
|
|
|
|
|
|
|
|
|
// Split the data into separate parts
|
|
|
|
|
const [node, value] = data.split(' ');
|
|
|
|
|
|
|
|
|
|
document.getElementById('log-text').textContent = `user ${value} entered zone ${node}`;
|
|
|
|
|
|
|
|
|
|
if (node === '3' && value === '15') {
|
|
|
|
|
// Change the background color to red
|
|
|
|
|
document.body.style.backgroundColor = 'red';
|
|
|
|
|
document.getElementById('location-log').style.display = 'block';
|
|
|
|
|
|
|
|
|
|
} else if (node === 'node4' && value === '21') {
|
|
|
|
|
// Change the background color to blue
|
|
|
|
|
document.body.style.backgroundColor = 'blue';
|
|
|
|
|
} else {
|
|
|
|
|
// Restore the default background color
|
|
|
|
|
document.body.style.backgroundColor = rgb(26, 26, 26);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//testing socket message from textinput field to arduino
|
|
|
|
|
function sendMessage() {
|
|
|
|
|
const inputField = document.getElementById('input');
|
|
|
|
|
const message = inputField.value;
|
|
|
|
|
|
|
|
|
|
if (message === 'BLINK') {
|
|
|
|
|
socket.emit('blink');
|
|
|
|
|
console.log('socket: blink');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inputField.value = '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
<script src='socket.io/socket.io.js'></script>
|
|
|
|
|
|
|
|
|
|
<meta property="og:title" content="EIXOGEN" />
|
|
|
|
|
<meta property="og:description" content="EIXOGEN" />
|
|
|
|
|
<meta property="og:image" content="" />
|
|
|
|
@ -59,6 +20,7 @@
|
|
|
|
|
<div class="flex-container">
|
|
|
|
|
<div class="flex-left">
|
|
|
|
|
<div class="section">
|
|
|
|
|
<ul id="messages"></ul>
|
|
|
|
|
<!-- <progress id="file" max="100" value="70"> 70% </progress> -->
|
|
|
|
|
<p>>>> CACHE CODE:</p>
|
|
|
|
|
<span><form id="form" action="">
|
|
|
|
@ -168,9 +130,9 @@
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
|
|
|
|
|
<!-- <script type="text/javascript" src="js/fence.js"></script> -->
|
|
|
|
|
<script type="text/javascript" src="js/level.js"></script>
|
|
|
|
|
<script type="text/javascript" src="js/input.js"></script>
|
|
|
|
|
<script>
|
|
|
|
|
<!-- <script type="text/javascript" src="js/level.js"></script> -->
|
|
|
|
|
|
|
|
|
|
<!-- <script>
|
|
|
|
|
window.onload = checkLevel();
|
|
|
|
|
function checkLevel(){
|
|
|
|
|
|
|
|
|
@ -205,6 +167,65 @@
|
|
|
|
|
|
|
|
|
|
}else {levelOne()};
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
</script> -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
<script>
|
|
|
|
|
const socket = io();
|
|
|
|
|
|
|
|
|
|
socket.on('node-data', function(data) {
|
|
|
|
|
console.log(data);
|
|
|
|
|
|
|
|
|
|
// Split the data into separate parts
|
|
|
|
|
const [node, value] = data.split(' ');
|
|
|
|
|
|
|
|
|
|
document.getElementById('log-text').textContent = `user ${value} entered zone ${node}`;
|
|
|
|
|
|
|
|
|
|
if (node === '3' && value === '15') {
|
|
|
|
|
// Change the background color to red
|
|
|
|
|
document.body.style.backgroundColor = 'red';
|
|
|
|
|
document.getElementById('location-log').style.display = 'block';
|
|
|
|
|
|
|
|
|
|
} else if (node === 'node4' && value === '21') {
|
|
|
|
|
// Change the background color to blue
|
|
|
|
|
document.body.style.backgroundColor = 'blue';
|
|
|
|
|
} else {
|
|
|
|
|
// Restore the default background color
|
|
|
|
|
document.body.style.backgroundColor = rgb(26, 26, 26);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//testing socket message from textinput field to arduino
|
|
|
|
|
var messages = document.getElementById('messages');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sendMessage() {
|
|
|
|
|
const inputField = document.getElementById('input');
|
|
|
|
|
const message = inputField.value;
|
|
|
|
|
var item = document.createElement('li');
|
|
|
|
|
item.textContent = message;
|
|
|
|
|
item.className = 'me';
|
|
|
|
|
messages.appendChild(item);
|
|
|
|
|
|
|
|
|
|
if (message === 'BLINK') {
|
|
|
|
|
socket.emit('blink');
|
|
|
|
|
console.log('socket: blink');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inputField.value = '';
|
|
|
|
|
|
|
|
|
|
socket.emit('chat message', message);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
socket.on('chat message', function(msg){
|
|
|
|
|
var item = document.createElement('li');
|
|
|
|
|
item.textContent = msg;
|
|
|
|
|
item.className = 'others';
|
|
|
|
|
messages.appendChild(item);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
<script type="text/javascript" src="js/input.js"></script>S
|
|
|
|
|
</html>
|
|
|
|
|