wip chat adding room

This commit is contained in:
lenovo
2022-12-06 19:48:19 +01:00
parent d0b39dbb82
commit 3b60f3952c
8 changed files with 47 additions and 22 deletions

View File

@@ -75,7 +75,6 @@
<!-- https://socket.io/docs/v4/client-installation/ -->
<!-- https://socket.io/docs/v4/client-api/ -->
<script src="https://cdn.socket.io/4.5.3/socket.io.min.js" integrity="sha384-WPFUvHkB1aHA5TDSZi6xtDgkF0wXJcIIxXhC6h8OT8EH3fC5PWro5pWJ1THjcfEi" crossorigin="anonymous"></script>
<script>
const socket = io("http://localhost:3000");

View File

@@ -1,4 +1,5 @@
socket.on('connect', () => {
//socket.emit('adduser', prompt("what's your name ?"));
socket.emit('adduser', "glurk");
//socket.emit('joinlastroom');
});

View File

@@ -7,7 +7,7 @@ const send_msg = () => {
div_msg.focus();
if (msg.length > 0) {
socket.emit('sendmsg', { data: msg });
socket.emit('sendmsg', msg);
add_message("me", msg);
}
}

View File

@@ -1,5 +1,5 @@
socket.on('updatemsg', (from, data) => {
//console.log("data: " + data);
console.log("data: " + data);
add_message(from, data);
});

View File

@@ -17,17 +17,48 @@
border-radius: 5px;
}
.chat_box #msg_thread div.others {
/* * * * * * * * * * * * * *
ALL MSG
*/
.chat_box #msg_thread div {
margin-left: 0px;
background-color: rgb(210, 210, 210);
max-width: 80%;
}
.chat_box #msg_thread div p.name {
margin: 0px;
font-size: 12px;
color: rgb(100, 100, 100);
}
.chat_box #msg_thread div p.msg {
margin: 5px 0px;
}
/* * * * * * * * * * * * * *
MSG PERSO
*/
.chat_box #msg_thread div.me {
margin-right: 0px;
margin-left: auto;
background-color: rgb(210, 110, 10);
}
.chat_box #msg_thread div.me p.name {
display: none;
}
/* * * * * * * * * * * * * *
MSG SERVER
*/
.chat_box #msg_thread div.SERVER {
margin-left: auto;
background-color: transparent;
}
.chat_box #msg_thread div.SERVER p.name {
display: none;
}
@@ -36,11 +67,3 @@
font-size: 12px;
color: rgb(100, 100, 100);
}
.chat_box #msg_thread div p.name {
margin: 0px;
font-size: 12px;
color: rgb(100, 100, 100);
}
.chat_box #msg_thread div p.msg {
margin-top: 10px;
}