Skip to content

Instantly share code, notes, and snippets.

@ville6000
Created May 24, 2018 12:19
Show Gist options
  • Save ville6000/58ae3db1a3077c7e6cdbb0e08101356a to your computer and use it in GitHub Desktop.
Save ville6000/58ae3db1a3077c7e6cdbb0e08101356a to your computer and use it in GitHub Desktop.
MMArmy record by organization
var record = {};
jQuery('.record').find('tr').each(function(idx, el) {
var row = jQuery(el);
var key = (row.find('td:first-child').hasClass('win') || row.find('td:first-child').hasClass('winTitle')) ? 'wins' : 'losses';
var organization = row.find('td').eq(7).text();
if (idx > 0) {
if (typeof record[organization] === 'undefined') {
record[organization] = {
wins: 0,
losses: 0
};
}
record[organization][key]++
}
});
console.log(record);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment