Created
February 11, 2024 13:23
-
-
Save showa-yojyo/772b4ae422740faea64f4c09a525d908 to your computer and use it in GitHub Desktop.
麻雀ファイトガールの戦績履歴のテーブルを Markdown コード片に変換する JavaScript 関数のコード
This file contains hidden or 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
function mfgscore(){ | |
const buffer = []; | |
// table header | |
buffer.push('| 着順 | 点棒 | 終局時刻 |'); | |
buffer.push('|-----:|-----:|----------|'); | |
$x('//div[@id="history"]/ul/li/div').forEach(i => { | |
// remove the 位 character | |
const rank = i.children[0].innerText[0]; | |
// remove the 点 character | |
const score = i.children[1].innerText.slice(0, -1); | |
// format date | |
const time = i.children[3].innerText.replaceAll('/', '-').replace(' ', 'T'); | |
// form a row | |
buffer.push(`| ${[rank, score, time].join(' | ')} |`); | |
}); | |
console.log(buffer.join('\n')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mfgscore
を実行しろ