From d906b8bf5dda4d855a5ff8ae5f9af301590f1568 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Tue, 7 Jan 2025 00:11:30 -0500 Subject: [PATCH] Merge pull request #1 from Codesamp-Rohan/main --- app.js | 35 +++++-- index.html | 46 +++------ style.css | 273 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 313 insertions(+), 41 deletions(-) create mode 100644 style.css diff --git a/app.js b/app.js index 6e65f4a..d387d3a 100644 --- a/app.js +++ b/app.js @@ -15,9 +15,7 @@ let conns = []; // Store Hyperswarm connections document.addEventListener("DOMContentLoaded", () => { console.log("DOM fully loaded and parsed"); document.getElementById('create-station').addEventListener('click', () => { - console.log("Create Station button clicked"); - const createStationModal = new bootstrap.Modal(document.getElementById('createStationModal')); - createStationModal.show(); + showModal('createStationModal'); }); document.getElementById('generate-new-key').addEventListener('click', () => { @@ -33,27 +31,44 @@ document.addEventListener("DOMContentLoaded", () => { console.log("Creating station with key:", b4a.toString(stationKey, 'hex')); setupStation(stationKey); - const createStationModal = bootstrap.Modal.getInstance(document.getElementById('createStationModal')); - createStationModal.hide(); + hideModal('createStationModal'); }); + document.getElementById('create-station-cancel-button').addEventListener('click', () => { + hideModal('createStationModal'); + }) + document.getElementById('leave-stream').addEventListener('click', () => { console.log("Leave Stream button clicked"); leaveStation(); }); - document.getElementById('join-station-button').addEventListener('click', () => { - console.log("Join Station button clicked"); - joinStation(); - const joinModal = bootstrap.Modal.getInstance(document.getElementById('joinModal')); - joinModal.hide(); + document.getElementById('open-join-modal').addEventListener('click', () => { + showModal('joinModal'); }); + document.getElementById('join-station-button').addEventListener('click', () => { + joinStation(); + hideModal('joinModal'); + }); + + document.getElementById('join-station-cancel-button').addEventListener('click', () => { + hideModal('joinModal'); + }) + document.getElementById('apply-audio-source').addEventListener('click', applyAudioSource); populateAudioInputSources(); }); +function showModal(modalId) { + document.getElementById(modalId).classList.remove('hidden'); +} + +function hideModal(modalId) { + document.getElementById(modalId).classList.add('hidden'); +} + async function populateAudioInputSources() { try { const devices = await navigator.mediaDevices.enumerateDevices(); diff --git a/index.html b/index.html index 0ff35f7..1cfe049 100644 --- a/index.html +++ b/index.html @@ -3,33 +3,16 @@ - + pearCast -
-
+

pearCast

-
+
@@ -52,7 +35,7 @@
-