fixes and patches n stuff
This commit is contained in:
parent
7c7ae8e051
commit
1af973d001
14 changed files with 571 additions and 268 deletions
|
|
@ -211,9 +211,17 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
});
|
||||
}
|
||||
|
||||
function normalizeTurkish(str) {
|
||||
if (!str) return '';
|
||||
return str
|
||||
.replace(/İ/g, 'i')
|
||||
.replace(/I/g, 'ı')
|
||||
.toLowerCase();
|
||||
}
|
||||
|
||||
if (searchInput) {
|
||||
searchInput.addEventListener('input', (e) => {
|
||||
currentSearch = e.target.value.trim().toLowerCase();
|
||||
currentSearch = normalizeTurkish(e.target.value.trim());
|
||||
if (searchClear) searchClear.classList.toggle('hidden', currentSearch.length === 0);
|
||||
applyFilters();
|
||||
});
|
||||
|
|
@ -290,7 +298,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
|
||||
let matchesSearch = true;
|
||||
if (currentSearch) {
|
||||
matchesSearch = searchText.includes(currentSearch);
|
||||
matchesSearch = normalizeTurkish(searchText).includes(currentSearch);
|
||||
}
|
||||
|
||||
if (matchesTab && matchesSubject && matchesSearch) {
|
||||
|
|
|
|||
|
|
@ -221,11 +221,16 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
// ----------------------------------------------------
|
||||
// Inline Mistake Review Modal
|
||||
// ----------------------------------------------------
|
||||
function openReviewModal(targetSubjectName = null) {
|
||||
function openReviewModal(targetSubjectName = null, targetType = 'all') {
|
||||
if (!mistakeModal || !currentExamId) return;
|
||||
mistakeModal.classList.remove('hidden');
|
||||
document.body.style.overflow = 'hidden';
|
||||
|
||||
activeTypeFilter = targetType || 'all';
|
||||
modalTypeBtns.forEach(b => {
|
||||
b.classList.toggle('active', b.getAttribute('data-type') === activeTypeFilter);
|
||||
});
|
||||
|
||||
if (!cachedQuestions) {
|
||||
loadExamQuestions(targetSubjectName);
|
||||
} else {
|
||||
|
|
@ -244,7 +249,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
}
|
||||
|
||||
if (btnReviewMistakes) {
|
||||
btnReviewMistakes.addEventListener('click', () => openReviewModal());
|
||||
btnReviewMistakes.addEventListener('click', () => openReviewModal(null, 'all'));
|
||||
}
|
||||
|
||||
if (btnMistakeModalClose) {
|
||||
|
|
@ -256,7 +261,9 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
btn.addEventListener('click', (e) => {
|
||||
e.stopPropagation();
|
||||
const subjectName = btn.getAttribute('data-subject-name');
|
||||
openReviewModal(subjectName);
|
||||
const tip = btn.getAttribute('data-tip');
|
||||
const targetType = tip === 'B' ? 'empty' : tip === 'Y' ? 'wrong' : 'all';
|
||||
openReviewModal(subjectName, targetType);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -59,8 +59,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
const data = await res.json();
|
||||
|
||||
if (data.success && data.units && data.units.length > 0) {
|
||||
selectUnit.innerHTML = '<option value="">Seçiniz...</option>' +
|
||||
data.units.map(u => `<option value="${u.id}">${u.name}</option>`).join('');
|
||||
selectUnit.innerHTML = '<option value="">Seçiniz...</option>';
|
||||
data.units.forEach(u => {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = u.id;
|
||||
opt.textContent = u.name;
|
||||
selectUnit.appendChild(opt);
|
||||
});
|
||||
selectUnit.disabled = false;
|
||||
} else {
|
||||
selectUnit.innerHTML = '<option value="">Ünite bulunamadı</option>';
|
||||
|
|
@ -93,8 +98,13 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
const data = await res.json();
|
||||
|
||||
if (data.success && data.topics && data.topics.length > 0) {
|
||||
selectTopic.innerHTML = '<option value="">Seçiniz...</option>' +
|
||||
data.topics.map(t => `<option value="${t.id}">${t.name}</option>`).join('');
|
||||
selectTopic.innerHTML = '<option value="">Seçiniz...</option>';
|
||||
data.topics.forEach(t => {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = t.id;
|
||||
opt.textContent = t.name;
|
||||
selectTopic.appendChild(opt);
|
||||
});
|
||||
selectTopic.disabled = false;
|
||||
} else {
|
||||
selectTopic.innerHTML = '<option value="">Konu bulunamadı</option>';
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -13,6 +13,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
const btn = e.target.closest('.station-btn');
|
||||
if (!btn) return;
|
||||
|
||||
if (window.BeKulturPWA && window.BeKulturPWA.isOffline()) {
|
||||
showAlert('Çevrimdışı moddasınız. İstasyon seçimi için internet bağlantısı gereklidir.', 'danger');
|
||||
return;
|
||||
}
|
||||
|
||||
const station = btn.dataset.station;
|
||||
stationPills.querySelectorAll('.station-btn').forEach(b => b.classList.remove('active'));
|
||||
btn.classList.add('active');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue