From 4b5940df0f7063d707234b0d14e1fb47bea59599 Mon Sep 17 00:00:00 2001 From: Miroslav Pejic Date: Sun, 24 Jan 2021 10:58:45 +0100 Subject: [PATCH] [mirotalk] - add chat ghost theme + improve css --- www/client.js | 30 ++++++++++++++++++++---------- www/index.html | 13 ++++++++----- www/style.css | 37 +++++++++++++++---------------------- 3 files changed, 43 insertions(+), 37 deletions(-) diff --git a/www/client.js b/www/client.js index 6120d799..a99a0369 100644 --- a/www/client.js +++ b/www/client.js @@ -13,6 +13,7 @@ const loaderGif = "/images/loader.gif"; const myChatAvatar = "/images/programmer.png"; const friendChatAvatar = "/images/friend.png"; const notifyBySound = true; // turn on-off sound notifications + var myChatName = null; var signalingServerPort = 80; var signalingServer = getserverURL(); @@ -547,9 +548,9 @@ function setSendMsgBtn() { // chat room button click event // ===================================================== function setChatRoomBtn() { - // Make chat room draggable + // make chat room draggable dragElement(get("msgerDraggable")); - + // open-hide chat room get("chatRoomBtn").addEventListener("click", (e) => { if (noPeers()) { userLog("info", "Can't Open Chat Room, no peer connection detected"); @@ -563,7 +564,23 @@ function setChatRoomBtn() { isChatBoxVisible = false; } }); - + // ghost theme + undo + get("msgerTheme").addEventListener("click", (e) => { + if (e.target.className == "fas fa-ghost") { + e.target.className = "fas fa-undo"; + document.documentElement.style.setProperty('--msger-bg', 'transparent'); + } else { + e.target.className = "fas fa-ghost"; + document.documentElement.style.setProperty('--msger-bg', 'black'); + } + }); + // close chat room + get("msgerClose").addEventListener("click", (e) => { + get("msgerDraggable").style.display = "none"; + get("chatRoomBtn").className = "fas fa-comment"; + isChatBoxVisible = false; + }); + // chat send msg get("msgerSendBtn").addEventListener("click", (e) => { e.preventDefault(); // prevent refresh page const msg = get("msgerInput").value; @@ -574,12 +591,6 @@ function setChatRoomBtn() { get("msgerInput").value = ""; }); - - get("msgerHeaderHide").addEventListener("click", (e) => { - get("msgerDraggable").style.display = "none"; - get("chatRoomBtn").className = "fas fa-comment"; - isChatBoxVisible = false; - }); } // ===================================================== @@ -1099,4 +1110,3 @@ function formatDate(date) { const m = "0" + date.getMinutes(); return `${h.slice(-2)}:${m.slice(-2)}`; } - diff --git a/www/index.html b/www/index.html index c5107c4d..f0c06812 100755 --- a/www/index.html +++ b/www/index.html @@ -105,8 +105,9 @@
mirotalkChat
-
- +
+ +
@@ -151,9 +152,11 @@ type="text" placeholder="Enter your message..." /> - + diff --git a/www/style.css b/www/style.css index 336dde69..7da2c514 100755 --- a/www/style.css +++ b/www/style.css @@ -29,16 +29,15 @@ } :root { - --msger-bg: rgb(0, 0, 0); - /* --msger-bg: transparent; */ - --border: 0px solid #ddd; + --msger-bg: black; /* transparent; */ --left-msg-bg: #da05f3; --right-msg-bg: #579ffb; } * { outline: none; - font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, + Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; } body { @@ -69,8 +68,8 @@ body { display: none; position: absolute; z-index: 9; - background-color: #000000; - /* background: var(--msger-bg); */ + /* background-color: #000000; */ + background: var(--msger-bg); text-align: center; -webkit-animation: fadeIn ease-in 1; -moz-animation: fadeIn ease-in 1; @@ -93,7 +92,6 @@ body { justify-content: space-between; width: 412px; height: 732px; - border: var(--border); background: var(--msger-bg); } @@ -101,12 +99,15 @@ body { display: flex; justify-content: space-between; padding: 10px; - border-bottom: var(--border); background: rgb(0, 0, 0); color: #666; cursor: move; } +.msger-header-options:hover { + cursor: pointer; +} + .msger-chat { flex: 1; overflow-y: auto; @@ -178,9 +179,8 @@ body { .msger-inputarea { display: flex; padding: 10px; - border-top: var(--border); - background: rgb(2, 2, 2); - /* background: var(--msger-bg); */ + /* background: rgb(2, 2, 2); */ + background: var(--msger-bg); } .msger-inputarea * { @@ -196,28 +196,21 @@ body { background: rgb(0, 0, 0); } -.msger-send-btn { +#msgerSendBtn { margin-left: 10px; background: rgb(0, 0, 0); color: #fff; - font-weight: bold; cursor: pointer; transition: background 0.23s; } -.msger-send-btn:hover { +#msgerSendBtn:hover { background: rgb(0, 180, 50); - color: white; } .msger-chat { - background-color: black; - /* background: var(--msger-bg); */ -} - -.msger-header-hide:hover { - color: rgb(8, 189, 89); - cursor: pointer; + /* background-color: black; */ + background: var(--msger-bg); } video {