Fix time and date formatting.

This commit is contained in:
Kasen IO 2020-06-27 00:43:39 -04:00
parent 394c9e2175
commit dc5418748d
3 changed files with 16 additions and 6 deletions

View file

@ -323,7 +323,7 @@
location.reload();
}
function logMessage(userName, message, logScreen, colour) {
function logMessage(timestamp, userName, message, logScreen, colour) {
var LogScreen = $("#" + logScreen);
var $logLine =
$('<div/>')
@ -334,6 +334,10 @@
.addClass('z-depth-2')
.data('chat-message', message).css("color", rgbToHex(colour))
.appendTo(LogScreen);
$('<span/>')
.addClass('LogLogLineTimestamp')
.text(timestamp).css("color", rgbToHex(colour))
.appendTo($logLine);
$('<b/>')
.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]);
});
}

View file

@ -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();
}

View file

@ -100,6 +100,11 @@ body {
/*font-style: italic;*/
}
.LogLogLineTimestamp {
font-weight: 300;
font-size: 16px;
}
.ChatInput {
color: #252525;
background: #252525;