|
|
@ -19,8 +19,13 @@
|
|
|
|
<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">
|
|
|
|
<div class="section" id="chat-window">
|
|
|
|
<ul id="messages"></ul>
|
|
|
|
<ul id="messages"></ul>
|
|
|
|
|
|
|
|
<span><form id="form" action="">
|
|
|
|
|
|
|
|
<input id="input" autocomplete="off"/><button onclick="sendMessage()">>>></button>
|
|
|
|
|
|
|
|
</form></span>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="section">
|
|
|
|
<!-- <progress id="file" max="100" value="70"> 70% </progress> -->
|
|
|
|
<!-- <progress id="file" max="100" value="70"> 70% </progress> -->
|
|
|
|
<p>>>> CACHE CODE:</p>
|
|
|
|
<p>>>> CACHE CODE:</p>
|
|
|
|
<span><form id="form" action="">
|
|
|
|
<span><form id="form" action="">
|
|
|
@ -198,6 +203,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
//testing socket message from textinput field to arduino
|
|
|
|
//testing socket message from textinput field to arduino
|
|
|
|
var messages = document.getElementById('messages');
|
|
|
|
var messages = document.getElementById('messages');
|
|
|
|
|
|
|
|
var chatHistory = localStorage.getItem('chatHistory');
|
|
|
|
|
|
|
|
if (chatHistory) {
|
|
|
|
|
|
|
|
messages.innerHTML = chatHistory;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function sendMessage() {
|
|
|
|
function sendMessage() {
|
|
|
@ -207,15 +216,10 @@
|
|
|
|
item.textContent = message;
|
|
|
|
item.textContent = message;
|
|
|
|
item.className = 'me';
|
|
|
|
item.className = 'me';
|
|
|
|
messages.appendChild(item);
|
|
|
|
messages.appendChild(item);
|
|
|
|
|
|
|
|
|
|
|
|
if (message === 'BLINK') {
|
|
|
|
|
|
|
|
socket.emit('blink');
|
|
|
|
|
|
|
|
console.log('socket: blink');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inputField.value = '';
|
|
|
|
inputField.value = '';
|
|
|
|
|
|
|
|
|
|
|
|
socket.emit('chat message', message);
|
|
|
|
socket.emit('chat message', message);
|
|
|
|
|
|
|
|
messages.scrollTop = messages.scrollHeight;
|
|
|
|
|
|
|
|
localStorage.setItem('chatHistory', messages.innerHTML);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -224,8 +228,10 @@
|
|
|
|
item.textContent = msg;
|
|
|
|
item.textContent = msg;
|
|
|
|
item.className = 'others';
|
|
|
|
item.className = 'others';
|
|
|
|
messages.appendChild(item);
|
|
|
|
messages.appendChild(item);
|
|
|
|
|
|
|
|
messages.scrollTop = messages.scrollHeight - messages.clientHeight;
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|
<script type="text/javascript" src="js/input.js"></script>S
|
|
|
|
<script type="text/javascript" src="js/input.js"></script>
|
|
|
|
</html>
|
|
|
|
</html>
|
|
|
|