Skip to content

Instantly share code, notes, and snippets.

@shimafuri
Created June 13, 2020 15:32
Show Gist options
  • Save shimafuri/edcad3f844712487bf366eac9c15a33f to your computer and use it in GitHub Desktop.
Save shimafuri/edcad3f844712487bf366eac9c15a33f to your computer and use it in GitHub Desktop.
toho-vote-diff.js
/**
* 順位差分表示
*/
// https://toho-vote.info/result16/result_list_character.php
// https://toho-vote.info/result16/result_list_music.php
// https://toho-vote.info/result16/result_list_title.php
// にて
// Ctrl+Shift+I で開発者ツールを開き Console タブで以下のスクリプトを実行
$('tbody > tr').each((i, el) => {
const $current = $(el).find('td:nth-child(1)');
const $prev = $(el).find('td:nth-child(2)');
$current.css('white-space', 'nowrap');
const currentRank = parseInt($current.text());
const prevRank = parseInt($prev.text());
const up = currentRank < prevRank;
const keep = currentRank == prevRank;
const down = currentRank > prevRank;
const diff = Math.abs(prevRank - currentRank);
if (up) {
$current.text($current.text() + ` (${diff}↑)`);
$current.css('color', 'red');
}
if (keep) {
$current.text($current.text());
}
if (down) {
$current.text($current.text() + ` (${diff}↓)`);
$current.css('color', 'blue');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment