forked from lavender/watch-party
Merge pull request 'add message timestamp on title' (#7) from annie/watch-party:timestamps into main
Reviewed-on: charlotte/watch-party#7votekiss
commit
727e72d89f
|
@ -52,6 +52,6 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="module" src="/main.mjs?v=5"></script>
|
<script type="module" src="/main.mjs?v=6"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -96,6 +96,21 @@ const checkDebounce = (event) => {
|
||||||
return shouldIgnore;
|
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} eventType
|
||||||
* @param {string?} user
|
* @param {string?} user
|
||||||
|
@ -105,6 +120,7 @@ const printChatMessage = (eventType, user, content) => {
|
||||||
const chatMessage = document.createElement("div");
|
const chatMessage = document.createElement("div");
|
||||||
chatMessage.classList.add("chat-message");
|
chatMessage.classList.add("chat-message");
|
||||||
chatMessage.classList.add(eventType);
|
chatMessage.classList.add(eventType);
|
||||||
|
chatMessage.title = getCurrentTimestamp();
|
||||||
|
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
const userName = document.createElement("strong");
|
const userName = document.createElement("strong");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { createSession } from "./watch-session.mjs?v=5";
|
import { createSession } from "./watch-session.mjs?v=6";
|
||||||
|
|
||||||
export const setupCreateSessionForm = () => {
|
export const setupCreateSessionForm = () => {
|
||||||
const form = document.querySelector("#create-session-form");
|
const form = document.querySelector("#create-session-form");
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { joinSession } from "./watch-session.mjs?v=5";
|
import { joinSession } from "./watch-session.mjs?v=6";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {HTMLInputElement} field
|
* @param {HTMLInputElement} field
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { setupVideo } from "./video.mjs?v=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
|
* @param {string} sessionId
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { setupJoinSessionForm } from "./lib/join-session.mjs?v=5";
|
import { setupJoinSessionForm } from "./lib/join-session.mjs?v=6";
|
||||||
|
|
||||||
const main = () => {
|
const main = () => {
|
||||||
setupJoinSessionForm();
|
setupJoinSessionForm();
|
||||||
|
|
Loading…
Reference in New Issue