Aide : le terme ouvert s'arrête sous la barre ; test du match : attendre l'enregistrement avant de recharger

Après la fusion de main, l'aide amenait la carte du terme en haut alors
que la marge de défilement est posée sur son titre (dt).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pierre MARTIN
2026-11-10 00:03:17 +01:00
co-authored by Claude Opus 5.5
parent 414dfa79f8
commit 1e9dfbb74b
2 changed files with 41 additions and 1 deletions
+40
View File
@@ -290,6 +290,46 @@ for (;;) {
if (!reloaded) {
// Le match continue après un rechargement de la page.
reloaded = true;
// L'application enregistre sans attendre : on laisse IndexedDB
// finir d'écrire la nouvelle partie (Firefox peut être lent).
await until("partie suivante enregistrée", (score) => new Promise((resolve) => {
const open = indexedDB.open("ustagammon");
open.onerror = () => resolve(false);
open.onsuccess = () => {
const tx = open.result.transaction(["settings", "games"]);
const current = tx.objectStore("settings").get("current");
current.onsuccess = () => {
const id = current.result?.value;
if (typeof id !== "string") {
resolve(false);
return;
}
const summary = tx.objectStore("games").get(id);
summary.onsuccess = () => {
const s = summary.result;
resolve(s?.status === "playing" &&
`${s.match?.score.computer}-${s.match?.score.player}` === score);
open.result.close();
};
};
};
}), `${next.computer}-${next.player}`).catch(async (error) => {
const stored = await page.evaluate(() => new Promise((resolve) => {
const open = indexedDB.open("ustagammon");
open.onerror = () => resolve(`IndexedDB : ${open.error}`);
open.onsuccess = () => {
const all = open.result.transaction(["settings", "games"]);
const current = all.objectStore("settings").get("current");
const games = all.objectStore("games").getAll();
games.onsuccess = () => resolve(JSON.stringify({
current: current.result,
games: games.result.map((g) => [g.id, g.status, g.match, g.updatedAt]),
local: Object.keys(localStorage),
}));
};
}));
throw new Error(`${error.message} ; enregistré : ${stored}`);
});
await page.reload();
await until("partie reprise", () => !document.body.classList.contains("busy"));
const again = await shownMatch();