Skip to content

Instantly share code, notes, and snippets.

@gkio
Last active October 12, 2016 21:19
Show Gist options
  • Save gkio/d0dd1a838ff4b85f6b1e8af7da10b252 to your computer and use it in GitHub Desktop.
Save gkio/d0dd1a838ff4b85f6b1e8af7da10b252 to your computer and use it in GitHub Desktop.
var out = {}
var externalObject = {}
var idofSection = $('.submenu-container .ifmenu .selected').attr('id')
idofSection = idofSection.split('-')
idofSection = idofSection[idofSection.length - 1]
externalObject = []
$('#table-type-1 tbody tr').each(function(index){
var obj = {}
var id = index + 1
obj['rank'] = $('#table-type-1 tbody tr:nth-child('+ id +') td.rank').text()
obj['team'] = $('#table-type-1 tbody tr:nth-child('+ id +') td.participant_name').text()
obj['matches_played'] = $('#table-type-1 tbody tr:nth-child('+ id +') td.matches_played').text()
obj['wins'] = $('#table-type-1 tbody tr:nth-child('+ id +') td.wins').text()
obj['draws'] = $('#table-type-1 tbody tr:nth-child('+ id +') td.draws').text()
obj['losses'] = $('#table-type-1 tbody tr:nth-child('+ id +') td.losses').text()
obj['goals'] = $('#table-type-1 tbody tr:nth-child('+ id +') td.goals').first().text()
obj['points'] = $('#table-type-1 tbody tr:nth-child('+ id +') td.goals').last().text()
externalObject.push(obj);
})
out[idofSection] = externalObject;
return out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment