From 282d4133e86c30ab1460c50391f916b52732ad87 Mon Sep 17 00:00:00 2001 From: rainbow napkin Date: Wed, 14 Oct 2026 03:13:38 -0400 Subject: [PATCH] Added chat timestamps, started work on nameplate settings --- src/app/chatMetadata.js | 8 +++++++- src/schemas/channel/chatSchema.js | 4 ++++ src/views/partial/panels/settings.ejs | 8 ++++++++ www/css/channel.css | 4 ++++ www/js/channel/chatPostprocessor.js | 19 +++++++++++++++---- 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/app/chatMetadata.js b/src/app/chatMetadata.js index 92fc1ce..c187057 100644 --- a/src/app/chatMetadata.js +++ b/src/app/chatMetadata.js @@ -26,8 +26,9 @@ class chatMetadata{ * @param {String} msg - Contents of the message, with links replaced with numbered file-seperator markers * @param {String} type - Message Type Identifier, used for client-side processing. * @param {Array} links - Array of URLs/Links included in the message. + * @param {Number} timestamp - UTC Epoch from when message was sent */ - constructor(user, flair, highLevel, msg, type, links){ + constructor(user, flair, highLevel, msg, type, links, timestamp = new Date.now()){ /** * Name of user who sent the message */ @@ -57,6 +58,11 @@ class chatMetadata{ * Array of URLs/Links included in the message. */ this.links = links; + + /** + * Datetime message was sent + */ + this.timestamp = timestamp; } } diff --git a/src/schemas/channel/chatSchema.js b/src/schemas/channel/chatSchema.js index abeb9ab..641cd32 100644 --- a/src/schemas/channel/chatSchema.js +++ b/src/schemas/channel/chatSchema.js @@ -51,6 +51,10 @@ const chatSchema = new mongoose.Schema({ type: [linkSchema], required: true, }, + timestamp: { + type: mongoose.SchemaTypes.Number, + default: Date.now() + } }); module.exports = chatSchema; \ No newline at end of file diff --git a/src/views/partial/panels/settings.ejs b/src/views/partial/panels/settings.ejs index 790649f..6882f4e 100644 --- a/src/views/partial/panels/settings.ejs +++ b/src/views/partial/panels/settings.ejs @@ -46,6 +46,14 @@ along with this program. If not, see . %> + +

Chat nameplate:

+ +

Aspect Ratio Lock Limiter:

diff --git a/www/css/channel.css b/www/css/channel.css index 728201b..216abad 100644 --- a/www/css/channel.css +++ b/www/css/channel.css @@ -171,6 +171,10 @@ p.panel-head-element{ font-size: 10pt; } +.chat-entry-nameplate{ + display: flex; +} + .chat-entry-username, .pm-panel-sesh-entry-username{ margin: auto 0.2em auto 0; text-wrap: nowrap; diff --git a/www/js/channel/chatPostprocessor.js b/www/js/channel/chatPostprocessor.js index 1ab660c..6717e83 100644 --- a/www/js/channel/chatPostprocessor.js +++ b/www/js/channel/chatPostprocessor.js @@ -108,11 +108,19 @@ class chatPostprocessor{ `${classSuffix}-${color}` ); + //Create Date object from message timestamp + let timestamp = new Date(this.rawData.timestamp); + + //Create nameplate span to hold username and high level + let nameplate = document.createElement('span'); + nameplate.classList.add(`${classSuffixAlt}-buffer`, `${classSuffix}-entry-nameplate`, ); + nameplate.title = timestamp.toLocaleString(); + //Create high-level label let highLevel = document.createElement('p'); highLevel.classList.add(`${classSuffixAlt}-buffer`,`${classSuffix}-entry-high-level`,"high-level"); highLevel.textContent = utils.unescapeEntities(`${this.rawData.highLevel}`); - this.chatEntry.appendChild(highLevel); + nameplate.appendChild(highLevel); //If we're not using classic flair if(this.rawData.flair != "classic"){ @@ -120,7 +128,7 @@ class chatPostprocessor{ flair = `flair-${this.rawData.flair}`; } - //Create username label + //Create username label to the nameplate let userLabel = document.createElement('p'); userLabel.classList.add(`${classSuffixAlt}-buffer`, `${classSuffix}-entry-username`, ); @@ -132,8 +140,11 @@ class chatPostprocessor{ //Inject flair span into user label before the colon userLabel.innerHTML = `${flairSpan.outerHTML}: `; - //Append user label - this.chatEntry.appendChild(userLabel); + //Append user label to the nameplate + nameplate.appendChild(userLabel); + + //Append nameplate to the chat entry + this.chatEntry.appendChild(nameplate); //Create chat body this.chatBody = document.createElement('p');