Propagation conditions page #92

This commit is contained in:
Ian Renton
2026-03-29 08:13:43 +01:00
parent ee47d736eb
commit 11d71629ce
12 changed files with 133 additions and 37 deletions

View File

@@ -1,11 +1,41 @@
// Load solar conditions
function loadSolarConditions() {
$.getJSON('/api/v1/solar', function(jsonData) {
const hfConditionClass = { 'Good': 'table-success', 'Fair': 'table-warning', 'Poor': 'table-danger' };
if (jsonData.hf_conditions) {
jsonData.hf_conditions.forEach(function(entry) {
const cell = $('#hf-conditions-' + entry.band + '-' + entry.time);
cell.text(entry.condition);
const cls = hfConditionClass[entry.condition];
if (cls) { cell.addClass(cls); }
});
}
const vhfIdMap = {
'vhf-aurora|northern_hemi': 'vhf-conditions-aurora',
'E-Skip|europe_6m': 'vhf-conditions-es-6m-eu',
'E-Skip|europe_4m': 'vhf-conditions-es-4m-eu',
'E-Skip|europe': 'vhf-conditions-es-2m-eu',
'E-Skip|north_america':'vhf-conditions-es-2m-na',
};
if (jsonData.vhf_conditions) {
jsonData.vhf_conditions.forEach(function(entry) {
const id = vhfIdMap[entry.phenomenon + '|' + entry.location];
if (id) {
const cell = $('#' + id);
cell.text(entry.condition);
cell.addClass(entry.condition === 'Band Closed' ? 'table-danger' : 'table-success');
}
});
}
if (jsonData.aurora_latitude !== null && jsonData.aurora_latitude !== undefined) {
$('#vhf-conditions-aurora-lat').text(jsonData.aurora_latitude + '°');
}
});
}
// Startup
$(document).ready(function() {
loadSolarConditions();
});
});