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

@ -1070,6 +1070,12 @@ code {
background: #ffffff;
}
.grid-lesson-item:not(:last-child) {
margin-bottom: 6px;
padding-bottom: 6px;
border-bottom: 1px dashed var(--border);
}
.grid-lesson-subject {
font-weight: 600;
font-size: 0.825rem;
@ -1660,6 +1666,23 @@ code {
margin-top: 2px;
}
/* Standalone Rating Badge Icons (Unicode Glyphs - Zero External Font Dependency) */
.bi {
display: inline-block;
font-style: normal;
line-height: 1;
margin-right: 3px;
}
.bi-stars::before { content: "✨"; }
.bi-award-fill::before { content: "🏅"; }
.bi-shield-check::before { content: "🛡️"; }
.bi-graph-up-arrow::before { content: "📈"; }
.bi-trophy-fill::before { content: "🏆"; }
.bi-flag-fill::before { content: "🚩"; }
.bi-exclamation-triangle-fill::before { content: "⚠️"; }
.bi-check-circle-fill::before { content: "✓"; }
/* Exam Detail Card */
.exam-detail-card {
background: var(--bg-card);

View file

@ -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) {

View file

@ -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);
});
});

View file

@ -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>';

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',

View file

@ -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');

View file

@ -1,7 +1,11 @@
const CACHE_NAME = 'bekultur-v1';
const CACHE_NAME = 'bekultur-v2';
const STATIC_ASSETS = [
'/',
'/dashboard',
'/syllabus',
'/private-lessons',
'/exams',
'/css/style.css',
'/js/pwa.js',
'/js/app.js',
@ -53,13 +57,19 @@ self.addEventListener('fetch', (event) => {
const url = new URL(req.url);
// Allow caching question images from panel.ozelbursakulturokullari.com
const isQuestionImage =
url.origin.includes('ozelbursakulturokullari.com') &&
(url.pathname.endsWith('.png') || url.pathname.endsWith('.jpg') || url.pathname.endsWith('.jpeg') || url.pathname.includes('/soru/'));
// Ignore cross-origin external analytics or fonts
if (url.origin !== self.location.origin) {
if (url.origin !== self.location.origin && !isQuestionImage) {
return;
}
// 1. Static Assets (CSS, JS, Icons, Images) -> Cache-First
// 1. Static Assets & Question Images -> Cache-First
const isStatic =
isQuestionImage ||
url.pathname.startsWith('/css/') ||
url.pathname.startsWith('/js/') ||
url.pathname.startsWith('/icons/') ||
@ -75,11 +85,14 @@ self.addEventListener('fetch', (event) => {
return cachedResponse;
}
return fetch(req).then((networkResponse) => {
if (networkResponse && networkResponse.status === 200) {
if (networkResponse && (networkResponse.status === 200 || networkResponse.type === 'opaque')) {
const clone = networkResponse.clone();
caches.open(CACHE_NAME).then((cache) => cache.put(req, clone));
}
return networkResponse;
}).catch(() => {
// If question image fails offline and not cached, return empty placeholder
return new Response('', { status: 404, statusText: 'Not found offline' });
});
})
);
@ -98,13 +111,35 @@ self.addEventListener('fetch', (event) => {
})
.catch(async () => {
// Network failed (Offline) -> Look in CacheStorage
const cached = await caches.match(req);
// 1. Try exact match
let cached = await caches.match(req);
// 2. Try match ignoring query parameters
if (!cached) {
cached = await caches.match(req, { ignoreSearch: true });
}
// 3. Try match by pathname
if (!cached) {
cached = await caches.match(url.pathname);
}
if (cached) {
return cached;
}
// If it was a navigation request, try fallback to cached dashboard or root
// If it was a navigation request, try route-specific fallbacks
if (req.mode === 'navigate') {
if (url.pathname.startsWith('/exams')) {
const fallback = await caches.match('/exams');
if (fallback) return fallback;
}
if (url.pathname.startsWith('/syllabus')) {
const fallback = await caches.match('/syllabus');
if (fallback) return fallback;
}
if (url.pathname.startsWith('/private-lessons')) {
const fallback = await caches.match('/private-lessons');
if (fallback) return fallback;
}
const fallbackDashboard = await caches.match('/dashboard');
if (fallbackDashboard) return fallbackDashboard;