Created
October 15, 2014 05:57
-
-
Save jbavari/99225269fb740f163a96 to your computer and use it in GitHub Desktop.
NFL Felony Scoreboard - http://www.usatoday.com/sports/nfl/arrests/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Copy and paste this in the developer console on http://www.usatoday.com/sports/nfl/arrests/ | |
var teams = {}; | |
//Index is index in array for each, item is the html element | |
var getTeamCounts = function getTeamCounts(index, item) { | |
console.log('index: ', index, ' item: ', item); | |
var teamAtr = $(item).html(); | |
console.log('teamAtr: ', teamAtr); | |
var teamCount = teams[teamAtr]; | |
console.log('team count: ', teamCount); | |
if(typeof teamCount == 'undefined') { | |
teams[teamAtr] = 0; | |
console.log('initing team count ' , teamAtr); | |
} else { | |
teamCount = teamCount + 1; | |
console.log('added 1 to team count for ', teamAtr); | |
teams[teamAtr] = teamCount; | |
} | |
} | |
$('tbody tr:gt(43)').remove() | |
$('tbody tr td:nth-child(2)').each(getTeamCounts); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment