Download index.html from Malakyan/transform: direct link, hf CLI and curl.
- Browser
- Download file 21.3 kB
-
https://huggingface.co/spaces/Malakyan/transform/resolve/main/index.html
- Command line
-
hf download hf://spaces/Malakyan/transform/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Malakyan/transform/resolve/main/index.html
21.3 kB
| <html lang="fr"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"> | |
| <title>TRANSFORM</title> | |
| <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=Bebas+Neue&display=swap" rel="stylesheet"> | |
| <style> | |
| * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; } | |
| body { background: #080c10; font-family: 'DM Sans', sans-serif; color: #fff; min-height: 100vh; } | |
| input[type=number] { -moz-appearance: textfield; } | |
| input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } | |
| .page { display: none; } | |
| .page.active { display: block; } | |
| /* Setup */ | |
| #setup { display: none; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; } | |
| #setup.active { display: flex; } | |
| .setup-box { width: 100%; max-width: 420px; } | |
| .setup-title { font-size: 56px; font-family: 'Bebas Neue', sans-serif; color: #b8ff57; letter-spacing: 4px; text-align: center; line-height: 1; } | |
| .setup-sub { color: #555; font-size: 14px; text-align: center; margin-top: 6px; } | |
| .setup-form { background: #0f1419; border-radius: 20px; padding: 32px; border: 1px solid #1a2030; margin-top: 40px; } | |
| .setup-form label { color: #999; font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; display: block; } | |
| .setup-form input { width: 100%; background: #171d27; border: 1px solid #2a3040; border-radius: 12px; padding: 14px 16px; color: #fff; font-size: 22px; font-family: 'DM Sans'; margin-top: 8px; margin-bottom: 20px; outline: none; } | |
| .btn-primary { width: 100%; background: #b8ff57; color: #080c10; border: none; border-radius: 12px; padding: 16px; font-size: 16px; font-weight: 700; cursor: pointer; letter-spacing: 0.5px; font-family: 'DM Sans'; } | |
| .btn-primary:active { opacity: 0.85; } | |
| /* Dashboard */ | |
| #dashboard { padding-bottom: 80px; } | |
| .container { max-width: 480px; margin: 0 auto; padding: 0 24px; } | |
| .header { padding: 28px 24px 0; max-width: 480px; margin: 0 auto; display: flex; justify-content: space-between; align-items: flex-start; } | |
| .logo { font-size: 28px; font-family: 'Bebas Neue'; color: #b8ff57; letter-spacing: 3px; } | |
| .header-date { color: #444; font-size: 12px; margin-top: 2px; } | |
| .streak-label { font-size: 11px; color: #555; letter-spacing: 1px; text-transform: uppercase; text-align: right; } | |
| .streak-val { font-size: 24px; font-weight: 700; } | |
| .card { background: #0f1419; border-radius: 20px; padding: 20px 24px; border: 1px solid #1a2030; margin-top: 16px; } | |
| .card-gradient { background: linear-gradient(135deg, #0f1419 0%, #111820 100%); padding: 28px; position: relative; overflow: hidden; border-radius: 24px; } | |
| .card-glow { position: absolute; top: -40px; right: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(184,255,87,0.08), transparent 70%); } | |
| .section-title { font-size: 12px; color: #555; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 16px; } | |
| .stat-label { font-size: 11px; color: #555; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; } | |
| .weight-big { font-size: 52px; font-weight: 300; line-height: 1; } | |
| .weight-big .unit { font-size: 20px; color: #555; margin-left: 4px; } | |
| .goal-line { font-size: 12px; color: #666; margin-top: 6px; } | |
| .goal-line span { color: #b8ff57; font-weight: 600; } | |
| .progress-row { display: flex; justify-content: space-between; font-size: 11px; color: #555; margin-bottom: 8px; } | |
| .progress-bar { height: 6px; background: #1a2030; border-radius: 99px; overflow: hidden; } | |
| .progress-fill { height: 100%; background: linear-gradient(90deg, #5aff57, #b8ff57); border-radius: 99px; transition: width 0.8s ease; } | |
| /* Log input */ | |
| .log-row { display: flex; gap: 12px; align-items: center; } | |
| .log-input { flex: 1; background: #171d27; border: 1px solid #2a3040; border-radius: 12px; padding: 13px 16px; color: #fff; font-size: 16px; font-family: 'DM Sans'; outline: none; } | |
| .log-btn { background: #b8ff57; color: #080c10; border: none; border-radius: 12px; padding: 13px 20px; font-size: 20px; font-weight: 700; cursor: pointer; flex-shrink: 0; } | |
| /* Habits */ | |
| .habits-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; } | |
| .habit-toggle { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #171d27; border-radius: 12px; cursor: pointer; border: 1px solid #2a3040; transition: all 0.2s; user-select: none; } | |
| .habit-toggle.on { border-color: #b8ff57; background: #1a2a10; } | |
| .habit-dot { width: 10px; height: 10px; border-radius: 50%; background: #2a3040; transition: background 0.2s; flex-shrink: 0; } | |
| .habit-toggle.on .habit-dot { background: #b8ff57; } | |
| .habit-name { font-size: 13px; color: #888; } | |
| .habit-toggle.on .habit-name { color: #b8ff57; } | |
| /* Chart */ | |
| .chart-box { position: relative; height: 200px; } | |
| canvas { width: 100% ; } | |
| /* History */ | |
| .hist-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-radius: 10px; } | |
| .hist-row:first-child { background: #171d27; } | |
| .hist-date { color: #666; font-size: 13px; } | |
| .hist-diff { font-size: 12px; font-weight: 600; } | |
| .hist-weight { font-weight: 600; font-size: 16px; } | |
| .hist-weight .unit { color: #444; font-size: 12px; } | |
| .success-banner { margin-top: 16px; background: linear-gradient(135deg, #b8ff57, #5aff57); border-radius: 20px; padding: 24px; text-align: center; } | |
| .success-banner .title { font-size: 18px; font-weight: 700; color: #080c10; margin-top: 8px; } | |
| .success-banner .sub { color: #1a4010; font-size: 14px; margin-top: 4px; } | |
| /* Loading overlay */ | |
| .loading { text-align: center; padding: 40px; color: #555; font-size: 14px; } | |
| .spinner { width: 32px; height: 32px; border: 3px solid #1a2030; border-top-color: #b8ff57; border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 12px; } | |
| @keyframes spin { to { transform: rotate(360deg); } } | |
| /* Status message */ | |
| .status-msg { text-align: center; font-size: 12px; margin-top: 8px; min-height: 18px; } | |
| .status-ok { color: #b8ff57; } | |
| .status-err { color: #ff6b6b; } | |
| /* Reset btn */ | |
| .reset-btn { background: none; border: 1px solid #2a3040; color: #555; border-radius: 10px; padding: 10px 16px; font-size: 12px; cursor: pointer; font-family: 'DM Sans'; margin-top: 16px; width: 100%; } | |
| .reset-btn:active { opacity: 0.7; } | |
| </style> | |
| </head> | |
| <body> | |
| <!-- SETUP SCREEN --> | |
| <div id="setup" class="page"> | |
| <div class="setup-box"> | |
| <div class="setup-title">TRANSFORM</div> | |
| <div class="setup-sub">Suivi de perte de poids</div> | |
| <div class="setup-form"> | |
| <label>Poids actuel (kg)</label> | |
| <input type="number" id="inp-start" placeholder="ex: 85" inputmode="decimal"> | |
| <label>Poids objectif (kg)</label> | |
| <input type="number" id="inp-goal" placeholder="ex: 72" inputmode="decimal"> | |
| <button class="btn-primary" onclick="doSetup()">Commencer ma transformation</button> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- DASHBOARD --> | |
| <div id="dashboard" class="page"> | |
| <div class="header"> | |
| <div> | |
| <div class="logo">TRANSFORM</div> | |
| <div class="header-date" id="hdr-date"></div> | |
| </div> | |
| <div> | |
| <div class="streak-label">Streak</div> | |
| <div class="streak-val" id="hdr-streak">0</div> | |
| </div> | |
| </div> | |
| <div class="container"> | |
| <!-- Big stats card --> | |
| <div class="card card-gradient" style="margin-top:28px; border:1px solid #1a2030;"> | |
| <div class="card-glow"></div> | |
| <div style="display:flex;justify-content:space-between;align-items:center;position:relative;"> | |
| <div> | |
| <div class="stat-label">Poids actuel</div> | |
| <div class="weight-big" id="stat-current">--<span class="unit">kg</span></div> | |
| <div class="goal-line">Objectif : <span id="stat-goal">--</span> kg</div> | |
| </div> | |
| <div style="text-align:center;"> | |
| <svg width="90" height="90" style="transform:rotate(-90deg)"> | |
| <circle cx="45" cy="45" r="38" fill="none" stroke="#1a2030" stroke-width="7"/> | |
| <circle id="ring" cx="45" cy="45" r="38" fill="none" stroke="#b8ff57" stroke-width="7" stroke-linecap="round" | |
| stroke-dasharray="238.76" stroke-dashoffset="238.76" style="transition:stroke-dashoffset 0.8s ease"/> | |
| </svg> | |
| <div style="margin-top:-54px;font-size:18px;font-weight:700;color:#b8ff57" id="stat-pct">0%</div> | |
| <div style="margin-top:32px;font-size:10px;color:#555">COMPLETE</div> | |
| </div> | |
| </div> | |
| <div style="margin-top:24px;"> | |
| <div class="progress-row"> | |
| <span>Perdu : <span style="font-weight:600" id="stat-lost">0 kg</span></span> | |
| <span>Restant : <span style="font-weight:600" id="stat-left">0 kg</span></span> | |
| </div> | |
| <div class="progress-bar"><div class="progress-fill" id="bar-fill" style="width:0%"></div></div> | |
| </div> | |
| </div> | |
| <!-- Log today --> | |
| <div class="card"> | |
| <div class="log-row"> | |
| <input type="number" class="log-input" id="inp-weight" placeholder="Poids aujourd'hui (kg)" inputmode="decimal"> | |
| <button class="log-btn" onclick="addEntry()">+</button> | |
| </div> | |
| <!-- Habits --> | |
| <div style="margin-top:16px;"> | |
| <div class="habits-grid"> | |
| <div class="habit-toggle" data-habit="jeune" onclick="toggleHabit(this)"> | |
| <div class="habit-dot"></div><div class="habit-name">Jeune</div> | |
| </div> | |
| <div class="habit-toggle" data-habit="sucre" onclick="toggleHabit(this)"> | |
| <div class="habit-dot"></div><div class="habit-name">Sans sucre</div> | |
| </div> | |
| <div class="habit-toggle" data-habit="vacuum" onclick="toggleHabit(this)"> | |
| <div class="habit-dot"></div><div class="habit-name">Vacuum</div> | |
| </div> | |
| <div class="habit-toggle" data-habit="flex" onclick="toggleHabit(this)"> | |
| <div class="habit-dot"></div><div class="habit-name">Souplesse</div> | |
| </div> | |
| <div class="habit-toggle" data-habit="eau" onclick="toggleHabit(this)" style="grid-column: span 2;"> | |
| <div class="habit-dot"></div><div class="habit-name">2L+ d'eau</div> | |
| </div> | |
| </div> | |
| </div> | |
| <div class="status-msg" id="status-msg"></div> | |
| </div> | |
| <!-- Chart --> | |
| <div class="card" id="chart-card" style="display:none;"> | |
| <div class="section-title">Evolution</div> | |
| <div class="chart-box"> | |
| <canvas id="chart"></canvas> | |
| </div> | |
| </div> | |
| <!-- History --> | |
| <div class="card" id="hist-card" style="display:none;"> | |
| <div class="section-title">Historique</div> | |
| <div id="hist-list"></div> | |
| </div> | |
| <!-- Success --> | |
| <div id="success-banner" class="success-banner" style="display:none;"> | |
| <div style="font-size:32px">🎉</div> | |
| <div class="title">Objectif atteint !</div> | |
| <div class="sub">Bravo, transformation accomplie.</div> | |
| </div> | |
| <!-- Reset --> | |
| <button class="reset-btn" onclick="resetApp()">Reinitialiser l'application</button> | |
| </div> | |
| </div> | |
| <!-- Loading --> | |
| <div id="loading" style="display:none;position:fixed;inset:0;background:#080c10;z-index:999;display:flex;align-items:center;justify-content:center;"> | |
| <div class="loading"><div class="spinner"></div>Chargement...</div> | |
| </div> | |
| <script src="https://cdn.jsdelivr.net/npm/chart.js@4/dist/chart.umd.min.js"></script> | |
| <script> | |
| const API = "https://script.google.com/macros/s/AKfycbxI6OC2DxKtblzSjE5laasREnPmK7zDdeIeGYGZEN-rRryDKRPjptLexUefVKvj_ew/exec"; | |
| let entries = []; | |
| let startWeight = 0; | |
| let goalWeight = 0; | |
| let chart = null; | |
| // --- Utils --- | |
| function todayStr() { | |
| return new Date().toISOString().split("T")[0]; | |
| } | |
| function fmtDate(d) { | |
| return new Date(d).toLocaleDateString("fr-FR", { day: "2-digit", month: "short" }); | |
| } | |
| // --- Persistence (localStorage for settings) --- | |
| function saveSettings() { | |
| localStorage.setItem("tf_start", startWeight); | |
| localStorage.setItem("tf_goal", goalWeight); | |
| } | |
| function loadSettings() { | |
| startWeight = parseFloat(localStorage.getItem("tf_start")) || 0; | |
| goalWeight = parseFloat(localStorage.getItem("tf_goal")) || 0; | |
| } | |
| // --- Google Sheets --- | |
| async function fetchEntries() { | |
| try { | |
| const r = await fetch(API); | |
| const data = await r.json(); | |
| // data is array of numbers (last 15 weights) from your script | |
| // We'll map them to simple objects. Since the script only returns weights, | |
| // we'll number them backwards from today. | |
| if (Array.isArray(data) && data.length > 0) { | |
| // If entries are numbers, create dates going back from today | |
| if (typeof data[0] === "number") { | |
| const today = new Date(); | |
| entries = data.map((w, i) => { | |
| const d = new Date(today); | |
| d.setDate(d.getDate() - (data.length - 1 - i)); | |
| return { date: d.toISOString().split("T")[0], weight: w }; | |
| }); | |
| } else { | |
| // If we get objects (after script update) | |
| entries = data.map(e => ({ date: e.date, weight: e.poids })); | |
| } | |
| } | |
| } catch (err) { | |
| console.error("Fetch error:", err); | |
| } | |
| } | |
| async function postEntry(poids, habits) { | |
| try { | |
| const body = { | |
| poids: poids, | |
| jeune: habits.jeune || false, | |
| sucre: habits.sucre || false, | |
| vacuum: habits.vacuum || false, | |
| flex: habits.flex || false, | |
| eau: habits.eau || false | |
| }; | |
| await fetch(API, { | |
| method: "POST", | |
| body: JSON.stringify(body), | |
| headers: { "Content-Type": "text/plain" } // avoid CORS preflight | |
| }); | |
| return true; | |
| } catch (err) { | |
| console.error("Post error:", err); | |
| return false; | |
| } | |
| } | |
| // --- Habits --- | |
| function toggleHabit(el) { | |
| el.classList.toggle("on"); | |
| } | |
| function getHabits() { | |
| const h = {}; | |
| document.querySelectorAll(".habit-toggle").forEach(el => { | |
| h[el.dataset.habit] = el.classList.contains("on"); | |
| }); | |
| return h; | |
| } | |
| // --- Setup --- | |
| function doSetup() { | |
| const s = parseFloat(document.getElementById("inp-start").value); | |
| const g = parseFloat(document.getElementById("inp-goal").value); | |
| if (!s || !g || s <= g) return; | |
| startWeight = s; | |
| goalWeight = g; | |
| saveSettings(); | |
| // Post initial weight | |
| postEntry(s, {}); | |
| entries = [{ date: todayStr(), weight: s }]; | |
| showDashboard(); | |
| } | |
| // --- Add entry --- | |
| async function addEntry() { | |
| const inp = document.getElementById("inp-weight"); | |
| const w = parseFloat(inp.value); | |
| if (!w || w < 30 || w > 300) return; | |
| const habits = getHabits(); | |
| const msgEl = document.getElementById("status-msg"); | |
| msgEl.textContent = "Enregistrement..."; | |
| msgEl.className = "status-msg"; | |
| const ok = await postEntry(w, habits); | |
| if (ok) { | |
| // Update local entries - replace today or add | |
| const todayDate = todayStr(); | |
| const idx = entries.findIndex(e => e.date === todayDate); | |
| if (idx >= 0) entries[idx].weight = w; | |
| else entries.push({ date: todayDate, weight: w }); | |
| inp.value = ""; | |
| // Reset habit toggles | |
| document.querySelectorAll(".habit-toggle").forEach(el => el.classList.remove("on")); | |
| msgEl.textContent = "Enregistre !"; | |
| msgEl.className = "status-msg status-ok"; | |
| renderDashboard(); | |
| } else { | |
| msgEl.textContent = "Erreur de connexion"; | |
| msgEl.className = "status-msg status-err"; | |
| } | |
| setTimeout(() => { msgEl.textContent = ""; }, 3000); | |
| } | |
| // --- Render --- | |
| function showPage(id) { | |
| document.querySelectorAll(".page").forEach(p => p.classList.remove("active")); | |
| document.getElementById(id).classList.add("active"); | |
| } | |
| function showDashboard() { | |
| showPage("dashboard"); | |
| renderDashboard(); | |
| } | |
| function renderDashboard() { | |
| const sorted = [...entries].sort((a, b) => a.date.localeCompare(b.date)); | |
| const latest = sorted[sorted.length - 1]; | |
| const current = latest ? latest.weight : startWeight; | |
| const goal = goalWeight; | |
| const start = startWeight; | |
| const totalToLose = start - goal; | |
| const alreadyLost = start - current; | |
| const pct = totalToLose > 0 ? Math.min(100, Math.max(0, (alreadyLost / totalToLose) * 100)) : 0; | |
| const toGo = Math.max(0, current - goal); | |
| // Streak | |
| let streak = 0; | |
| if (sorted.length > 0) { | |
| streak = 1; | |
| let d = new Date(sorted[sorted.length - 1].date); | |
| for (let i = sorted.length - 2; i >= 0; i--) { | |
| const prev = new Date(sorted[i].date); | |
| if ((d - prev) / 86400000 <= 1.5) { streak++; d = prev; } else break; | |
| } | |
| } | |
| // Header | |
| document.getElementById("hdr-date").textContent = fmtDate(todayStr()); | |
| const streakEl = document.getElementById("hdr-streak"); | |
| streakEl.textContent = streak + (streak >= 3 ? " \uD83D\uDD25" : ""); | |
| streakEl.style.color = streak >= 3 ? "#b8ff57" : "#fff"; | |
| // Stats | |
| document.getElementById("stat-current").innerHTML = current.toFixed(1) + '<span class="unit">kg</span>'; | |
| document.getElementById("stat-goal").textContent = goal; | |
| document.getElementById("stat-pct").textContent = pct.toFixed(0) + "%"; | |
| const circ = 2 * Math.PI * 38; | |
| document.getElementById("ring").setAttribute("stroke-dashoffset", circ * (1 - pct / 100)); | |
| const lostEl = document.getElementById("stat-lost"); | |
| lostEl.textContent = alreadyLost.toFixed(1) + " kg"; | |
| lostEl.style.color = alreadyLost > 0 ? "#b8ff57" : "#fff"; | |
| const leftEl = document.getElementById("stat-left"); | |
| leftEl.textContent = toGo.toFixed(1) + " kg"; | |
| leftEl.style.color = toGo > 0 ? "#ff6b6b" : "#b8ff57"; | |
| document.getElementById("bar-fill").style.width = pct + "%"; | |
| // Chart | |
| if (sorted.length >= 2) { | |
| document.getElementById("chart-card").style.display = "block"; | |
| renderChart(sorted, goal); | |
| } else { | |
| document.getElementById("chart-card").style.display = "none"; | |
| } | |
| // History | |
| if (sorted.length > 0) { | |
| document.getElementById("hist-card").style.display = "block"; | |
| const list = document.getElementById("hist-list"); | |
| list.innerHTML = ""; | |
| const rev = [...sorted].reverse().slice(0, 7); | |
| rev.forEach((e, i) => { | |
| const prev = sorted[sorted.length - 1 - i - 1]; | |
| const diff = prev ? (e.weight - prev.weight).toFixed(1) : null; | |
| const row = document.createElement("div"); | |
| row.className = "hist-row"; | |
| let diffHtml = ""; | |
| if (diff !== null) { | |
| const c = parseFloat(diff) < 0 ? "#b8ff57" : parseFloat(diff) > 0 ? "#ff6b6b" : "#666"; | |
| diffHtml = `<span class="hist-diff" style="color:${c}">${parseFloat(diff) > 0 ? "+" : ""}${diff} kg</span>`; | |
| } | |
| row.innerHTML = ` | |
| <span class="hist-date">${fmtDate(e.date)}</span> | |
| <div style="display:flex;align-items:center;gap:12px"> | |
| ${diffHtml} | |
| <span class="hist-weight">${e.weight} <span class="unit">kg</span></span> | |
| </div>`; | |
| list.appendChild(row); | |
| }); | |
| } | |
| // Success | |
| document.getElementById("success-banner").style.display = pct >= 100 ? "block" : "none"; | |
| } | |
| function renderChart(sorted, goal) { | |
| const labels = sorted.map(e => fmtDate(e.date)); | |
| const data = sorted.map(e => e.weight); | |
| if (chart) chart.destroy(); | |
| const ctx = document.getElementById("chart").getContext("2d"); | |
| chart = new Chart(ctx, { | |
| type: "line", | |
| data: { | |
| labels, | |
| datasets: [ | |
| { | |
| data, | |
| borderColor: "#b8ff57", | |
| backgroundColor: "rgba(184,255,87,0.08)", | |
| borderWidth: 2.5, | |
| pointRadius: 4, | |
| pointBackgroundColor: "#b8ff57", | |
| pointBorderWidth: 0, | |
| tension: 0.3, | |
| fill: true | |
| } | |
| ] | |
| }, | |
| options: { | |
| responsive: true, | |
| maintainAspectRatio: false, | |
| plugins: { | |
| legend: { display: false }, | |
| tooltip: { | |
| backgroundColor: "#111", | |
| borderColor: "#b8ff57", | |
| borderWidth: 1, | |
| titleColor: "#b8ff57", | |
| bodyColor: "#fff", | |
| callbacks: { label: ctx => ctx.parsed.y + " kg" } | |
| }, | |
| annotation: goal ? { | |
| annotations: { | |
| goalLine: { | |
| type: "line", | |
| yMin: goal, yMax: goal, | |
| borderColor: "rgba(184,255,87,0.4)", | |
| borderDash: [4, 4], | |
| borderWidth: 1 | |
| } | |
| } | |
| } : undefined | |
| }, | |
| scales: { | |
| x: { grid: { color: "#1a2030" }, ticks: { color: "#444", font: { size: 11 } } }, | |
| y: { grid: { color: "#1a2030" }, ticks: { color: "#444", font: { size: 11 } } } | |
| } | |
| } | |
| }); | |
| } | |
| // --- Reset --- | |
| function resetApp() { | |
| if (!confirm("Reinitialiser ? Les donnees Google Sheets ne seront pas supprimees.")) return; | |
| localStorage.removeItem("tf_start"); | |
| localStorage.removeItem("tf_goal"); | |
| entries = []; | |
| showPage("setup"); | |
| } | |
| // --- Init --- | |
| async function init() { | |
| document.getElementById("loading").style.display = "flex"; | |
| loadSettings(); | |
| if (startWeight && goalWeight) { | |
| await fetchEntries(); | |
| document.getElementById("loading").style.display = "none"; | |
| showDashboard(); | |
| } else { | |
| document.getElementById("loading").style.display = "none"; | |
| showPage("setup"); | |
| } | |
| } | |
| // Enter key support | |
| document.addEventListener("keydown", e => { | |
| if (e.key === "Enter" && document.activeElement === document.getElementById("inp-weight")) { | |
| addEntry(); | |
| } | |
| }); | |
| init(); | |
| </script> | |
| </body> | |
| </html> | |