463 lines
21 KiB
HTML
463 lines
21 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="da">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>LineDance Player</title>
|
|
<link href="https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@300;400;500;700&display=swap" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--bg: #0e0f11;
|
|
--surface: #16181c;
|
|
--border: #2a2d35;
|
|
--accent: #e8a020;
|
|
--accent2: #c47a10;
|
|
--text: #e8eaf0;
|
|
--muted: #6b7080;
|
|
--green: #2ecc71;
|
|
--red: #e74c3c;
|
|
--mono: 'DM Mono', monospace;
|
|
--sans: 'DM Sans', sans-serif;
|
|
}
|
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
body { background: var(--bg); color: var(--text); font-family: var(--sans); min-height: 100vh; }
|
|
|
|
header {
|
|
border-bottom: 1px solid var(--border);
|
|
padding: 0 2rem; display: flex; align-items: center; gap: 1.5rem;
|
|
height: 60px; position: sticky; top: 0; background: var(--bg); z-index: 100;
|
|
}
|
|
.logo { font-family: var(--mono); font-size: 1rem; letter-spacing: .05em; }
|
|
.logo span { color: var(--accent); }
|
|
nav { margin-left: auto; display: flex; gap: .75rem; align-items: center; }
|
|
#user-label { font-size: .85rem; color: var(--muted); }
|
|
|
|
.btn {
|
|
font-family: var(--sans); font-size: .85rem; font-weight: 500;
|
|
padding: .4rem 1rem; border-radius: 6px; border: 1px solid var(--border);
|
|
background: transparent; color: var(--text); cursor: pointer;
|
|
transition: all .15s; text-decoration: none;
|
|
display: inline-flex; align-items: center; gap: .4rem;
|
|
}
|
|
.btn:hover { background: var(--surface); border-color: var(--accent); }
|
|
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; font-weight: 700; }
|
|
.btn.primary:hover { background: var(--accent2); }
|
|
.btn.danger { border-color: var(--red); color: var(--red); }
|
|
.btn.danger:hover { background: rgba(231,76,60,.1); }
|
|
.btn:disabled { opacity: .4; cursor: not-allowed; }
|
|
.btn.sm { font-size: .75rem; padding: .25rem .6rem; }
|
|
|
|
.tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 2rem; max-width: 900px; margin: 0 auto; }
|
|
.tab {
|
|
font-size: .85rem; font-weight: 500; padding: .75rem 1.25rem;
|
|
color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent;
|
|
margin-bottom: -1px; transition: all .15s;
|
|
}
|
|
.tab:hover { color: var(--text); }
|
|
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
|
|
|
|
.hero { padding: 3rem 2rem 2rem; max-width: 900px; margin: 0 auto; }
|
|
.hero h1 { font-size: clamp(1.8rem,4vw,3rem); font-weight: 700; line-height: 1.1; margin-bottom: .75rem; }
|
|
.hero h1 em { color: var(--accent); font-style: normal; }
|
|
.hero p { color: var(--muted); font-size: 1rem; }
|
|
|
|
.section { max-width: 900px; margin: 0 auto; padding: 0 2rem 4rem; }
|
|
.section-title {
|
|
font-family: var(--mono); font-size: .72rem; letter-spacing: .15em;
|
|
color: var(--muted); text-transform: uppercase;
|
|
margin-bottom: 1.25rem; padding-bottom: .6rem; border-bottom: 1px solid var(--border);
|
|
}
|
|
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
|
|
|
|
.card {
|
|
background: var(--surface); border: 1px solid var(--border);
|
|
border-radius: 10px; padding: 1.25rem; transition: all .2s; position: relative; overflow: hidden;
|
|
}
|
|
.card.clickable { cursor: pointer; }
|
|
.card.clickable::before {
|
|
content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
|
|
background: var(--accent); transform: scaleX(0); transition: transform .2s; transform-origin: left;
|
|
}
|
|
.card.clickable:hover { border-color: var(--accent); transform: translateY(-2px); }
|
|
.card.clickable:hover::before { transform: scaleX(1); }
|
|
.card-title { font-weight: 600; font-size: .95rem; margin-bottom: .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
.card-owner { font-size: .78rem; color: var(--muted); font-family: var(--mono); margin-bottom: .75rem; }
|
|
.card-meta { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
|
|
.badge {
|
|
font-family: var(--mono); font-size: .68rem; padding: .18rem .45rem;
|
|
border-radius: 4px; border: 1px solid;
|
|
}
|
|
.badge.orange { background: rgba(232,160,32,.12); color: var(--accent); border-color: rgba(232,160,32,.3); }
|
|
.badge.green { background: rgba(46,204,113,.12); color: var(--green); border-color: rgba(46,204,113,.3); }
|
|
.badge.muted { background: rgba(107,112,128,.12); color: var(--muted); border-color: rgba(107,112,128,.3); }
|
|
.card-actions { display: flex; gap: .5rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--border); }
|
|
|
|
#detail {
|
|
display: none; position: fixed; inset: 0;
|
|
background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
|
|
z-index: 200; align-items: center; justify-content: center; padding: 2rem;
|
|
}
|
|
#detail.open { display: flex; }
|
|
.detail-box {
|
|
background: var(--surface); border: 1px solid var(--border);
|
|
border-radius: 14px; width: 100%; max-width: 540px; max-height: 80vh;
|
|
display: flex; flex-direction: column; overflow: hidden; animation: fadeUp .25s ease;
|
|
}
|
|
.detail-header { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 1rem; }
|
|
.detail-header-text { flex: 1; min-width: 0; }
|
|
.detail-header h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
.detail-header p { font-size: .82rem; color: var(--muted); }
|
|
.detail-songs { flex: 1; overflow-y: auto; padding: .4rem 0; }
|
|
.detail-songs::-webkit-scrollbar { width: 4px; }
|
|
.detail-songs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
|
|
.song-row { display: flex; align-items: center; gap: .75rem; padding: .55rem 1.5rem; transition: background .1s; }
|
|
.song-row:hover { background: rgba(255,255,255,.03); }
|
|
.song-num { font-family: var(--mono); font-size: .72rem; color: var(--muted); width: 1.5rem; text-align: right; flex-shrink: 0; }
|
|
.song-info { flex: 1; min-width: 0; }
|
|
.song-title { font-size: .88rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
.song-artist { font-size: .76rem; color: var(--muted); }
|
|
.song-dance { font-family: var(--mono); font-size: .7rem; color: var(--accent); flex-shrink: 0; }
|
|
.detail-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: .6rem; justify-content: flex-end; }
|
|
|
|
#login-modal {
|
|
display: none; position: fixed; inset: 0;
|
|
background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
|
|
z-index: 300; align-items: center; justify-content: center;
|
|
}
|
|
#login-modal.open { display: flex; }
|
|
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 2rem; width: 100%; max-width: 360px; animation: fadeUp .25s ease; }
|
|
.login-box h3 { font-size: 1.05rem; margin-bottom: 1.25rem; }
|
|
.form-row { margin-bottom: .9rem; }
|
|
.form-row label { display: block; font-size: .78rem; color: var(--muted); margin-bottom: .35rem; }
|
|
.form-row input {
|
|
width: 100%; background: var(--bg); border: 1px solid var(--border);
|
|
border-radius: 6px; padding: .45rem .7rem; color: var(--text);
|
|
font-family: var(--sans); font-size: .88rem; outline: none; transition: border-color .15s;
|
|
}
|
|
.form-row input:focus { border-color: var(--accent); }
|
|
.msg { font-size: .8rem; padding: .5rem .7rem; border-radius: 6px; margin-bottom: .9rem; }
|
|
.msg.error { background: rgba(231,76,60,.12); color: var(--red); border: 1px solid rgba(231,76,60,.3); }
|
|
.msg.success { background: rgba(46,204,113,.12); color: var(--green); border: 1px solid rgba(46,204,113,.3); }
|
|
|
|
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); font-size: .9rem; grid-column: 1/-1; }
|
|
.spinner { width: 28px; height: 28px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto .75rem; }
|
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
|
|
.fade-in { animation: fadeUp .25s ease; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<header>
|
|
<div class="logo">LINE<span>DANCE</span> PLAYER</div>
|
|
<nav>
|
|
<span id="user-label"></span>
|
|
<button class="btn" id="btn-login">Log ind</button>
|
|
<button class="btn" id="btn-logout" style="display:none">Log ud</button>
|
|
</nav>
|
|
</header>
|
|
|
|
<div class="tabs">
|
|
<div class="tab active" data-tab="public">Public playlister</div>
|
|
<div class="tab" id="tab-mine" data-tab="mine" style="display:none">Mine playlister</div>
|
|
</div>
|
|
|
|
<div class="hero">
|
|
<h1 id="hero-title">Public<br><em>playlister</em></h1>
|
|
<p id="hero-sub">Browse og kopiér playlister delt af LineDance Player-brugere.</p>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<div id="pane-public">
|
|
<div class="section-title">Alle public playlister</div>
|
|
<div id="grid-public" class="grid">
|
|
<div class="empty"><div class="spinner"></div>Henter playlister...</div>
|
|
</div>
|
|
</div>
|
|
<div id="pane-mine" style="display:none">
|
|
<div class="section-title">Mine playlister</div>
|
|
<div id="grid-mine" class="grid">
|
|
<div class="empty"><div class="spinner"></div></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="detail">
|
|
<div class="detail-box">
|
|
<div class="detail-header">
|
|
<div class="detail-header-text">
|
|
<h2 id="d-title">—</h2>
|
|
<p id="d-meta">—</p>
|
|
</div>
|
|
<button class="btn sm" id="btn-close-detail">✕</button>
|
|
</div>
|
|
<div class="detail-songs" id="d-songs"></div>
|
|
<div class="detail-footer">
|
|
<button class="btn" id="btn-close-detail2">Luk</button>
|
|
<button class="btn primary" id="btn-copy">Kopiér til min konto</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="qr-modal" style="display:none;position:fixed;inset:0;background:rgba(0,0,0,.75);backdrop-filter:blur(4px);z-index:300;align-items:center;justify-content:center;">
|
|
<div style="background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:2rem;width:100%;max-width:340px;text-align:center;animation:fadeUp .25s ease;">
|
|
<h3 id="qr-title" style="font-size:1rem;margin-bottom:1rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"></h3>
|
|
<canvas id="qr-canvas" style="margin:0 auto 1rem;display:block;border-radius:8px;"></canvas>
|
|
<div id="qr-url" style="font-size:.72rem;color:var(--muted);word-break:break-all;margin-bottom:1.25rem;"></div>
|
|
<div style="display:flex;gap:.6rem;justify-content:center;">
|
|
<button class="btn sm" onclick="copyLiveUrl()">Kopiér link</button>
|
|
<button class="btn sm" onclick="document.getElementById('qr-modal').style.display='none'">Luk</button>
|
|
</div>
|
|
<div id="copy-msg" style="font-size:.75rem;color:var(--green);margin-top:.6rem;height:1rem;"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="login-modal">
|
|
<h3>Log ind</h3>
|
|
<div id="login-msg"></div>
|
|
<div class="form-row"><label>Brugernavn eller e-mail</label><input type="text" id="inp-user" placeholder="dit@email.dk"></div>
|
|
<div class="form-row"><label>Adgangskode</label><input type="password" id="inp-pass" placeholder="••••••••"></div>
|
|
<div style="display:flex;gap:.6rem;justify-content:flex-end;margin-top:1rem">
|
|
<button class="btn" id="btn-cancel-login">Annuller</button>
|
|
<button class="btn primary" id="btn-do-login">Log ind</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"></script>
|
|
<script>
|
|
const API = '/api';
|
|
let token = localStorage.getItem('ld_token') || '';
|
|
let username = localStorage.getItem('ld_user') || '';
|
|
let currentPlaylistId = null;
|
|
let currentTab = 'public';
|
|
|
|
function updateAuthUI() {
|
|
document.getElementById('btn-login').style.display = token ? 'none' : '';
|
|
document.getElementById('btn-logout').style.display = token ? '' : 'none';
|
|
document.getElementById('tab-mine').style.display = token ? '' : 'none';
|
|
document.getElementById('user-label').textContent = token ? username : '';
|
|
if (!token && currentTab === 'mine') switchTab('public');
|
|
}
|
|
|
|
document.getElementById('btn-login').onclick = () =>
|
|
document.getElementById('login-modal').classList.add('open');
|
|
document.getElementById('btn-cancel-login').onclick = () =>
|
|
document.getElementById('login-modal').classList.remove('open');
|
|
document.getElementById('btn-logout').onclick = () => {
|
|
token = ''; username = '';
|
|
localStorage.removeItem('ld_token'); localStorage.removeItem('ld_user');
|
|
updateAuthUI();
|
|
};
|
|
document.getElementById('inp-pass').onkeydown = e => {
|
|
if (e.key === 'Enter') document.getElementById('btn-do-login').click();
|
|
};
|
|
document.getElementById('btn-do-login').onclick = async () => {
|
|
const user = document.getElementById('inp-user').value.trim();
|
|
const pass = document.getElementById('inp-pass').value;
|
|
const msg = document.getElementById('login-msg');
|
|
msg.innerHTML = '';
|
|
try {
|
|
const fd = new FormData();
|
|
fd.append('username', user); fd.append('password', pass);
|
|
const r = await fetch(`${API}/auth/login`, { method: 'POST', body: fd });
|
|
const d = await r.json();
|
|
if (!r.ok) throw new Error(d.detail || 'Login fejlede');
|
|
token = d.access_token; username = user;
|
|
localStorage.setItem('ld_token', token); localStorage.setItem('ld_user', username);
|
|
document.getElementById('login-modal').classList.remove('open');
|
|
updateAuthUI();
|
|
loadMyPlaylists();
|
|
} catch(e) {
|
|
msg.innerHTML = `<div class="msg error">${e.message}</div>`;
|
|
}
|
|
};
|
|
|
|
function switchTab(tab) {
|
|
currentTab = tab;
|
|
document.querySelectorAll('.tab').forEach(t =>
|
|
t.classList.toggle('active', t.dataset.tab === tab));
|
|
document.getElementById('pane-public').style.display = tab === 'public' ? '' : 'none';
|
|
document.getElementById('pane-mine').style.display = tab === 'mine' ? '' : 'none';
|
|
if (tab === 'public') {
|
|
document.getElementById('hero-title').innerHTML = 'Public<br><em>playlister</em>';
|
|
document.getElementById('hero-sub').textContent = 'Browse og kopiér playlister delt af LineDance Player-brugere.';
|
|
} else {
|
|
document.getElementById('hero-title').innerHTML = 'Mine<br><em>playlister</em>';
|
|
document.getElementById('hero-sub').textContent = 'Administrér synlighed på dine playlister.';
|
|
}
|
|
}
|
|
document.querySelectorAll('.tab').forEach(t => t.onclick = () => switchTab(t.dataset.tab));
|
|
|
|
async function loadPublicPlaylists() {
|
|
const grid = document.getElementById('grid-public');
|
|
try {
|
|
const r = await fetch(`${API}/sharing/public`);
|
|
const lists = await r.json();
|
|
if (!lists.length) { grid.innerHTML = '<div class="empty">Ingen public playlister endnu.</div>'; return; }
|
|
grid.innerHTML = lists.map(p => `
|
|
<div class="card clickable fade-in" data-id="${p.id}">
|
|
<div class="card-title">${esc(p.name)}</div>
|
|
<div class="card-owner">@ ${esc(p.owner)}</div>
|
|
<div class="card-meta">
|
|
<span class="badge orange">${p.song_count} sange</span>
|
|
<span class="badge green">public</span>
|
|
</div>
|
|
</div>`).join('');
|
|
grid.querySelectorAll('.card').forEach(c =>
|
|
c.onclick = () => openDetail(c.dataset.id, false));
|
|
} catch(e) {
|
|
grid.innerHTML = `<div class="empty">Kunne ikke hente playlister.<br>${e.message}</div>`;
|
|
}
|
|
}
|
|
|
|
async function loadMyPlaylists() {
|
|
const grid = document.getElementById('grid-mine');
|
|
grid.innerHTML = '<div class="empty"><div class="spinner"></div></div>';
|
|
try {
|
|
const r = await fetch(`${API}/projects/my`, {
|
|
headers: { 'Authorization': `Bearer ${token}` }
|
|
});
|
|
if (!r.ok) throw new Error('Ikke autoriseret');
|
|
const lists = await r.json();
|
|
if (!lists.length) { grid.innerHTML = '<div class="empty">Ingen playlister endnu.</div>'; return; }
|
|
grid.innerHTML = lists.map(p => {
|
|
const vis = p.visibility || 'private';
|
|
const bc = vis === 'public' ? 'green' : vis === 'shared' ? 'orange' : 'muted';
|
|
const bl = vis === 'public' ? 'public' : vis === 'shared' ? 'delt' : 'privat';
|
|
const sc = p.song_count || (p.songs || []).length || 0;
|
|
return `
|
|
<div class="card fade-in">
|
|
<div class="card-title">${esc(p.name)}</div>
|
|
<div class="card-meta">
|
|
<span class="badge orange">${sc} sange</span>
|
|
<span class="badge ${bc}" id="vis-badge-${p.id}">${bl}</span>
|
|
</div>
|
|
<div class="card-actions">
|
|
<button class="btn sm" onclick="openDetail('${p.id}',true)">Se sange</button>
|
|
<button class="btn sm${vis==='public'?' danger':''}" id="vis-btn-${p.id}"
|
|
onclick="toggleVis('${p.id}','${vis}')">
|
|
${vis === 'public' ? 'Gør privat' : 'Gør public'}
|
|
</button>
|
|
<a class="btn sm" href="/live.html?id=${p.id}" target="_blank" title="Åbn storskærm">📺</a>
|
|
<button class="btn sm" onclick="showQR('${p.id}','${esc(p.name)}')" title="QR-kode">QR</button>
|
|
</div>
|
|
</div>`;
|
|
}).join('');
|
|
} catch(e) {
|
|
grid.innerHTML = `<div class="empty">Kunne ikke hente playlister.<br>${e.message}</div>`;
|
|
}
|
|
}
|
|
|
|
async function toggleVis(id, current) {
|
|
const newVis = current === 'public' ? 'private' : 'public';
|
|
try {
|
|
const r = await fetch(`${API}/sharing/playlists/${id}/visibility?visibility=${newVis}`, {
|
|
method: 'PATCH', headers: { 'Authorization': `Bearer ${token}` }
|
|
});
|
|
if (!r.ok) throw new Error('Fejl');
|
|
const badge = document.getElementById(`vis-badge-${id}`);
|
|
const btn = document.getElementById(`vis-btn-${id}`);
|
|
if (newVis === 'public') {
|
|
badge.className = 'badge green'; badge.textContent = 'public';
|
|
btn.className = 'btn sm danger'; btn.textContent = 'Gør privat';
|
|
btn.onclick = () => toggleVis(id, 'public');
|
|
} else {
|
|
badge.className = 'badge muted'; badge.textContent = 'privat';
|
|
btn.className = 'btn sm'; btn.textContent = 'Gør public';
|
|
btn.onclick = () => toggleVis(id, 'private');
|
|
}
|
|
loadPublicPlaylists();
|
|
} catch(e) { alert('Fejl: ' + e.message); }
|
|
}
|
|
|
|
async function openDetail(id, isOwn) {
|
|
currentPlaylistId = id;
|
|
document.getElementById('btn-copy').style.display = isOwn ? 'none' : '';
|
|
document.getElementById('detail').classList.add('open');
|
|
document.getElementById('d-songs').innerHTML = '<div class="empty"><div class="spinner"></div></div>';
|
|
try {
|
|
const headers = token ? { 'Authorization': `Bearer ${token}` } : {};
|
|
const r = await fetch(`${API}/sharing/playlists/${id}`, { headers });
|
|
const p = await r.json();
|
|
document.getElementById('d-title').textContent = p.name;
|
|
document.getElementById('d-meta').textContent = `${p.songs.length} sange${p.owner ? ' · @ '+p.owner : ''}`;
|
|
document.getElementById('d-songs').innerHTML = p.songs.length
|
|
? p.songs.map((s,i) => `
|
|
<div class="song-row">
|
|
<span class="song-num">${i+1}</span>
|
|
<div class="song-info">
|
|
<div class="song-title">${esc(s.title)}</div>
|
|
<div class="song-artist">${esc(s.artist)}</div>
|
|
</div>
|
|
${s.dance_override ? `<span class="song-dance">${esc(s.dance_override)}</span>` : ''}
|
|
</div>`).join('')
|
|
: '<div class="empty">Ingen sange.</div>';
|
|
} catch(e) {
|
|
document.getElementById('d-songs').innerHTML = '<div class="empty">Kunne ikke hente detaljer.</div>';
|
|
}
|
|
}
|
|
|
|
function closeDetail() {
|
|
document.getElementById('detail').classList.remove('open');
|
|
currentPlaylistId = null;
|
|
}
|
|
document.getElementById('btn-close-detail').onclick = closeDetail;
|
|
document.getElementById('btn-close-detail2').onclick = closeDetail;
|
|
document.getElementById('detail').onclick = e => {
|
|
if (e.target === document.getElementById('detail')) closeDetail();
|
|
};
|
|
|
|
document.getElementById('btn-copy').onclick = async () => {
|
|
if (!token) { document.getElementById('login-modal').classList.add('open'); return; }
|
|
const btn = document.getElementById('btn-copy');
|
|
btn.disabled = true; btn.textContent = 'Kopierer...';
|
|
try {
|
|
const r = await fetch(`${API}/sharing/playlists/${currentPlaylistId}/copy`, {
|
|
method: 'POST', headers: { 'Authorization': `Bearer ${token}` }
|
|
});
|
|
const d = await r.json();
|
|
if (!r.ok) throw new Error(d.detail || 'Fejl');
|
|
btn.textContent = '✓ Kopieret!'; btn.style.background = 'var(--green)';
|
|
setTimeout(() => { btn.textContent = 'Kopiér til min konto'; btn.style.background = ''; btn.disabled = false; }, 2500);
|
|
loadMyPlaylists();
|
|
} catch(e) { btn.textContent = '⚠ ' + e.message; btn.disabled = false; }
|
|
};
|
|
|
|
let currentQRUrl = '';
|
|
|
|
function showQR(id, name) {
|
|
const url = `${location.protocol}//${location.host}/live.html?id=${id}`;
|
|
currentQRUrl = url;
|
|
document.getElementById('qr-title').textContent = name;
|
|
document.getElementById('qr-url').textContent = url;
|
|
document.getElementById('copy-msg').textContent = '';
|
|
document.getElementById('qr-modal').style.display = 'flex';
|
|
|
|
// Tegn QR med et simpelt bibliotek
|
|
const canvas = document.getElementById('qr-canvas');
|
|
if (window.QRious) {
|
|
new QRious({ element: canvas, value: url, size: 220, backgroundAlpha: 0, foreground: '#eceef4' });
|
|
} else {
|
|
// Fallback: vis bare URL hvis bibliotek ikke er loadet
|
|
canvas.style.display = 'none';
|
|
}
|
|
}
|
|
|
|
function copyLiveUrl() {
|
|
navigator.clipboard.writeText(currentQRUrl).then(() => {
|
|
const msg = document.getElementById('copy-msg');
|
|
msg.textContent = '✓ Kopieret!';
|
|
setTimeout(() => msg.textContent = '', 2000);
|
|
});
|
|
}
|
|
|
|
function esc(s) { return (s||'').replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); }
|
|
|
|
updateAuthUI();
|
|
loadPublicPlaylists();
|
|
if (token) loadMyPlaylists();
|
|
</script>
|
|
</body>
|
|
</html>
|