atcoder-typical90-sort

典型90の問題を難易度順でソート

  1. // ==UserScript==
  2. // @name atcoder-typical90-sort
  3. // @author uesugi
  4. // @description 典型90の問題を難易度順でソート
  5. // @version 0.0.2
  6. // @include https://atcoder.jp/contests/typical90/tasks
  7. // @grant none
  8. // @namespace https://greatest.deepsurf.us/users/703686
  9. // ==/UserScript==
  10.  
  11. const getNanido = (e) => {
  12. const s = e.querySelectorAll("td > a")[1].text;
  13. return s.substr(s.length - 2, 1);
  14. };
  15.  
  16. const typical90Sort = () => {
  17.  
  18. const table = document.querySelector("#main-container > div.row > div:nth-child(2) > div > table > tbody");
  19.  
  20. const tr = [...table.querySelectorAll("tbody > tr")].map((e) => { return { e: e, v: getNanido(e) }; }).sort((a, b) => a.v - b.v);
  21.  
  22. while (table.firstChild) {
  23. table.removeChild(table.firstChild)
  24. }
  25.  
  26. tr.forEach((e) => table.appendChild(e.e));
  27. }
  28. typical90Sort();