Skip to content

Commit

Permalink
Update chat to one room view
Browse files Browse the repository at this point in the history
Remove links from cards for days
Add default room
Remove buttons
Add title from room name
  • Loading branch information
splattater committed Apr 12, 2024
1 parent fb611c9 commit 14d572e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
14 changes: 3 additions & 11 deletions live.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ <h2><span>Data Week</span> Live Streams - {{str_supported}}</h2>
<li>
<div class="card">
<h2>
<a href="{{ "/live/stream.html" | relativize_url }}#{{site.stream_1_1}}">
<span class="xl hideunderline">{{ str_monday }}</span>
</a>
<span class="xl hideunderline">{{ str_monday }}</span>
</h2>
<p class="dates">
<time>
Expand All @@ -87,9 +85,7 @@ <h2>
<li>
<div class="card">
<h2>
<a href="{{ "/live/stream.html" | relativize_url }}#{{site.stream_2_1}}">
<span class="xl hideunderline">{{ str_tuesday }}</span>
</a>
<span class="xl hideunderline">{{ str_tuesday }}</span>
</h2>
<p class="dates">
<time>
Expand All @@ -110,9 +106,7 @@ <h2>
<li>
<div class="card">
<h2>
<a href="{{ "/live/stream.html" | relativize_url }}#{{site.stream_3_1}}">
<span class="xl hideunderline">{{ str_wednesday }}</span>
</a>
</h2>
<p class="dates">
<time>
Expand All @@ -127,9 +121,7 @@ <h2>
<li>
<div class="card">
<h2>
<a href="{{ "/live/stream.html" | relativize_url }}#{{site.stream_4_1}}">
<span class="xl hideunderline">{{ str_thursday }}</span>
</a>
<span class="xl hideunderline">{{ str_thursday }}</span>
</h2>
<p class="dates">
<time>
Expand Down
22 changes: 11 additions & 11 deletions resources/js/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ const socket = io("wss://chat.2023.dataweek.de/");
// const ws = new WebSocket('wss://chat.lswt2021.comiles.eu/ws');
// const ws = new WebSocket('ws://localhost:5000/ws');

let default_room_id = "!irnMvwCKJtUyHjAAwI:matrix.org"
let room_id = window.location.hash.substring(1)

if (room_id == "") {
room_id = default_room_id
}

socket.on('connect', () => {
console.log(`connect ${socket.id}`);
const message_box = document.getElementById('info_box');
Expand Down Expand Up @@ -65,18 +70,13 @@ socket.on('streams_update', (streamList) => {
const stream_selection = document.getElementById('stream_selection');
stream_selection.innerHTML = '';
console.log(streamList);
for (let stream_id in streamList) {
let stream_link = document.createElement('a');
stream_link.setAttribute("href", "javascript:zapp('" + stream_id + "')");
if (room_id == stream_id) {
stream_link.setAttribute("class", "btn");
} else {
stream_link.setAttribute("class", "btn2");
}
stream_link.append(streamList[stream_id]);
stream_selection.append(stream_link);
stream_selection.append(" ");

if (streamList[room_id] == undefined) {
document.getElementById("title").textContent = 'Chat - ' + streamList[default_room_id]
} else {
document.getElementById("title").textContent = 'Chat - ' + streamList[room_id]
}

});

function zapp(stream_id) {
Expand Down

0 comments on commit 14d572e

Please sign in to comment.