handler = e['player'];
}
} else if (type === 'throwaway') {
+ ++p.num_throws;
++p.throwaways;
handler = prev_handler = null;
} else if (type === 'drop') {
let rows = [];
if (chosen_category === 'general') {
rows = make_table_general(players);
+ } else if (chosen_category === 'offense') {
+ rows = make_table_offense(players);
} else if (chosen_category === 'pulls') {
rows = make_table_pulls(players);
}
function get_chosen_category() {
if (window.location.hash === '#pulls') {
return 'pulls';
+ } else if (window.location.hash === '#offense') {
+ return 'offense';
} else {
return 'general';
}
a.setAttribute('href', '#general');
elems.push(a);
}
+
elems.push(document.createTextNode(' | '));
if (chosen_category === 'pulls') {
elems.push(document.createTextNode('Pulls'));
a.setAttribute('href', '#pulls');
elems.push(a);
}
+
+ elems.push(document.createTextNode(' | '));
+ if (chosen_category === 'offense') {
+ elems.push(document.createTextNode('Offense'));
+ } else {
+ let a = document.createElement('a');
+ a.appendChild(document.createTextNode('Offense'));
+ a.setAttribute('href', '#offense');
+ elems.push(a);
+ }
+
document.getElementById('mainmenu').replaceChildren(...elems);
}
return rows;
}
+function make_table_offense(players) {
+ let rows = [];
+ {
+ let header = document.createElement('tr');
+ add_cell(header, 'th', 'Player');
+ add_cell(header, 'th', 'Goals');
+ add_cell(header, 'th', 'Assists');
+ add_cell(header, 'th', 'Hockey assists');
+ add_cell(header, 'th', 'Throws');
+ add_cell(header, 'th', 'Throwaways');
+ add_cell(header, 'th', '%OK');
+ add_cell(header, 'th', 'Catches');
+ add_cell(header, 'th', 'Drops');
+ add_cell(header, 'th', '%OK');
+ add_cell(header, 'th', 'Soft +/-');
+ rows.push(header);
+ }
+
+ for (const [q,p] of Object.entries(players)) {
+ let throw_ok = 100 * (1 - p.throwaways / p.num_throws);
+ let catch_ok = 100 * (p.catches / (p.catches + p.drops));
+
+ let row = document.createElement('tr');
+ add_cell(row, 'td', p.name); // TODO: number?
+ add_cell(row, 'td', p.goals);
+ add_cell(row, 'td', p.assists);
+ add_cell(row, 'td', p.hockey_assists);
+ add_cell(row, 'td', p.num_throws);
+ add_cell(row, 'td', p.throwaways);
+ add_cell(row, 'td', throw_ok.toFixed(0) + '%');
+ add_cell(row, 'td', p.catches);
+ add_cell(row, 'td', p.drops);
+ add_cell(row, 'td', catch_ok.toFixed(0) + '%');
+ add_cell(row, 'td', '+' + p.offensive_soft_plus);
+ add_cell(row, 'td', '-' + p.offensive_soft_minus);
+ rows.push(row);
+ }
+ return rows;
+}
+
function make_table_pulls(players) {
let rows = [];
{