You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
|
|
|
|
socket.on('data', function(data){
|
|
console.log(data);
|
|
document.getElementById('sample').style.opacity = data + "%";
|
|
});
|
|
|
|
socket.on('node5', function(sensor){
|
|
console.log(sensor);
|
|
document.getElementById("file").value = sensor;
|
|
if(distance5 > 0.02 && sensor == 50){
|
|
alert('u won.');
|
|
}
|
|
});
|
|
|
|
var form = document.getElementById('form');
|
|
var input = document.getElementById('input');
|
|
|
|
form.addEventListener('submit', function(e) {
|
|
// Remove the var keyword from this line
|
|
input = document.getElementById('input');
|
|
|
|
var inputString = $("#input").val();
|
|
log1 = document.querySelector('#log1');
|
|
log2 = document.querySelector('#log2');
|
|
log3 = document.querySelector('#log3');
|
|
log4 = document.querySelector('#log4');
|
|
log5 = document.querySelector('#log5');
|
|
dreamlog = document.querySelector('#dreamlog');
|
|
back2 = document.querySelector('#back2');
|
|
objective = document.querySelector('#objective');
|
|
|
|
e.preventDefault();
|
|
if (input.value) {
|
|
socket.emit('chat message', input.value);
|
|
input.value = '';
|
|
console.log(inputString);
|
|
}
|
|
|
|
|
|
if (inputString.includes('cheat')){
|
|
console.log('it works still');
|
|
|
|
}
|
|
|
|
|
|
else{
|
|
$("#input").text("inactive port");
|
|
|
|
}
|
|
});
|
|
|