From dc5418748db1e372791d49a2be7f63d0770fb94c Mon Sep 17 00:00:00 2001 From: Kasen IO Date: Sat, 27 Jun 2020 00:43:39 -0400 Subject: [PATCH] Fix time and date formatting. --- scripts/communityScripts/chat/FloofChat.html | 10 +++++++--- scripts/communityScripts/chat/FloofChat.js | 7 ++++--- scripts/communityScripts/chat/css/FloofChat.css | 5 +++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/scripts/communityScripts/chat/FloofChat.html b/scripts/communityScripts/chat/FloofChat.html index 3f4e19685b..b4a3f79978 100644 --- a/scripts/communityScripts/chat/FloofChat.html +++ b/scripts/communityScripts/chat/FloofChat.html @@ -323,7 +323,7 @@ location.reload(); } - function logMessage(userName, message, logScreen, colour) { + function logMessage(timestamp, userName, message, logScreen, colour) { var LogScreen = $("#" + logScreen); var $logLine = $('
') @@ -334,6 +334,10 @@ .addClass('z-depth-2') .data('chat-message', message).css("color", rgbToHex(colour)) .appendTo(LogScreen); + $('') + .addClass('LogLogLineTimestamp') + .text(timestamp).css("color", rgbToHex(colour)) + .appendTo($logLine); $('') .addClass('LogLogLineMessage') .text(userName + ": ").css("color", rgbToHex(colour)) @@ -431,11 +435,11 @@ var temp = cmd.data; if (temp.length === 1) { var temp2 = temp[0]; - logMessage("[" + temp2[0] + "] " + temp2[2], temp2[1], temp2[4], temp2[3]); + logMessage("[" + temp2[0] + "] ", temp2[2], temp2[1], temp2[4], temp2[3]); scrollChatLog(temp2[4]); } else if (temp.length > 1) { temp.forEach(function (msg) { - logMessage("[" + msg[0] + "] " + msg[2], msg[1], msg[4], msg[3]); + logMessage("[" + msg[0] + "] ", msg[2], msg[1], msg[4], msg[3]); scrollChatLog(msg[4]); }); } diff --git a/scripts/communityScripts/chat/FloofChat.js b/scripts/communityScripts/chat/FloofChat.js index e492b04b1b..5d7892e2dd 100644 --- a/scripts/communityScripts/chat/FloofChat.js +++ b/scripts/communityScripts/chat/FloofChat.js @@ -476,12 +476,13 @@ function time() { var m2 = ("0" + m).slice(-2); var s2 = ("0" + s).slice(-2); // s2 += (d.getMilliseconds() / 1000).toFixed(2).slice(1); - return month + "/" + day + "-" + h2 + ":" + m2 + ":" + s2; + return month + "/" + day + " - " + h2 + ":" + m2 + ":" + s2; } function addToLog(msg, dp, colour, tab) { - historyLog.push([time(), msg, dp, colour, tab]); - chatHistory.emitScriptEvent(JSON.stringify({type: "MSG", data: [[time(), msg, dp, colour, tab]]})); + var currentTimestamp = time(); + historyLog.push([currentTimestamp, msg, dp, colour, tab]); + chatHistory.emitScriptEvent(JSON.stringify({type: "MSG", data: [[currentTimestamp, msg, dp, colour, tab]]})); while (historyLog.length > chatHistoryLimit) { historyLog.shift(); } diff --git a/scripts/communityScripts/chat/css/FloofChat.css b/scripts/communityScripts/chat/css/FloofChat.css index f9d4bb1187..251d4834cf 100644 --- a/scripts/communityScripts/chat/css/FloofChat.css +++ b/scripts/communityScripts/chat/css/FloofChat.css @@ -100,6 +100,11 @@ body { /*font-style: italic;*/ } +.LogLogLineTimestamp { + font-weight: 300; + font-size: 16px; +} + .ChatInput { color: #252525; background: #252525;