v_1.7
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
const $ = (s) => document.querySelector(s);
|
||||
const id = location.pathname.split('/').filter(Boolean).pop();
|
||||
let joinUrl = '';
|
||||
|
||||
function toast(msg) {
|
||||
const t = $('#toast'); t.textContent = msg; t.classList.add('show');
|
||||
clearTimeout(toast._t); toast._t = setTimeout(() => t.classList.remove('show'), 1800);
|
||||
}
|
||||
|
||||
async function load() {
|
||||
try {
|
||||
const meta = await (await fetch(`/api/sessions/${id}`)).json();
|
||||
if (meta && meta.title) $('#qrTitle').textContent = meta.title;
|
||||
} catch {}
|
||||
try {
|
||||
const q = await (await fetch(`/api/sessions/${id}/qr`)).json();
|
||||
joinUrl = q.url;
|
||||
const img = new Image();
|
||||
img.alt = 'QR code'; img.src = q.dataUrl;
|
||||
$('#qrBig').replaceChildren(img);
|
||||
const link = $('#qrLink'); link.href = q.url; link.textContent = q.url;
|
||||
} catch {
|
||||
$('#qrBig').innerHTML = '<div class="msg">This presentation is no longer available.</div>';
|
||||
$('#eyebrow').textContent = '';
|
||||
}
|
||||
}
|
||||
|
||||
$('#copyBtn').addEventListener('click', () => {
|
||||
if (joinUrl) navigator.clipboard.writeText(joinUrl).then(() => toast('Link copied'));
|
||||
});
|
||||
$('#fsBtn').addEventListener('click', () => {
|
||||
const el = document.documentElement;
|
||||
if (document.fullscreenElement) document.exitFullscreen();
|
||||
else el.requestFullscreen?.();
|
||||
});
|
||||
$('#printBtn').addEventListener('click', () => window.print());
|
||||
|
||||
load();
|
||||
Reference in New Issue
Block a user