Skip to content
Snippets Groups Projects
Commit 1b72a2ea authored by Simon Kirsten's avatar Simon Kirsten
Browse files

Fixed chat and formatting

parent a388d7c5
No related branches found
No related tags found
No related merge requests found
...@@ -9,7 +9,7 @@ function newLargePlayer(channel) { ...@@ -9,7 +9,7 @@ function newLargePlayer(channel) {
width: "", width: "",
height: "", height: "",
controls: false, controls: false,
muted: false muted: false,
}); });
} }
...@@ -19,7 +19,7 @@ function newSmallPlayer(channel) { ...@@ -19,7 +19,7 @@ function newSmallPlayer(channel) {
width: "", width: "",
height: "", height: "",
controls: false, controls: false,
muted: true muted: true,
}); });
} }
...@@ -33,7 +33,7 @@ const defaultState = { ...@@ -33,7 +33,7 @@ const defaultState = {
small_channel: "", small_channel: "",
volume: 0.5, volume: 0.5,
small_scale: 0.3, small_scale: 0.3,
show_chat: false show_chat: false,
}; };
let state = defaultState; let state = defaultState;
...@@ -76,7 +76,10 @@ function updateState(newState) { ...@@ -76,7 +76,10 @@ function updateState(newState) {
} }
let chat_elem_src = let chat_elem_src =
"https://www.twitch.tv/embed/" + state.large_channel + "/chat?darkpopout"; "https://www.twitch.tv/embed/" +
state.large_channel +
"/chat?darkpopout&parent=" +
location.hostname;
if (chat_elem_src != chat_elem.src) { if (chat_elem_src != chat_elem.src) {
chat_elem.src = chat_elem_src; chat_elem.src = chat_elem_src;
...@@ -129,7 +132,7 @@ if (!window.EventSource) { ...@@ -129,7 +132,7 @@ if (!window.EventSource) {
} else { } else {
const events = new EventSource("/display"); const events = new EventSource("/display");
events.onmessage = m => { events.onmessage = (m) => {
updateState(JSON.parse(m.data)); updateState(JSON.parse(m.data));
}; };
...@@ -137,7 +140,7 @@ if (!window.EventSource) { ...@@ -137,7 +140,7 @@ if (!window.EventSource) {
overlay_elem.firstElementChild.innerText = "Nothing playing"; overlay_elem.firstElementChild.innerText = "Nothing playing";
}; };
events.onerror = err => { events.onerror = (err) => {
console.error(err); console.error(err);
updateState(defaultState); updateState(defaultState);
...@@ -157,7 +160,7 @@ function toggleFullscreen() { ...@@ -157,7 +160,7 @@ function toggleFullscreen() {
} }
} }
large_player_elem.addEventListener("mousedown", event => { large_player_elem.addEventListener("mousedown", (event) => {
if (event.detail > 1) { if (event.detail > 1) {
// double click // double click
toggleFullscreen(); toggleFullscreen();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment