Skip to content

Instantly share code, notes, and snippets.

@showa-yojyo
Created February 11, 2024 13:23
Show Gist options
  • Save showa-yojyo/772b4ae422740faea64f4c09a525d908 to your computer and use it in GitHub Desktop.
Save showa-yojyo/772b4ae422740faea64f4c09a525d908 to your computer and use it in GitHub Desktop.
麻雀ファイトガールの戦績履歴のテーブルを Markdown コード片に変換する JavaScript 関数のコード
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'));
}
@showa-yojyo
Copy link
Author

  1. 麻雀ファイトガールの Web サイトにログインして戦績ページに移動しろ
  2. Chrome などの開発者ツール Console を開け
  3. この関数定義を実行しろ
  4. 関数 mfgscore を実行しろ
  5. 出力文字列を選択してクリップボードにコピーしろ
  6. 日記にクリップボードの中身を貼り付けろ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment