AtCoder Scoreboard Pinner

配点表をコンテスト情報の最上部に配置するスクリプト

  1. // ==UserScript==
  2. // @name AtCoder Scoreboard Pinner
  3. // @namespace https://atcoder.jp/
  4. // @version 0.2
  5. // @description 配点表をコンテスト情報の最上部に配置するスクリプト
  6. // @author hayatroid
  7. // @license MIT
  8. // @match https://atcoder.jp/contests/*
  9. // @exclude https://atcoder.jp/contests/
  10. // @exclude /^https:\/\/atcoder\.jp\/contests\/.+?\/.+$/
  11. // @require https://code.jquery.com/jquery-3.7.1.min.js
  12. // ==/UserScript==
  13.  
  14. var $ = window.jQuery;
  15.  
  16. (function () {
  17. // 配点表を取得
  18. var table = $("#contest-statement > .lang > .lang-ja table")
  19. .filter(function () {
  20. var th = $(this).find("thead > tr > th");
  21. return th.length === 2 && th.eq(0).text() === "問題" && th.eq(1).text() === "点数";
  22. });
  23.  
  24. if (table.length !== 1) throw new Error("Scoreboard cannot be found.");
  25. table = table.eq(0);
  26.  
  27. // 配点表を複製し、コンテスト情報の最上部に配置
  28. $("#contest-statement").prepend(table.clone());
  29. })();