Skip to content

Real-time dashboard for monitoring global news, markets, and geopolitical events

TypeScript

Make livestream URL editable in settings

Reggie86d920c271d9
diff --git a/index.html b/index.html
index 67e3c67..b8d4143 100644
--- a/index.html
+++ b/index.html
@@ -193,6 +193,27 @@
transform: translateX(16px);
}
+ .settings-input {
+ width: 100%;
+ padding: 0.5rem;
+ background: var(--surface);
+ border: 1px solid var(--border);
+ color: var(--text);
+ font-family: inherit;
+ font-size: 0.7rem;
+ margin-bottom: 0.25rem;
+ }
+
+ .settings-input:focus {
+ outline: none;
+ border-color: var(--accent);
+ }
+
+ .settings-hint {
+ font-size: 0.6rem;
+ color: var(--text-dim);
+ }
+
.settings-close {
margin-top: 1rem;
width: 100%;
@@ -1254,6 +1275,11 @@
<div class="settings-section-title">Toggle Panels</div>
<div id="panelToggles"></div>
</div>
+ <div class="settings-section">
+ <div class="settings-section-title">Livestream URL</div>
+ <input type="text" id="livestreamUrl" class="settings-input" placeholder="YouTube URL (e.g. https://youtube.com/watch?v=...)" onchange="saveLivestreamUrl()">
+ <div class="settings-hint">Paste any YouTube video or livestream URL</div>
+ </div>
<button class="settings-close" onclick="toggleSettings()">Close</button>
</div>
</div>
@@ -1274,6 +1300,17 @@
</div>
</section>
+ <!-- TBPN Livestream -->
+ <section class="panel panel-wide" data-panel="tbpn" style="grid-column: span 4;">
+ <div class="panel-header">
+ <span class="panel-title">Livestream</span>
+ <span class="live-indicator">LIVE</span>
+ </div>
+ <div class="panel-content livestream-container" id="tbpnPanel">
+ <div class="loading-msg">Loading stream...</div>
+ </div>
+ </section>
+
<!-- Political / World News -->
<section class="panel" data-panel="politics">
<div class="panel-header">
@@ -1459,22 +1496,6 @@
</div>
</section>
- <!-- TBPN Livestream -->
- <section class="panel panel-wide" data-panel="tbpn">
- <div class="panel-header">
- <span class="panel-title">TBPN Live</span>
- <span class="live-indicator">LIVE</span>
- </div>
- <div class="panel-content livestream-container" id="tbpnPanel">
- <iframe
- src="https://www.youtube.com/embed/jWEZa9WEnIo?autoplay=0&mute=1"
- frameborder="0"
- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
- allowfullscreen>
- </iframe>
- </div>
- </section>
-
</main>
<script>
@@ -1551,6 +1572,9 @@
modal.classList.toggle('open');
if (modal.classList.contains('open')) {
updateSettingsUI();
+ // Load saved livestream URL
+ const savedUrl = localStorage.getItem('livestreamUrl') || 'https://www.youtube.com/watch?v=jWEZa9WEnIo';
+ document.getElementById('livestreamUrl').value = savedUrl;
}
}
@@ -1568,8 +1592,60 @@
}).join('');
}
- // Initialize panel settings on load
- document.addEventListener('DOMContentLoaded', applyPanelSettings);
+ // Extract YouTube video ID from various URL formats
+ function extractYouTubeId(url) {
+ if (!url) return null;
+ // Handle various YouTube URL formats
+ const patterns = [
+ /(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/|youtube\.com\/live\/)([^&\?\/]+)/,
+ /^([a-zA-Z0-9_-]{11})$/ // Direct video ID
+ ];
+ for (const pattern of patterns) {
+ const match = url.match(pattern);
+ if (match) return match[1];
+ }
+ return null;
+ }
+
+ // Save livestream URL
+ function saveLivestreamUrl() {
+ const input = document.getElementById('livestreamUrl');
+ const url = input.value.trim();
+ localStorage.setItem('livestreamUrl', url);
+ updateLivestreamEmbed();
+ }
+
+ // Update the livestream embed
+ function updateLivestreamEmbed() {
+ const url = localStorage.getItem('livestreamUrl') || 'https://www.youtube.com/watch?v=jWEZa9WEnIo';
+ const videoId = extractYouTubeId(url);
+ const panel = document.getElementById('tbpnPanel');
+ if (panel && videoId) {
+ panel.innerHTML = `
+ <iframe
+ src="https://www.youtube.com/embed/${videoId}?autoplay=0&mute=1"
+ frameborder="0"
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
+ allowfullscreen>
+ </iframe>
+ `;
+ } else if (panel) {
+ panel.innerHTML = '<div class="loading-msg">Invalid YouTube URL</div>';
+ }
+ }
+
+ // Get current livestream embed URL
+ function getLivestreamEmbedUrl() {
+ const url = localStorage.getItem('livestreamUrl') || 'https://www.youtube.com/watch?v=jWEZa9WEnIo';
+ const videoId = extractYouTubeId(url);
+ return videoId ? `https://www.youtube.com/embed/${videoId}?autoplay=0&mute=1` : '';
+ }
+
+ // Initialize panel settings and livestream on load
+ document.addEventListener('DOMContentLoaded', () => {
+ applyPanelSettings();
+ updateLivestreamEmbed();
+ });
const CORS_PROXIES = [
'https://corsproxy.io/?',