Cross-Platform-Polish: plattformgerechte Passkey-Texte (iOS/Android), maskierbares Android-Icon, View-Übergänge, Touch-Feinschliff (user-select, will-change, decoding=async, reduced-motion)

This commit is contained in:
Duarte Santos committed 2026-07-19 15:15:02 +02:00
1 parent bf6d53a568
commit e4118d3c0f
5 files changed
+23 -13

No files matched your search

+11 -5
View File
@@ -81,6 +81,11 @@ function beep(freq, dur, when) {
let USER = null;
const isGuest = () => localStorage.getItem('gym_guest') === '1';
const webauthnOK = () => !!(window.PublicKeyCredential && navigator.credentials);
/* platform-aware wording — same WebAuthn underneath, different branding on top */
const IS_APPLE = /iPhone|iPad|iPod|Macintosh/.test(navigator.userAgent);
const IS_ANDROID = /Android/.test(navigator.userAgent);
const BIO = IS_APPLE ? 'Face ID / Touch ID' : IS_ANDROID ? 'fingerprint or face unlock' : 'your fingerprint, face or PIN';
const VAULT = IS_APPLE ? 'iCloud Keychain' : IS_ANDROID ? 'Google Password Manager' : 'your password manager';
async function api(path, opts) {
const r = await fetch(path, Object.assign({ headers: { 'Content-Type': 'application/json' } }, opts));
const data = await r.json().catch(() => ({}));
@@ -241,9 +246,9 @@ function streakWeeks() {
}
/* ---------- media ---------- */
const imgEl = (ex, cls) => `<img class="${cls||'thumb'}" loading="lazy" src="img/${ex.img}" alt="">`;
const imgEl = (ex, cls) => `<img class="${cls||'thumb'}" loading="lazy" decoding="async" src="img/${ex.img}" alt="">`;
/* big autoplay animation for single-exercise views; tap pauses (swaps to still) */
const mediaEl = (ex, id) => `<div class="exmedia"${id ? ` id="${id}"` : ''}><img src="gif/${ex.gif}" alt="${esc(ex.n)}"><span class="gifhint">⏸ tap to pause</span></div>`;
const mediaEl = (ex, id) => `<div class="exmedia"${id ? ` id="${id}"` : ''}><img decoding="async" src="gif/${ex.gif}" alt="${esc(ex.n)}"><span class="gifhint">⏸ tap to pause</span></div>`;
function bindMediaToggle(media, ex) {
if (!media) return;
media.onclick = () => {
@@ -511,6 +516,7 @@ function renderView() {
clearInterval(elapsedInt);
closeAllModals();
const app = $('#app');
if (!sameView) { app.classList.remove('vfade'); void app.offsetWidth; app.classList.add('vfade'); }
if (!USER && !isGuest()) viewLogin(app);
else if (view === 'plan' && rest[0] === 'r') viewRoutineEdit(app, rest[1]);
else switch (view) {
@@ -560,7 +566,7 @@ function viewLogin(app) {
<div style="height:10px"></div>` : `
<div class="card small muted" style="text-align:left">This browser doesn't support passkeys — you can still use GymLog locally on this device.</div>`}
<button class="btn ghost dim" id="lg-guest">Continue without account</button>
<div class="dim small" style="margin-top:26px;line-height:1.5">Passkeys use Face ID / Touch ID — no passwords.<br>Each profile keeps its own plan, workouts & body weight.</div>
<div class="dim small" style="margin-top:26px;line-height:1.5">Passkeys use ${BIO} — no passwords.<br>Each profile keeps its own plan, workouts & body weight.</div>
</div>`;
const bi = $('#lg-in');
if (bi) bi.onclick = async () => {
@@ -579,7 +585,7 @@ function viewLogin(app) {
function registerSheet(fromSettings) {
const m = openModal(`
<h3>Create your profile ✨</h3>
<div class="muted small" style="margin-bottom:14px">Pick a name, then confirm with Face ID / Touch ID. The passkey is saved in your iCloud Keychain — no password needed.</div>
<div class="muted small" style="margin-bottom:14px">Pick a name, then confirm with ${BIO}. The passkey is saved in ${VAULT} — no password needed.</div>
<input class="input" id="rg-name" placeholder="Your name" maxlength="40" autocomplete="name">
<div style="height:12px"></div>
<button class="btn primary" id="rg-go">Create passkey</button>`);
@@ -1753,7 +1759,7 @@ function viewSettings(app) {
<div class="card">
<h2>Tip</h2>
<div class="small muted" style="line-height:1.5">📱 In Safari: <b>Share → Add to Home Screen</b> to install GymLog as a full-screen app. All data stays on this device (localStorage) — export a backup now and then!</div>
<div class="small muted" style="line-height:1.5">📱 ${IS_ANDROID ? 'In Chrome: <b>⋮ menu → Add to Home screen</b>' : 'In Safari: <b>Share → Add to Home Screen</b>'} to install GymLog as a full-screen app. ${USER ? 'Your data syncs with your profile — sign in anywhere to see it.' : 'Guest data stays on this device — export a backup now and then!'}</div>
</div>
<div class="dim small" style="text-align:center;margin-top:8px">GymLog · exercise data: hasaneyldrm/exercises-dataset (CC)</div>
</div>
+3 -3
View File
@@ -13,7 +13,7 @@
<link rel="manifest" href="manifest.json">
<link rel="apple-touch-icon" href="icon-180.png">
<link rel="icon" type="image/png" href="icon-180.png">
<link rel="stylesheet" href="style.css?v=10">
<link rel="stylesheet" href="style.css?v=11">
</head>
<body>
<div id="app"><div style="padding-top:42vh;text-align:center;font-size:2.2rem">🏋️</div></div>
@@ -45,7 +45,7 @@
<div id="modal-root"></div>
<div id="toast"></div>
<script src="data.js?v=10"></script>
<script src="app.js?v=10"></script>
<script src="data.js?v=11"></script>
<script src="app.js?v=11"></script>
</body>
</html>
+2 -2
View File
@@ -9,7 +9,7 @@
"background_color": "#0c0e12",
"theme_color": "#0c0e12",
"icons": [
{ "src": "icon-180.png", "sizes": "180x180", "type": "image/png" },
{ "src": "icon-512.png", "sizes": "512x512", "type": "image/png" }
{ "src": "icon-180.png", "sizes": "180x180", "type": "image/png", "purpose": "any" },
{ "src": "icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "any maskable" }
]
}
+5 -1
View File
@@ -23,6 +23,10 @@
:root{--accT:color-mix(in srgb, var(--acc) 16%, transparent)}
*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
button,.chip,.tile,.item,.wday,.cal-d,.ck,.swatch,.emoji-cell,.hm-c,#tabbar,.step{-webkit-user-select:none;user-select:none}
@keyframes viewfade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
#app.vfade{animation:viewfade .18s ease}
@media (prefers-reduced-motion: reduce){*{animation:none!important;transition:none!important}}
html{font-size:16px}
body{
background:var(--bg); color:var(--txt);
@@ -176,7 +180,7 @@ a{color:var(--acc)}
.sheet{position:absolute;left:0;right:0;bottom:0;background:var(--bg2);
border-radius:22px 22px 0 0;padding:10px 18px calc(22px + var(--sab));
max-height:88vh;overflow-y:auto;-webkit-overflow-scrolling:touch;animation:slideup .28s;
overscroll-behavior:contain;touch-action:pan-y}
overscroll-behavior:contain;touch-action:pan-y;will-change:transform}
.sheet .grab{width:40px;height:4px;border-radius:99px;background:var(--line);margin:4px auto 14px}
.sheet h3{font-size:1.15rem;font-weight:800;margin-bottom:12px}
.center{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:min(88vw,360px);
+2 -2
View File
@@ -1,6 +1,6 @@
/* GymLog service worker — network-first for app shell, cache-first for media */
const CACHE = 'gymlog-v10';
const SHELL = ['./', 'index.html', 'style.css?v=10', 'app.js?v=10', 'data.js?v=10', 'manifest.json'];
const CACHE = 'gymlog-v11';
const SHELL = ['./', 'index.html', 'style.css?v=11', 'app.js?v=11', 'data.js?v=11', 'manifest.json'];
self.addEventListener('install', e => {
e.waitUntil(caches.open(CACHE).then(c => c.addAll(SHELL)).then(() => self.skipWaiting()));