smithics · Scotland cricket

loading data…
data sourced from PlayHQ
fetching match data…

Match Scorecard

// --- SCORECARD MODAL --- document.getElementById('scorecard-close')?.addEventListener('click', () => { document.getElementById('scorecard-modal').style.display = 'none'; }); window.addEventListener('click', (e) => { if (e.target === document.getElementById('scorecard-modal')) { document.getElementById('scorecard-modal').style.display = 'none'; } }); function showScorecard(gameId) { const fx = STATE.fixturesById[gameId]; if(!fx) return; document.getElementById('sc-title').textContent = `${fx.h_n || fx.h} vs ${fx.a_n || fx.a} (${fx.dt})`; const bat = STATE.data.batting.filter(x => x.g === gameId).sort((a,b)=>(a.o||99)-(b.o||99)); const bowl = STATE.data.bowling.filter(x => x.g === gameId); const fow = STATE.data.fow ? STATE.data.fow.filter(x => x.g === gameId) : []; let body = ''; for (const team of [fx.h, fx.a]) { const tbat = bat.filter(x => x.t === team); const tbowl = bowl.filter(x => x.t !== team); // opposing team bowls const tfow = fow.filter(x => x.t === team); if (tbat.length === 0 && tbowl.length === 0) continue; const tname = team === fx.h ? (fx.h_n || fx.h) : (fx.a_n || fx.a); const agg = team === fx.h ? fx.h_agg : fx.a_agg; const aggStr = agg ? `${agg.r}/${agg.w} (${agg.o} ov)` : ''; body += `
${escapeHtml(tname)} Batting${aggStr}
`; if (tbat.length > 0) { body += ``; const didNotBat = []; for (const b of tbat) { if (b.s === 'DNB') { didNotBat.push(b.n); continue; } const sr = b.b ? ((b.r/b.b)*100).toFixed(1) : '-'; body += ``; } body += `
BatterStatusRB4s6sSR
${escapeHtml(b.n)}${escapeHtml(b.s||'')}${b.r}${b.b||0}${b['4']||0}${b['6']||0}${sr}
`; if(didNotBat.length) body += `
DNB: ${escapeHtml(didNotBat.join(', '))}
`; } if (tfow.length > 0) { body += `
FOW: ${escapeHtml(tfow.map(x=>`${x.r}-${x.w}`).join(', '))}
`; } if (tbowl.length > 0) { body += `
Bowling
`; body += ``; for (const b of tbowl) { const econ = b.o ? (b.r / b.o).toFixed(2) : '-'; body += ``; } body += `
BowlerOMRWEconWdNb
${escapeHtml(b.n)}${b.o}${b.m||0}${b.r}${b.w}${econ}${b.wd||0}${b.nb||0}
`; } body += `
`; } if(!body) body = '
No detailed scorecard available.
'; document.getElementById('scorecard-body').innerHTML = body; document.getElementById('scorecard-modal').style.display = 'flex'; } function scLink(gameId, text) { return `${escapeHtml(text)}`; }