feat: auto-save replays on game over and page unload

- Add autoSave() function that saves replay silently on game over
- Add beforeunload listener to save incomplete games when navigating away
- Add prominent 'Save Now' button in status bar (visible during play)
- Show 'Replay auto-saved!' notification in status bar
- Add gameSaved flag to prevent duplicate saves
This commit is contained in:
mattlamb227@gmail.com
2026-08-09 22:11:50 -04:00
parent ba6e26ab59
commit 10d8b0a376
3 changed files with 60 additions and 7 deletions
+18
View File
@@ -342,6 +342,24 @@ h3 {
font-weight: bold;
font-size: 1.05em;
min-height: 24px;
display: flex;
justify-content: space-between;
align-items: center;
}
#status-save-btn {
padding: 4px 12px;
background: var(--blue);
color: var(--bg);
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 0.9em;
font-weight: bold;
}
#status-save-btn:hover {
background: #5bb3ff;
}
/* ===== Replay Page ===== */