forked from lavender/watch-party
Compare commits
1 Commits
experiment
...
main
Author | SHA1 | Date |
---|---|---|
Charlotte Som | 20fecd6891 |
|
@ -43,6 +43,15 @@ export const setupChat = async (socket) => {
|
||||||
document.querySelector("#chatbox-container").style["display"] = "block";
|
document.querySelector("#chatbox-container").style["display"] = "block";
|
||||||
setupChatboxEvents(socket);
|
setupChatboxEvents(socket);
|
||||||
|
|
||||||
|
window.addEventListener("keydown", event => {
|
||||||
|
try {
|
||||||
|
const isSelectionEmpty = window.getSelection().toString().length === 0;
|
||||||
|
if (event.code.match(/Key\w/) && isSelectionEmpty)
|
||||||
|
document.querySelector("#chatbox-send > input").focus()
|
||||||
|
} catch (_err) {
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
fixChatSize();
|
fixChatSize();
|
||||||
window.addEventListener("resize", () => {
|
window.addEventListener("resize", () => {
|
||||||
fixChatSize();
|
fixChatSize();
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { setupChat, logEventToChat } from "./chat.mjs?v=5";
|
||||||
const createWebSocket = (sessionId, nickname) => {
|
const createWebSocket = (sessionId, nickname) => {
|
||||||
const wsUrl = new URL(
|
const wsUrl = new URL(
|
||||||
`/sess/${sessionId}/subscribe` +
|
`/sess/${sessionId}/subscribe` +
|
||||||
`?nickname=${encodeURIComponent(nickname)}`,
|
`?nickname=${encodeURIComponent(nickname)}`,
|
||||||
window.location.href
|
window.location.href
|
||||||
);
|
);
|
||||||
wsUrl.protocol = { "http:": "ws:", "https:": "wss:" }[wsUrl.protocol];
|
wsUrl.protocol = { "http:": "ws:", "https:": "wss:" }[wsUrl.protocol];
|
||||||
|
@ -73,7 +73,7 @@ const setupIncomingEvents = (video, socket) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
logEventToChat(event);
|
logEventToChat(event);
|
||||||
} catch (_err) {}
|
} catch (_err) { }
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -86,7 +86,6 @@ const setupOutgoingEvents = (video, socket) => {
|
||||||
|
|
||||||
video.addEventListener("pause", async (event) => {
|
video.addEventListener("pause", async (event) => {
|
||||||
if (outgoingDebounce || !video.controls) {
|
if (outgoingDebounce || !video.controls) {
|
||||||
event.preventDefault();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +107,6 @@ const setupOutgoingEvents = (video, socket) => {
|
||||||
|
|
||||||
video.addEventListener("play", (event) => {
|
video.addEventListener("play", (event) => {
|
||||||
if (outgoingDebounce || !video.controls) {
|
if (outgoingDebounce || !video.controls) {
|
||||||
event.preventDefault();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +130,6 @@ const setupOutgoingEvents = (video, socket) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outgoingDebounce || !video.controls) {
|
if (outgoingDebounce || !video.controls) {
|
||||||
event.preventDefault();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue