2025-07-01 15:37:35 -07:00
|
|
|
<div id="talk" class="tab">
|
|
|
|
<input
|
|
|
|
type="radio"
|
|
|
|
name="top-level-tabs"
|
|
|
|
id="talk-tab-input"
|
|
|
|
class="tab-switch"
|
|
|
|
data-hash="/talk"
|
|
|
|
/>
|
|
|
|
<label for="talk-tab-input" class="tab-label"
|
|
|
|
><div class="icon talk"></div>
|
|
|
|
<div class="label">Talk</div>
|
|
|
|
</label>
|
|
|
|
<div class="tab-content">
|
|
|
|
<style>
|
|
|
|
#talk .tab-content {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: auto 1fr;
|
|
|
|
}
|
|
|
|
|
2025-07-04 12:15:06 -07:00
|
|
|
.room-list {
|
|
|
|
margin: 1rem 0;
|
|
|
|
list-style-type: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.room-list > li.room a:before {
|
|
|
|
position: absolute;
|
|
|
|
left: -1.75rem;
|
|
|
|
top: 0;
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: x-large;
|
|
|
|
content: "#";
|
|
|
|
color: var(--text);
|
|
|
|
}
|
|
|
|
|
|
|
|
.room-list > li.room a {
|
|
|
|
position: relative;
|
|
|
|
display: block;
|
|
|
|
width: 100%;
|
|
|
|
min-height: 1.5rem;
|
|
|
|
line-height: 1.5rem;
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: large;
|
|
|
|
margin-left: 1.75rem;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.room-list > li.room.active a {
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
|
|
|
|
2025-07-01 15:37:35 -07:00
|
|
|
#talk .sidebar {
|
|
|
|
position: relative;
|
2025-07-04 12:15:06 -07:00
|
|
|
min-width: 10rem;
|
2025-07-01 15:37:35 -07:00
|
|
|
}
|
|
|
|
|
2025-07-04 12:15:06 -07:00
|
|
|
#talk .sidebar .title {
|
|
|
|
text-transform: uppercase;
|
|
|
|
font-size: small;
|
|
|
|
font-weight: bold;
|
|
|
|
line-height: 2rem;
|
2025-07-01 15:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#talk #room-create {
|
|
|
|
position: absolute;
|
2025-07-04 12:15:06 -07:00
|
|
|
top: 0.5rem;
|
2025-07-01 15:37:35 -07:00
|
|
|
right: 0.5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
#talk #room-chat-container {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
#talk #room-chat-content {
|
|
|
|
padding-bottom: 5rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
#talk #room-chat-entry-container {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
height: 5rem;
|
|
|
|
padding: 1rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
#talk #room-chat-entry-container form {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
bottom: 0;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
padding: 0.75rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
#talk #room-chat-entry-container form button {
|
|
|
|
width: inherit;
|
|
|
|
padding: inherit;
|
2025-07-02 21:28:07 -07:00
|
|
|
margin: 0 1rem;
|
2025-07-01 15:37:35 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#talk #room-chat-entry-container form textarea {
|
|
|
|
flex-grow: 1;
|
|
|
|
background: inherit;
|
|
|
|
color: inherit;
|
|
|
|
}
|
|
|
|
|
|
|
|
#talk .message-container {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
transition: all 0.33s;
|
|
|
|
}
|
|
|
|
|
|
|
|
#talk .message-container.sending {
|
|
|
|
opacity: 0.75;
|
|
|
|
}
|
|
|
|
|
|
|
|
#talk .message-container .info-container {
|
|
|
|
width: 8rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
#talk .message-container .info-container .avatar-container {
|
|
|
|
display: block;
|
|
|
|
margin: 0 auto;
|
|
|
|
width: 3rem;
|
|
|
|
height: 3rem;
|
|
|
|
border-radius: 16%;
|
|
|
|
overflow: hidden;
|
|
|
|
}
|
|
|
|
|
|
|
|
#talk .message-container .info-container .avatar-container img {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
#talk .message-container .info-container .datetime-container,
|
|
|
|
#talk .message-container .info-container .username-container {
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
#talk .message-container .info-container .datetime-container .long {
|
|
|
|
visibility: hidden;
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
#talk .message-container .info-container .datetime-container .short {
|
|
|
|
font-weight: bold;
|
|
|
|
font-size: x-small;
|
|
|
|
}
|
|
|
|
</style>
|
2025-07-04 12:15:06 -07:00
|
|
|
<script>
|
|
|
|
function render_text_event(event, creator) {
|
|
|
|
const event_datetime = datetime_to_local(event.timestamps.created);
|
|
|
|
|
|
|
|
return `<div id="${event.id}" class="message-container sending from-user-${creator.id}">
|
|
|
|
<div class="info-container">
|
|
|
|
<div class="avatar-container">
|
|
|
|
<img src="${creator.meta?.avatar ?? "/images/default_avatar.gif"}" alt="user avatar" />
|
|
|
|
</div>
|
|
|
|
<div class="username-container">
|
|
|
|
<span class="username">${creator.username ?? "unknown"}</span>
|
|
|
|
</div>
|
|
|
|
<div class="datetime-container">
|
|
|
|
<span class="long">${event_datetime.long}</span>
|
|
|
|
<span class="short">${event_datetime.short}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="message-content-container">${event.data.message}</div>
|
|
|
|
</div>`;
|
|
|
|
}
|
|
|
|
</script>
|
2025-07-01 15:37:35 -07:00
|
|
|
<div class="sidebar resizable">
|
|
|
|
<div id="room-create" class="clickable" data-requires-permission="rooms.create">
|
|
|
|
<div class="icon plus"></div>
|
|
|
|
<script>
|
|
|
|
async function get_new_room_element() {
|
|
|
|
const existing_new_room_element = document.getElementById("new-room");
|
|
|
|
if (existing_new_room_element) {
|
|
|
|
return existing_new_room_element;
|
|
|
|
}
|
|
|
|
|
|
|
|
const room_list = document.getElementById("room-list");
|
|
|
|
room_list.insertAdjacentHTML(
|
|
|
|
"beforeend",
|
2025-07-04 12:15:06 -07:00
|
|
|
`<li id="new-room" class="room"><a href="" contenteditable="true">new room</a></li>`,
|
2025-07-01 15:37:35 -07:00
|
|
|
);
|
|
|
|
await new Promise((resolve) => setTimeout(resolve, 1));
|
|
|
|
|
|
|
|
const new_room_element = document.getElementById("new-room");
|
|
|
|
return new_room_element;
|
|
|
|
}
|
|
|
|
|
2025-07-04 12:15:06 -07:00
|
|
|
async function append_room_events(events) {
|
|
|
|
const room_chat_content = document.getElementById("room-chat-content");
|
|
|
|
const users = {};
|
2025-07-04 13:08:00 -07:00
|
|
|
let last_message_id = undefined;
|
2025-07-04 12:15:06 -07:00
|
|
|
for (const event of events) {
|
2025-07-04 13:08:00 -07:00
|
|
|
// if the last message is undefined, it becomes this event, otherwise, if this event's id is newer,
|
|
|
|
// it becomes the latest message
|
|
|
|
last_message_id =
|
|
|
|
last_message_id === undefined
|
|
|
|
? event.id
|
|
|
|
: event.id > last_message_id
|
|
|
|
? event.id
|
|
|
|
: last_message_id;
|
|
|
|
|
|
|
|
// if the last message has been updated, update the content's dataset to reflect that
|
|
|
|
if (last_message_id !== room_chat_content.dataset.last_message_id) {
|
|
|
|
room_chat_content.dataset.last_message_id = last_message_id;
|
|
|
|
}
|
|
|
|
|
2025-07-04 12:15:06 -07:00
|
|
|
users[event.creator_id] =
|
|
|
|
users[event.creator_id] ??
|
|
|
|
(await api.fetch(`/users/${event.creator_id}`));
|
|
|
|
|
|
|
|
room_chat_content.insertAdjacentHTML(
|
|
|
|
"beforeend",
|
|
|
|
render_text_event(event, users[event.creator_id]),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-07-04 13:08:00 -07:00
|
|
|
// TODO: we need some abortcontroller handling here or something
|
|
|
|
// similar for when we change rooms, this is the most basic
|
|
|
|
// first pass outline
|
2025-07-04 12:15:06 -07:00
|
|
|
let room_polling_request_abort_controller = null;
|
|
|
|
async function poll_for_new_events() {
|
|
|
|
const room_chat_content = document.getElementById("room-chat-content");
|
|
|
|
const room_id = room_chat_content.dataset.room_id;
|
|
|
|
const last_message_id = room_chat_content.dataset.last_message_id;
|
|
|
|
|
2025-07-04 13:27:57 -07:00
|
|
|
if (!room_id) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2025-07-04 12:15:06 -07:00
|
|
|
const message_polling_url = `/rooms/${room_id}/events?type=chat&limit=100&sort=newest&wait=true${last_message_id ? `&after_id=${last_message_id}` : ""}`;
|
|
|
|
|
2025-07-04 13:27:57 -07:00
|
|
|
room_polling_request_abort_controller =
|
|
|
|
room_polling_request_abort_controller || new AbortController();
|
|
|
|
|
2025-07-04 12:15:06 -07:00
|
|
|
api.fetch(message_polling_url, {
|
|
|
|
signal: room_polling_request_abort_controller.signal,
|
|
|
|
})
|
|
|
|
.then((new_events) => {
|
2025-07-04 13:27:57 -07:00
|
|
|
console.dir({
|
|
|
|
room_id,
|
|
|
|
new_events,
|
|
|
|
});
|
2025-07-04 12:15:06 -07:00
|
|
|
append_room_events(new_events);
|
|
|
|
poll_for_new_events(room_id);
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
// TODO: poll again? back off?
|
|
|
|
console.error(error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2025-07-01 15:37:35 -07:00
|
|
|
async function load_room(room_id) {
|
2025-07-04 13:27:57 -07:00
|
|
|
const room_chat_content = document.getElementById("room-chat-content");
|
|
|
|
|
2025-07-04 12:15:06 -07:00
|
|
|
if (room_polling_request_abort_controller) {
|
|
|
|
room_polling_request_abort_controller.abort();
|
|
|
|
room_polling_request_abort_controller = null;
|
2025-07-04 13:08:00 -07:00
|
|
|
delete room_chat_content.dataset.last_message_id;
|
2025-07-04 12:15:06 -07:00
|
|
|
}
|
|
|
|
|
2025-07-01 15:37:35 -07:00
|
|
|
const room_response = await api.fetch(`/rooms/${room_id}`);
|
|
|
|
if (!room_response.ok) {
|
|
|
|
const error = await room_response.json();
|
|
|
|
alert(error.message ?? JSON.stringify(error));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const room = await room_response.json();
|
|
|
|
|
2025-07-04 13:08:00 -07:00
|
|
|
room_chat_content.dataset.room_id = room.id;
|
2025-07-04 12:15:06 -07:00
|
|
|
room_chat_content.innerHTML = "";
|
2025-07-01 15:37:35 -07:00
|
|
|
|
2025-07-04 13:08:00 -07:00
|
|
|
const room_selectors = document.querySelectorAll("li.room");
|
|
|
|
for (const room_selector of room_selectors) {
|
|
|
|
room_selector.classList.remove("active");
|
|
|
|
if (room_selector.id === `room-selector-${room_id}`) {
|
|
|
|
room_selector.classList.add("active");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-07-04 12:15:06 -07:00
|
|
|
const events_response = await api.fetch(
|
|
|
|
`/rooms/${room_id}/events?type=chat&limit=100&sort=newest`,
|
|
|
|
);
|
2025-07-01 15:37:35 -07:00
|
|
|
if (!events_response.ok) {
|
2025-07-04 14:51:49 -07:00
|
|
|
const error = await events_response.json();
|
2025-07-01 15:37:35 -07:00
|
|
|
alert(error.message ?? JSON.stringify(error));
|
|
|
|
return;
|
|
|
|
}
|
2025-07-04 12:15:06 -07:00
|
|
|
|
|
|
|
const events = (await events_response.json()).reverse();
|
|
|
|
|
|
|
|
append_room_events(events);
|
|
|
|
last_message_id = events.length ? events[events.length - 1].id : null;
|
|
|
|
|
|
|
|
poll_for_new_events(room_id);
|
2025-07-01 15:37:35 -07:00
|
|
|
}
|
|
|
|
|
2025-07-04 13:08:00 -07:00
|
|
|
let last_room_update = undefined;
|
|
|
|
async function update_chat_rooms() {
|
|
|
|
const now = new Date();
|
|
|
|
const time_since_last_update = now - (last_room_update ?? 0);
|
|
|
|
if (time_since_last_update < 5_000) {
|
|
|
|
return;
|
2025-07-04 12:15:06 -07:00
|
|
|
}
|
|
|
|
|
2025-07-01 15:37:35 -07:00
|
|
|
const rooms_response = await api.fetch("/rooms");
|
|
|
|
if (rooms_response.ok) {
|
|
|
|
const room_list = document.getElementById("room-list");
|
|
|
|
room_list.innerHTML = "";
|
|
|
|
const rooms = await rooms_response.json();
|
|
|
|
for (const room of rooms) {
|
|
|
|
room_list.insertAdjacentHTML(
|
|
|
|
"beforeend",
|
2025-07-04 12:15:06 -07:00
|
|
|
`<li id="room-selector-${room.id}" class="room"><a href="#/talk/room/${room.id}">${room.name}</a></li>`,
|
2025-07-01 15:37:35 -07:00
|
|
|
);
|
|
|
|
}
|
2025-07-04 13:08:00 -07:00
|
|
|
|
|
|
|
last_room_update = now;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
window.addEventListener("locationchange", update_chat_rooms);
|
|
|
|
|
|
|
|
function check_for_room_in_url() {
|
2025-07-04 14:51:49 -07:00
|
|
|
const user_json = document.body.dataset.user;
|
|
|
|
if (!user_json) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2025-07-04 13:08:00 -07:00
|
|
|
const hash = window.location.hash;
|
|
|
|
const talk_in_url = hash.indexOf("#/talk") === 0;
|
|
|
|
if (!talk_in_url) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const first_room_id = document.querySelector("li.room")?.id.substring(14);
|
|
|
|
|
|
|
|
// #/talk/room/{room_id}
|
|
|
|
// ^ 12
|
|
|
|
const room_id = hash.substring(12) || first_room_id;
|
|
|
|
|
|
|
|
if (!room_id) {
|
2025-07-04 13:30:55 -07:00
|
|
|
setTimeout(check_for_room_in_url, 100);
|
2025-07-04 13:08:00 -07:00
|
|
|
return;
|
2025-07-01 15:37:35 -07:00
|
|
|
}
|
|
|
|
|
2025-07-04 13:08:00 -07:00
|
|
|
const room_chat_container = document.getElementById("room-chat-container");
|
|
|
|
|
2025-07-04 13:27:57 -07:00
|
|
|
if (room_chat_container.dataset.room_id !== room_id) {
|
2025-07-04 13:30:55 -07:00
|
|
|
window.location.hash = `/talk/room/${room_id}`;
|
2025-07-04 13:27:57 -07:00
|
|
|
room_chat_container.dataset.room_id = room_id;
|
|
|
|
load_room(room_id);
|
|
|
|
}
|
2025-07-04 13:08:00 -07:00
|
|
|
}
|
|
|
|
window.addEventListener("locationchange", check_for_room_in_url);
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", async () => {
|
|
|
|
await update_chat_rooms();
|
|
|
|
check_for_room_in_url();
|
|
|
|
});
|
|
|
|
|
|
|
|
// TODO: this should be moved to be handled by a smartform
|
|
|
|
document.addEventListener("DOMContentLoaded", async () => {
|
2025-07-01 15:37:35 -07:00
|
|
|
const chat_input = document.getElementById("room-chat-input");
|
|
|
|
async function on_send_message(event) {
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
chat_input.disabled = true;
|
|
|
|
|
|
|
|
const message = chat_input.value.trim();
|
|
|
|
if (!message) {
|
|
|
|
chat_input.disabled = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const room_chat_container =
|
|
|
|
document.getElementById("room-chat-container");
|
|
|
|
const room_chat_content = document.getElementById("room-chat-content");
|
|
|
|
|
|
|
|
const room_id = room_chat_container.dataset.room_id;
|
|
|
|
|
|
|
|
if (!room_id) {
|
|
|
|
alert("Failed to get room_id!");
|
|
|
|
chat_input.disabled = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const now = new Date().toISOString();
|
|
|
|
|
|
|
|
const message_event = {
|
2025-07-04 12:15:06 -07:00
|
|
|
id: `TEMP-${now}`,
|
|
|
|
type: "chat",
|
2025-07-01 15:37:35 -07:00
|
|
|
data: {
|
|
|
|
message,
|
|
|
|
},
|
|
|
|
timestamps: {
|
|
|
|
created: now,
|
|
|
|
updated: now,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const user = JSON.parse(document.body.dataset.user);
|
|
|
|
|
|
|
|
room_chat_content.insertAdjacentHTML(
|
|
|
|
"beforeend",
|
2025-07-04 12:15:06 -07:00
|
|
|
render_text_event(message_event, user),
|
2025-07-01 15:37:35 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
const event_response = await api.fetch(`/rooms/${room_id}/events`, {
|
|
|
|
method: "POST",
|
|
|
|
json: message_event,
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!event_response.ok) {
|
|
|
|
alert("FAIL");
|
|
|
|
chat_input.disabled = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const authoritative_message_event = await event_response.json();
|
|
|
|
|
2025-07-04 12:15:06 -07:00
|
|
|
const temp_message = document.getElementById(message_event.id);
|
2025-07-01 15:37:35 -07:00
|
|
|
temp_message.id = authoritative_message_event.id;
|
|
|
|
temp_message.classList.remove("sending");
|
|
|
|
|
|
|
|
const local_datetime = datetime_to_local(
|
|
|
|
authoritative_message_event.timestamps.created,
|
|
|
|
);
|
|
|
|
const long_time = temp_message.querySelector(
|
|
|
|
".datetime-container .long",
|
|
|
|
);
|
|
|
|
const short_time = temp_message.querySelector(
|
|
|
|
".datetime-container .short",
|
|
|
|
);
|
|
|
|
long_time.innerHTML = local_datetime.long;
|
|
|
|
short_time.innerHTML = local_datetime.short;
|
|
|
|
|
|
|
|
chat_input.value = "";
|
|
|
|
chat_input.disabled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const send_button = document.getElementById("room-chat-send");
|
|
|
|
send_button.addEventListener("click", on_send_message);
|
|
|
|
chat_input.addEventListener("keypress", (event) => {
|
|
|
|
if (event.key === "Enter" && !event.shiftKey) {
|
|
|
|
on_send_message(event);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const room_create_button = document.getElementById("room-create");
|
|
|
|
room_create_button.addEventListener("click", async (event) => {
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
|
|
const new_room_element = await get_new_room_element();
|
2025-07-04 12:15:06 -07:00
|
|
|
const editable = new_room_element.querySelector("[contenteditable]");
|
|
|
|
|
|
|
|
editable.focus();
|
2025-07-01 15:37:35 -07:00
|
|
|
if (document.body.createTextRange) {
|
|
|
|
const range = document.body.createTextRange();
|
2025-07-04 12:15:06 -07:00
|
|
|
range.moveToElementText(editable);
|
2025-07-01 15:37:35 -07:00
|
|
|
range.select();
|
|
|
|
} else if (window.getSelection) {
|
|
|
|
const selection = window.getSelection();
|
|
|
|
const range = document.createRange();
|
2025-07-04 12:15:06 -07:00
|
|
|
range.selectNodeContents(editable);
|
2025-07-01 15:37:35 -07:00
|
|
|
selection.removeAllRanges();
|
|
|
|
selection.addRange(range);
|
|
|
|
}
|
|
|
|
|
2025-07-04 12:15:06 -07:00
|
|
|
editable.addEventListener("keypress", (event) => {
|
2025-07-01 15:37:35 -07:00
|
|
|
if (event.keyCode !== 13) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
event.preventDefault();
|
2025-07-04 12:15:06 -07:00
|
|
|
editable.blur();
|
2025-07-01 15:37:35 -07:00
|
|
|
});
|
|
|
|
|
2025-07-04 12:15:06 -07:00
|
|
|
editable.addEventListener("focusout", async () => {
|
|
|
|
const name = editable.textContent ?? editable.innerText;
|
2025-07-01 15:37:35 -07:00
|
|
|
|
|
|
|
const new_room_response = await api.fetch("/rooms", {
|
|
|
|
method: "POST",
|
|
|
|
json: {
|
|
|
|
name,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!new_room_response.ok) {
|
|
|
|
const error = await new_room_response.json();
|
|
|
|
|
|
|
|
console.dir({ error });
|
|
|
|
alert(error.message ?? "unknown error!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const new_room = await new_room_response.json();
|
|
|
|
new_room_element.remove();
|
|
|
|
|
|
|
|
const room_list = document.getElementById("room-list");
|
|
|
|
room_list.insertAdjacentHTML(
|
|
|
|
"beforeend",
|
2025-07-04 12:15:06 -07:00
|
|
|
`<li id="room-selector-${new_room.id}" class="room"><a href="#/room/${new_room.id}">${new_room.name}</a></li>`,
|
2025-07-01 15:37:35 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
window.location.hash = `/talk/room/${new_room.id}`;
|
|
|
|
});
|
|
|
|
});
|
2025-07-04 12:15:06 -07:00
|
|
|
|
|
|
|
check_for_room_in_url();
|
2025-07-01 15:37:35 -07:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</div>
|
2025-07-04 12:15:06 -07:00
|
|
|
<div>
|
|
|
|
<span class="title">chat rooms</span>
|
|
|
|
</div>
|
|
|
|
<ul id="room-list" class="room-list"></ul>
|
2025-07-01 15:37:35 -07:00
|
|
|
</div>
|
|
|
|
<div id="room-chat-container">
|
|
|
|
<div id="room-chat-content"></div>
|
|
|
|
<div id="room-chat-entry-container">
|
|
|
|
<form action="">
|
|
|
|
<button aria-label="Attach file">
|
|
|
|
<i class="icon attachment"></i>
|
|
|
|
</button>
|
|
|
|
<textarea id="room-chat-input" class="room-chat-input" rows="1"></textarea>
|
|
|
|
<button id="room-chat-send" class="primary" aria-label="Send a message">
|
|
|
|
<i class="icon send"></i>
|
|
|
|
</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|