zjebal
Deploy to FTP / deploy (push) Successful in 4s

This commit is contained in:
Sebastian Molenda
2026-05-26 22:22:53 +02:00
parent 3bcf995c10
commit ea84777b97
2 changed files with 21 additions and 4 deletions
+16 -2
View File
@@ -35,7 +35,7 @@
const summaryScore = document.getElementById('summary-score')
const summaryBackBtn = document.getElementById('summary-back-btn')
const dykScroll = document.getElementById('dyk-scroll')
const progressBar = document.getElementById('dyk-progress-bar-inner')
let progressBar = null
// ── Load texts ────────────────────────────────────────────────────────────
fetch('json/dyktanda.json')
@@ -53,6 +53,20 @@
textList.innerHTML = '<p style="color:var(--muted)">Nie udało się wczytać tekstów.</p>'
})
// Poczekaj na dynamiczne załadowanie progress bara
document.addEventListener('DOMContentLoaded', () => {
// progress bar jest ładowany przez loadComponent w dyktando.html
const checkProgressBar = () => {
const el = document.getElementById('dyk-progress-bar-inner')
if (el) {
progressBar = el
} else {
setTimeout(checkProgressBar, 50)
}
}
checkProgressBar()
})
customStartBtn.addEventListener('click', () => {
const txt = customInput.value.trim()
if (!txt) return
@@ -98,7 +112,7 @@
textDisplay.classList.remove('hidden')
choicesEl.classList.remove('hidden')
progressEl.textContent = ''
progressBar.style.width = '0%'
if (progressBar) progressBar.style.width = '0%'
listWrap.classList.add('hidden')
playWrap.classList.remove('hidden')
+5 -2
View File
@@ -8,7 +8,7 @@
const problemEl = document.getElementById('problem')
const answerEl = document.getElementById('answer')
const feedbackEl = document.getElementById('feedback')
const progressInner = document.getElementById('progress-inner')
let progressInner = null
const progressLabel = document.getElementById('progress-label')
const summaryText = document.getElementById('summary-text')
const totalInput = document.getElementById('total-input')
@@ -99,7 +99,10 @@
function updateBar() {
const pct = st.total > 0 ? Math.round((st.solved / st.total) * 100) : 0
progressInner.style.width = pct + '%'
if (!progressInner) {
progressInner = document.getElementById('progress-inner')
}
if (progressInner) progressInner.style.width = pct + '%'
progressLabel.textContent = `${st.solved}/${st.total}`
}