Skip to content

Instantly share code, notes, and snippets.

@msikma
Last active July 26, 2020 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save msikma/018533e89796d42c6580150d15898a6d to your computer and use it in GitHub Desktop.
Save msikma/018533e89796d42c6580150d15898a6d to your computer and use it in GitHub Desktop.
// Run on e.g. http://sumodb.sumogames.de/Rikishi.aspx?r=1226
(() => {
document.head.insertAdjacentHTML(
'beforeend',
`<style>
tr.kachikoshi td { background: rgba(0,255,0,0.1) }
</style>`
);
document.querySelectorAll('.rikishi tr').forEach(tr => {
const tds = tr.querySelectorAll('td')
if (tds.length === 0) return
const wl = tr.querySelector('.wl').innerText.match(/([0-9]{1,2})-([0-9]{1,2})-?([0-9]{1,2})? ?(.*)?$/)
const [_, win, loss, kyu] = wl.map(i => Number(i) || 0)
if (win + loss + kyu < 15) return
const hasKK = win > (loss + kyu)
tr.classList.add(hasKK ? 'kachikoshi' : 'makekoshi')
})
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment