Skip to content

Commit e05cd9a

Browse files
authored
Update joinin.html
1 parent 2359561 commit e05cd9a

1 file changed

Lines changed: 2 additions & 55 deletions

File tree

joinin.html

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -446,10 +446,6 @@ <h2 id="users-heading">Users</h2>
446446

447447
<script>
448448

449-
<script>
450-
// -------------------------------
451-
// Text send with automation
452-
// -------------------------------
453449
window.sendTeamTalkChat = function () {
454450
const input = document.getElementById("chat-input");
455451
if (!input) return;
@@ -469,9 +465,7 @@ <h2 id="users-heading">Users</h2>
469465
input.value = "";
470466
};
471467

472-
// -------------------------------
473-
// Render live and async streams
474-
// -------------------------------
468+
475469
bridge.on("chat-message", (msg) => {
476470
const chat = document.getElementById("chat");
477471
if (!chat) return;
@@ -491,9 +485,6 @@ <h2 id="users-heading">Users</h2>
491485
asyncThread.scrollTop = asyncThread.scrollHeight;
492486
});
493487

494-
// -------------------------------
495-
// Dwell helper for symbols
496-
// -------------------------------
497488
function attachDwell(element, symbolId, label) {
498489
let dwellTimer = null;
499490
const DWELL_MS = 800; // tune this
@@ -515,11 +506,6 @@ <h2 id="users-heading">Users</h2>
515506
element.addEventListener("pointerleave", cancel);
516507
}
517508

518-
// You can call attachDwell(buttonEl, symbolId, label) when creating symbol buttons.
519-
520-
// -------------------------------
521-
// Mic capture + PTT for live audio
522-
// -------------------------------
523509
let mediaStream = null;
524510
let mediaRecorder = null;
525511
let isRecording = false;
@@ -591,13 +577,11 @@ <h2 id="users-heading">Users</h2>
591577

592578
function toggleSpeech() {
593579
if (!isSpeechToggled) {
594-
// Turn ON continuous transmit
595580
isSpeechToggled = true;
596581
startLiveAudio();
597582
const btn = document.getElementById("toggle-speech-button");
598583
if (btn) btn.setAttribute("aria-pressed", "true");
599584
} else {
600-
// Turn OFF continuous transmit
601585
isSpeechToggled = false;
602586
stopLiveAudio();
603587
const btn = document.getElementById("toggle-speech-button");
@@ -606,12 +590,9 @@ <h2 id="users-heading">Users</h2>
606590
}
607591
</script>
608592

609-
<script>
593+
<script>
610594
window.addEventListener("DOMContentLoaded", () => {
611595

612-
/* ---------------------------------------------------------
613-
NICKNAME RESOLUTION MODULE
614-
--------------------------------------------------------- */
615596
function resolveNickname() {
616597
// 1. TeamTalk nickname (if bridge exposes it)
617598
const ttNick = bridge?.getMyNickname?.();
@@ -634,11 +615,9 @@ <h2 id="users-heading">Users</h2>
634615
return mapped.trim();
635616
}
636617
}
637-
// 3. Local storage
638618
const lsNick = localStorage.getItem("cw_nickname");
639619
if (lsNick && lsNick.trim()) return lsNick.trim();
640620

641-
// 4. Fallback
642621
return "Guest";
643622
}
644623
function flashNickname(nick) {
@@ -655,18 +634,12 @@ <h2 id="users-heading">Users</h2>
655634

656635
setTimeout(() => p.remove(), 4000);
657636
}
658-
/* ---------------------------------------------------------
659-
CONNECT WRAPPER (inject nickname)
660-
--------------------------------------------------------- */
661637
window.connectWithNickname = () => {
662638
const nickname = resolveNickname();
663639
bridge.username = nickname;
664640
flashNickname(nickname);
665641
bridge.connectEverything();
666642
};
667-
/* ---------------------------------------------------------
668-
1. CONNECTION BUTTON
669-
--------------------------------------------------------- */
670643
function updateConnectionButton(isConnected) {
671644
const connectBtn = document.getElementById("connect-btn");
672645
const disconnectBtn = document.getElementById("disconnect-btn");
@@ -689,9 +662,6 @@ <h2 id="users-heading">Users</h2>
689662
});
690663

691664

692-
/* ---------------------------------------------------------
693-
2. PRESENCE LOG
694-
--------------------------------------------------------- */
695665
function logPresence(text) {
696666
const chat = document.getElementById("chat");
697667
const p = document.createElement("p");
@@ -703,9 +673,6 @@ <h2 id="users-heading">Users</h2>
703673
}
704674

705675

706-
/* ---------------------------------------------------------
707-
3. CENTRAL REFRESH FUNCTION
708-
--------------------------------------------------------- */
709676
async function refreshUI() {
710677
try {
711678
const channels = await bridge.getChannels();
@@ -721,10 +688,6 @@ <h2 id="users-heading">Users</h2>
721688
}
722689
}
723690

724-
725-
/* ---------------------------------------------------------
726-
4. DOM UPDATE HELPERS
727-
--------------------------------------------------------- */
728691
function updateChannelList(channels) {
729692
const ul = document.getElementById("channel-list");
730693
ul.innerHTML = "";
@@ -794,10 +757,6 @@ <h2 id="users-heading">Users</h2>
794757
label.textContent = ch ? ch.name : "/";
795758
}
796759

797-
798-
/* ---------------------------------------------------------
799-
5. POLLING LOOP
800-
--------------------------------------------------------- */
801760
let refreshInterval = null;
802761

803762
function startPolling() {
@@ -809,10 +768,6 @@ <h2 id="users-heading">Users</h2>
809768
if (refreshInterval) clearInterval(refreshInterval);
810769
}
811770

812-
813-
/* ---------------------------------------------------------
814-
6. VISIBILITY + BFCache FIXES
815-
--------------------------------------------------------- */
816771
document.addEventListener("visibilitychange", () => {
817772
if (document.visibilityState === "visible") {
818773
refreshUI();
@@ -825,10 +780,6 @@ <h2 id="users-heading">Users</h2>
825780
}
826781
});
827782

828-
829-
/* ---------------------------------------------------------
830-
7. BRIDGE EVENT HOOKS
831-
--------------------------------------------------------- */
832783
bridge.on("connected", refreshUI);
833784
bridge.on("channel-added", refreshUI);
834785
bridge.on("channel-removed", refreshUI);
@@ -851,9 +802,6 @@ <h2 id="users-heading">Users</h2>
851802
});
852803

853804

854-
/* ---------------------------------------------------------
855-
8. START EVERYTHING
856-
--------------------------------------------------------- */
857805
window.addEventListener("load", startPolling);
858806
window.addEventListener("beforeunload", stopPolling);
859807

@@ -902,7 +850,6 @@ <h2 id="users-heading">Users</h2>
902850
div.textContent = `${new Date(msg.timestamp).toLocaleTimeString()}${msg.text}`;
903851
asyncThread.appendChild(div);
904852
});
905-
});
906853
</script>
907854
</body>
908855
</html>

0 commit comments

Comments
 (0)