async function runHealthCheck(){ const [conf] = await Promise.all([getJSON('./data/karma-config.json')]); const W = conf.weights; const gbp = document.getElementById('f_gbp').value==='yes' ? 1 : 0; const cwvSel = document.getElementById('f_cwv').value; const stars = Math.max(1, Math.min(5, parseFloat(document.getElementById('f_stars').value||"0"))); const starsNorm = (stars-1)/(5-1); // 0..1 const reviews = Math.max(0, parseInt(document.getElementById('f_reviews').value||"0",10)); const reviewsNorm = Math.min(1, reviews/25); // cap at 25 in 90 days const last = parseInt(document.getElementById('f_update').value,10); const velocity = last<=30 ? 1 : (last<=90 ? 0.6 : 0.2); const schema = document.getElementById('f_schema').value==='yes' ? 1 : 0; const profile = (gbp*0.5 + schema*0.5); const reviewsSignal = (starsNorm*0.6 + reviewsNorm*0.4); const verification = gbp; const score = (profile*W.profile + reviewsSignal*W.reviews + velocity*W.velocity + verification*W.verification); document.getElementById('hc_score').textContent = `Karma ${(score*100).toFixed(0)}`; const snapshot = { date: new Date().toISOString(), inputs: { gbp: gbp===1, cwv: cwvSel, stars, reviews, lastDays: last, schema: schema===1 }, mapped: { profile, reviewsSignal, velocity, verification }, score: score }; document.getElementById('hc_json').textContent = JSON.stringify(snapshot,null,2); } // Resources async function renderResources(){ const tbl = document.querySelector('#resources_table tbody'); if(!tbl) return; const data = await getJSON('./data/resources.json'); tbl.innerHTML = data.items.map(x=>`