diff --git a/metar.html b/metar.html index 638c447..26d0cb3 100644 --- a/metar.html +++ b/metar.html @@ -42,6 +42,7 @@
+
@@ -51,6 +52,7 @@ const newMetarBtn = document.getElementById('new-metar-btn'); const testAllBtn = document.getElementById('test-all-btn'); const nextBtn = document.getElementById('next-btn'); + const decodeAllCheckbox = document.getElementById('decode-all-checkbox'); const metars = []; let currentMetarSections = []; @@ -229,26 +231,33 @@ }); newMetarBtn.addEventListener('click', displayNewMetar); + decodeAllCheckbox.addEventListener('change', updateDisplay); function updateDisplay() { if (currentMetarSections.length === 0) return; - // Build highlighted string - const parts = []; - currentMetarSections.forEach((section, index) => { - if (index === currentSectionIndex) { - parts.push(`${section.raw}`); - } else { - parts.push(section.raw); - } - }); - metarDisplay.innerHTML = parts.join(' '); + if (decodeAllCheckbox.checked) { + metarDisplay.innerHTML = currentMetarSections.map(s => s.raw).join(' '); + decodingDisplay.textContent = currentMetarSections.map(s => s.decoded).join('\n\n'); + nextBtn.style.display = 'none'; + } else { + // Build highlighted string + const parts = []; + currentMetarSections.forEach((section, index) => { + if (index === currentSectionIndex) { + parts.push(`${section.raw}`); + } else { + parts.push(section.raw); + } + }); + metarDisplay.innerHTML = parts.join(' '); - // Show decoding - decodingDisplay.textContent = currentMetarSections[currentSectionIndex].decoded; + // Show decoding + decodingDisplay.textContent = currentMetarSections[currentSectionIndex].decoded; - // Show/hide next button - nextBtn.style.display = (currentSectionIndex < currentMetarSections.length - 1) ? 'inline-block' : 'none'; + // Show/hide next button + nextBtn.style.display = (currentSectionIndex < currentMetarSections.length - 1) ? 'inline-block' : 'none'; + } } nextBtn.addEventListener('click', () => {