diff --git a/public/client.js b/public/client.js
index c789a41..dec8b4e 100644
--- a/public/client.js
+++ b/public/client.js
@@ -35,7 +35,7 @@ const joinRoom = (room) => {
});
$(".error").hide();
$(`#${room_id}-msg`).attr("data-joined", 1);
- $(`#${room_id}-msg,.write`).show();
+ $(`#${room_id}-msg`).show();
}
//requests server to leave a room
@@ -50,7 +50,7 @@ function leaveRoom(room) {
$(".error").html('You haven\'t joined this room yet. Join to see the conversation.');
$(`#${room_id}-msg`).attr("data-joined", 0);
- $(`#${room_id}-msg,.write`).hide();
+ $(`#${room_id}-msg`).hide();
$(".error").show();
}
@@ -83,7 +83,7 @@ const appendUserInfo = (room_name, description) => {
// Appending the content
const appendContentInfo = (room_name, online, data_joined) => {
- const $write = $("#write");
+ emobox = document.getElementById(`emobox`).outerHTML;
const $contentInfo = `
${room_name} Room (Leave room)
@@ -94,8 +94,17 @@ const appendContentInfo = (room_name, online, data_joined) => {
-
`;
@@ -201,7 +210,7 @@ socket.on('Display Message', (data) => {
div.setAttribute("data-chat", "person1")
username.innerText = data.user;
timestamp.innerText = hours + ":" + mins + ":" + secs + ", " + month + " " + day;
- userMsg.innerHTML = p;
+ userMsg.innerHTML = p.replace(/\n/g, '
');
if (class_name == 'self') {
username.classList.add("text-secondary");
timestamp.classList.add("text-secondary");
@@ -253,7 +262,6 @@ socket.on('room created other', (data) =>{
const { description, room_name, online, online_users } = data;
var date = new Date();
var room_id = convertIntoId(room_name);
- const $write = $("#write");
const $userInfo = `
${room_name}
@@ -261,7 +269,7 @@ socket.on('room created other', (data) =>{
`;
$('.people').append($userInfo);
-
+ emobox = document.getElementById(`emobox`).outerHTML;
const $contentInfo = `
${room_name} Room (Leave room)
@@ -272,8 +280,17 @@ socket.on('room created other', (data) =>{
-
`;
@@ -294,7 +311,6 @@ socket.on('destroy room', function(data) {
}
$(".error").hide();
- $(".write").css("display", "initial");
var room_id = convertIntoId(data);
$(`#${room_id}`).remove();
diff --git a/public/script.js b/public/script.js
index 0f4b1ba..35a13f9 100644
--- a/public/script.js
+++ b/public/script.js
@@ -5,7 +5,8 @@ $(document).ready(function() {
// event listener to dynamic element
$("body").on("keypress", '.textarea', function(val) {
- if (val.which == 13) {
+ if (val.which == 13 && val.shiftKey) {
+ val.preventDefault();
sendMessage($(this).val());
$(this).val("");
}
@@ -15,6 +16,7 @@ $(document).ready(function() {
const input = $(this).parents('.write').find('.textarea');
sendMessage(input.val());
input.val("");
+ input.focus();
});
// Prevent new room modal from closing on Enter key
@@ -57,10 +59,9 @@ const showRoom = (name) => {
if ($(`#${room_id}-msg`).attr("data-joined") == 0) {
$(".error").css("display", "inherit");
$(".error").html('
You haven\'t joined this room yet. Join to see the conversation.');
- $(`#${room_id}-msg,.write`).hide();
+ $(`#${room_id}-msg`).hide();
} else {
$(".error").hide();
- $(".write").css("display", "initial");
}
};
@@ -112,7 +113,7 @@ function closeSidebar() {
toggle.className += 'fa fa-angle-right';
}
-function openSidebar() {
+function openSidebar() {
const navbar = document.querySelector(".left");
navbar.classList.remove('menu-closed')
navbar.classList.add('open-menu')
@@ -125,30 +126,30 @@ function SidebarToggle() {
const navbar = document.querySelector(".left");
if (!navbar.classList.contains('menu-closed') && navbar.classList.contains('open-menu')) {
closeSidebar();
- }
+ }
else {
openSidebar();
document.body.addEventListener('click', function(event) {
const sidebar = document.getElementsByClassName('left')[0]; //Ensuring that clicks inside the sidebar(outside lobbies) don't make the sidebar collapse
const lobbyName = document.getElementsByClassName('person'); //In case user clicks a lobby from the sidebar, the sidebar collapse. This is a list of classes
const addLobbyPage = document.getElementById('room'); //Ensuring that clicks on page to add lobby names doesn't make the sidebar collapse
- for (let i=0; i
-1){
var notfication = data.split('|');
msgHeader = notfication[0];
@@ -168,7 +169,7 @@ function notify(data, type){
${msgBody}
`;
-
+
$('#toast-wrapper').append(toastTemplate);
// Init notiifications
$('.toast').toast({delay: 3000});
@@ -176,4 +177,4 @@ function notify(data, type){
$(`#${notficationID}`).on('hidden.bs.toast', function () {
$(`#${notficationID}`).remove();
});
-}
\ No newline at end of file
+}
diff --git a/public/style.css b/public/style.css
index 838a71c..70f0df9 100644
--- a/public/style.css
+++ b/public/style.css
@@ -4,6 +4,11 @@
box-sizing: border-box;
}
+/* To style icons of font-awesome */
+.icon {
+ font-size: 2rem
+}
+
li {
list-style: none;
}
@@ -200,84 +205,6 @@ body {
}
}
-.write {
- z-index: 10;
- position: absolute;
- bottom: 16px;
- height: 42px;
- width: 95% !important;
- margin-left: 1em;
- border: 1px solid #e6e6e6;
- background-color: #eceff1;
- width: inherit;
- -moz-border-radius: 5px;
- -webkit-border-radius: 5px;
- border-radius: 5px;
-}
-
-.write input {
- font-size: 16px;
- float: left;
- width: -moz-calc(100% - 90px);
- width: -webkit-calc(100% - 90px);
- width: -o-calc(100% - 90px);
- width: calc(100% - 90px);
- height: 40px;
- padding: 0 10px;
- color: #1a1a1a;
- border: 0;
- outline: none;
- background-color: transparent;
- font-family: 'Source Sans Pro', sans-serif;
- font-weight: 400;
-}
-
-.write-right {
- float: right;
-}
-
-.write .write-link.smiley:before {
- display: inline-block;
- float: left;
- width: 40px;
- height: 42px;
- content: '';
- background-size: 30px 30px;
- background-repeat: no-repeat;
- background-position: center;
-}
-
-/* font-awesome smiley */
-.fa-smile {
- position: absolute;
- font-size: 32px;
- right: 3.5rem;
- bottom: 0.3rem;
- color: #57585a;
-}
-
-.write .write-link.send {
- display: inline-block;
- float: left;
- width: 42px;
- height: 42px;
- margin-left: 5px;
- content: '';
- background-size: 38px 38px;
- background-repeat: no-repeat;
- background-position: center;
-}
-
-/* font-awesome send */
-.fa-paper-plane {
- font-size: 30px;
- margin-top: 0.3rem;
-}
-
-.write#join {
- padding-left: 0;
-}
-
.app-container .right .card.others {
float: left;
}
@@ -300,11 +227,6 @@ body {
background-size: 40px 42px;
}
-/* font-awesome class */
-.fa-plus-circle {
- font-size: 40px;
-}
-
#newRoom:hover, #submit:hover, #cancel:hover {
border-color: #0b2d63;
color: #0b2d63;
diff --git a/views/index.ejs b/views/index.ejs
index a5949f9..8c9e643 100644
--- a/views/index.ejs
+++ b/views/index.ejs
@@ -33,7 +33,7 @@