feat: Fetch and parse METARs from metars.txt into memory
Co-authored-by: aider (gemini/gemini-2.5-pro) <aider@aider.chat>
This commit is contained in:
+16
-3
@@ -14,10 +14,23 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
|
const metars = [];
|
||||||
|
|
||||||
|
fetch('metars.txt')
|
||||||
|
.then(response => response.text())
|
||||||
|
.then(data => {
|
||||||
|
const lines = data.split('\n');
|
||||||
|
lines.forEach(line => {
|
||||||
|
if (line.includes('METAR')) {
|
||||||
|
const metarString = line.substring(line.indexOf('METAR') + 6).replace('=', '').trim();
|
||||||
|
if (metarString) {
|
||||||
|
metars.push(metarString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(`Loaded ${metars.length} METARs.`);
|
||||||
|
})
|
||||||
|
.catch(error => console.error('Error fetching or parsing metars.txt:', error));
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user