J-Wass / RLEB

https://www.reddit.com/r/RocketLeagueEsports
2 stars 0 forks source link

!prizepool #105

Closed J-Wass closed 2 years ago

J-Wass commented 2 years ago

prototype code

team_rows = document.querySelectorAll("table.prizepooltable")[0].querySelectorAll("tr:not(:first-child)")

markup = '|**Place**|**Team**|**Prize**|**RLCS Points**|\n|:-|:-|:-|:-|'
team_place = null
prize = null
new_points = null
for (i = 0; i < 9 && i < team_rows.length; i++){
  team_data = team_rows[i].querySelectorAll("td")
  if (team_data[0].classList.contains("prizepooltabletoggle")){
    continue
  }
  team_name = null
  if (team_data.length == 4){
    team_place = team_data[0].innerText.replaceAll(" ", "")
    prize = team_data[1].innerText
    new_points = team_data[2].innerText
    team_name = team_data[3].innerText
  }
  else{
    team_name = team_data[0].innerText
  }
  markup += `\n|**${team_place}** | ${prize} | ${team_name} | +${new_points} **()** |`
}

console.log(markup)