|
|
@ -19,6 +19,9 @@
|
|
|
|
<div class="wrapper">
|
|
|
|
<div class="wrapper">
|
|
|
|
<div class="flex-container">
|
|
|
|
<div class="flex-container">
|
|
|
|
<div class="flex-left">
|
|
|
|
<div class="flex-left">
|
|
|
|
|
|
|
|
<div class="section" >
|
|
|
|
|
|
|
|
<p>stream</p>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="section" id="chat-window">
|
|
|
|
<div class="section" id="chat-window">
|
|
|
|
<ul id="messages"></ul>
|
|
|
|
<ul id="messages"></ul>
|
|
|
|
<span><form id="form" action="">
|
|
|
|
<span><form id="form" action="">
|
|
|
@ -34,7 +37,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="section" id="objective"><br><br><br><br>
|
|
|
|
<div class="section" id="objective"><br><br><br><br>
|
|
|
|
<p>OBJECTIVE:<br>RUN</p>
|
|
|
|
<p>OBJECTIVE:<br>You have lost your memory and wake up in a strange garage.</p>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="section" >
|
|
|
|
|
|
|
|
<p>users online: </p>
|
|
|
|
|
|
|
|
<ul id="user-log"></ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<!-- <div>
|
|
|
|
<!-- <div>
|
|
|
|
<embed class ="embed" src="https://hack.chat/?mtmw">
|
|
|
|
<embed class ="embed" src="https://hack.chat/?mtmw">
|
|
|
@ -48,7 +55,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
<p id="log-text"></p>
|
|
|
|
<p id="log-text"></p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="section" id="nav-console">
|
|
|
|
<!-- <div class="section" id="nav-console">
|
|
|
|
|
|
|
|
|
|
|
|
<p>DISTANCE: <span id="distance">0</span> km</p>
|
|
|
|
<p>DISTANCE: <span id="distance">0</span> km</p>
|
|
|
|
|
|
|
|
|
|
|
@ -72,7 +79,7 @@
|
|
|
|
<span id="message">detecting....</span>
|
|
|
|
<span id="message">detecting....</span>
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div> -->
|
|
|
|
<div class="section" id="dreamlog">
|
|
|
|
<div class="section" id="dreamlog">
|
|
|
|
<p></p>
|
|
|
|
<p></p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
@ -178,6 +185,9 @@
|
|
|
|
</body>
|
|
|
|
</body>
|
|
|
|
<script>
|
|
|
|
<script>
|
|
|
|
const socket = io();
|
|
|
|
const socket = io();
|
|
|
|
|
|
|
|
const activeUsers = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateActiveUsers(); // Call it here to show active users on page load
|
|
|
|
|
|
|
|
|
|
|
|
socket.on('node-data', function(data) {
|
|
|
|
socket.on('node-data', function(data) {
|
|
|
|
console.log(data);
|
|
|
|
console.log(data);
|
|
|
@ -191,7 +201,6 @@
|
|
|
|
// Change the background color to red
|
|
|
|
// Change the background color to red
|
|
|
|
document.body.style.backgroundColor = 'red';
|
|
|
|
document.body.style.backgroundColor = 'red';
|
|
|
|
document.getElementById('location-log').style.display = 'block';
|
|
|
|
document.getElementById('location-log').style.display = 'block';
|
|
|
|
|
|
|
|
|
|
|
|
} else if (node === 'node4' && value === '21') {
|
|
|
|
} else if (node === 'node4' && value === '21') {
|
|
|
|
// Change the background color to blue
|
|
|
|
// Change the background color to blue
|
|
|
|
document.body.style.backgroundColor = 'blue';
|
|
|
|
document.body.style.backgroundColor = 'blue';
|
|
|
@ -208,7 +217,6 @@
|
|
|
|
messages.innerHTML = chatHistory;
|
|
|
|
messages.innerHTML = chatHistory;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sendMessage() {
|
|
|
|
function sendMessage() {
|
|
|
|
const inputField = document.getElementById('input');
|
|
|
|
const inputField = document.getElementById('input');
|
|
|
|
const message = inputField.value;
|
|
|
|
const message = inputField.value;
|
|
|
@ -220,18 +228,36 @@
|
|
|
|
socket.emit('chat message', message);
|
|
|
|
socket.emit('chat message', message);
|
|
|
|
messages.scrollTop = messages.scrollHeight;
|
|
|
|
messages.scrollTop = messages.scrollHeight;
|
|
|
|
localStorage.setItem('chatHistory', messages.innerHTML);
|
|
|
|
localStorage.setItem('chatHistory', messages.innerHTML);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
socket.on('chat message', function(msg){
|
|
|
|
socket.on('chat message', function(msg) {
|
|
|
|
var item = document.createElement('li');
|
|
|
|
var item = document.createElement('li');
|
|
|
|
item.textContent = msg;
|
|
|
|
item.textContent = msg;
|
|
|
|
item.className = 'others';
|
|
|
|
item.className = 'others';
|
|
|
|
messages.appendChild(item);
|
|
|
|
messages.appendChild(item);
|
|
|
|
messages.scrollTop = messages.scrollHeight - messages.clientHeight;
|
|
|
|
messages.scrollTop = messages.scrollHeight - messages.clientHeight;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
socket.on('connect', function() {
|
|
|
|
|
|
|
|
// Add the current socket ID to the activeUsers array
|
|
|
|
|
|
|
|
activeUsers.push(socket.id);
|
|
|
|
|
|
|
|
updateActiveUsers();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
socket.on('disconnect', function() {
|
|
|
|
|
|
|
|
// Remove the disconnected socket ID from the activeUsers array
|
|
|
|
|
|
|
|
const index = activeUsers.indexOf(socket.id);
|
|
|
|
|
|
|
|
if (index !== -1) {
|
|
|
|
|
|
|
|
activeUsers.splice(index, 1);
|
|
|
|
|
|
|
|
updateActiveUsers();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function updateActiveUsers() {
|
|
|
|
|
|
|
|
const userLog = document.getElementById('user-log');
|
|
|
|
|
|
|
|
userLog.textContent = activeUsers.join(', ');
|
|
|
|
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript" src="js/input.js"></script>
|
|
|
|
<script type="text/javascript" src="js/input.js"></script>
|
|
|
|
</html>
|
|
|
|
</html>
|
|
|
|