feat: Add "Decode all" checkbox for full METAR decoding

Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
2026-02-14 15:02:35 -07:00
parent e93187742d
commit cc2452c641
+9
View File
@@ -42,6 +42,7 @@
<div id="metar-display"></div>
<button id="new-metar-btn">New METAR</button>
<button id="test-all-btn">Test All METARs</button>
<label style="margin-left: 1em;"><input type="checkbox" id="decode-all-checkbox"> Decode all</label>
<div id="decoding-display"></div>
<button id="next-btn" style="margin-top: 1em;">Next</button>
</div>
@@ -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,10 +231,16 @@
});
newMetarBtn.addEventListener('click', displayNewMetar);
decodeAllCheckbox.addEventListener('change', updateDisplay);
function updateDisplay() {
if (currentMetarSections.length === 0) return;
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) => {
@@ -250,6 +258,7 @@
// Show/hide next button
nextBtn.style.display = (currentSectionIndex < currentMetarSections.length - 1) ? 'inline-block' : 'none';
}
}
nextBtn.addEventListener('click', () => {
if (currentSectionIndex < currentMetarSections.length - 1) {