fixes and patches n stuff

This commit is contained in:
tyuXX 2026-10-21 21:07:54 +00:00
parent 7c7ae8e051
commit 1af973d001
14 changed files with 571 additions and 268 deletions

View file

@ -3,6 +3,7 @@
*/
(function () {
let isOffline = !navigator.onLine;
let bannerTimeout = null;
// 1. Service Worker Registration
if ('serviceWorker' in navigator) {
@ -41,6 +42,10 @@
}
function showOfflineBanner() {
if (bannerTimeout) {
clearTimeout(bannerTimeout);
bannerTimeout = null;
}
const banner = getOrCreateBanner();
banner.className = 'offline-banner active';
banner.innerHTML = `
@ -52,6 +57,10 @@
}
function showOnlineBanner() {
if (bannerTimeout) {
clearTimeout(bannerTimeout);
bannerTimeout = null;
}
const banner = getOrCreateBanner();
banner.className = 'offline-banner online';
banner.innerHTML = `
@ -60,8 +69,9 @@
<span class="offline-banner-text">Connection restored. Live features re-enabled.</span>
</div>
`;
setTimeout(() => {
bannerTimeout = setTimeout(() => {
banner.className = 'offline-banner hidden';
bannerTimeout = null;
}, 2800);
}
@ -104,7 +114,7 @@
// --- B. Private Lesson Request Form ---
const lessonForm = document.getElementById('privateLessonForm');
const btnSubmitLesson = document.getElementById('btnSubmitLessonRequest');
const btnSubmitLesson = document.getElementById('btnSubmitRequest');
const formSelects = document.querySelectorAll('#privateLessonForm select, #privateLessonForm button[type="submit"]');
let noticeEl = document.getElementById('privateLessonOfflineNotice');
@ -130,7 +140,19 @@
}
}
// --- C. Sync Buttons Across All Pages ---
// --- C. Station Buttons in Syllabus ---
const stationButtons = document.querySelectorAll('.station-btn');
stationButtons.forEach((btn) => {
if (offline) {
btn.classList.add('station-btn-offline');
btn.title = 'Offline mode: Station selection requires connection.';
} else {
btn.classList.remove('station-btn-offline');
btn.title = '';
}
});
// --- D. Sync Buttons Across All Pages ---
const syncButtonSelectors = [
'#btnSyncRecent',
'#btnSyncAll',