Merge pull request 'add message timestamp on title' (#7) from annie/watch-party:timestamps into main

Reviewed-on: charlotte/watch-party#7
main
maia arson crimew 2022-01-15 23:06:24 +00:00
commit 727e72d89f
6 changed files with 21 additions and 5 deletions

View File

@ -52,6 +52,6 @@
</form>
</div>
<script type="module" src="/main.mjs?v=5"></script>
<script type="module" src="/main.mjs?v=6"></script>
</body>
</html>

View File

@ -96,6 +96,21 @@ const checkDebounce = (event) => {
return shouldIgnore;
};
/**
* @returns {string}
*/
const getCurrentTimestamp = () => {
const t = new Date();
return `${matpad(t.getHours())}:${matpad(t.getMinutes())}:${matpad(t.getSeconds())}`;
};
/**
* https://media.discordapp.net/attachments/834541919568527361/931678814751301632/66d2c68c48daa414c96951381665ec2e.png
*/
const matpad = (n) => {
return ("00" + n).slice(-2);
};
/**
* @param {string} eventType
* @param {string?} user
@ -105,6 +120,7 @@ const printChatMessage = (eventType, user, content) => {
const chatMessage = document.createElement("div");
chatMessage.classList.add("chat-message");
chatMessage.classList.add(eventType);
chatMessage.title = getCurrentTimestamp();
if (user != null) {
const userName = document.createElement("strong");

View File

@ -1,4 +1,4 @@
import { createSession } from "./watch-session.mjs?v=5";
import { createSession } from "./watch-session.mjs?v=6";
export const setupCreateSessionForm = () => {
const form = document.querySelector("#create-session-form");

View File

@ -1,4 +1,4 @@
import { joinSession } from "./watch-session.mjs?v=5";
import { joinSession } from "./watch-session.mjs?v=6";
/**
* @param {HTMLInputElement} field

View File

@ -1,5 +1,5 @@
import { setupVideo } from "./video.mjs?v=5";
import { setupChat, logEventToChat } from "./chat.mjs?v=5";
import { setupChat, logEventToChat } from "./chat.mjs?v=6";
/**
* @param {string} sessionId

View File

@ -1,4 +1,4 @@
import { setupJoinSessionForm } from "./lib/join-session.mjs?v=5";
import { setupJoinSessionForm } from "./lib/join-session.mjs?v=6";
const main = () => {
setupJoinSessionForm();