AtCoderRecentGraph

レーティンググラフを最近のだけにするボタンを追加

  1. // ==UserScript==
  2. // @name AtCoderRecentGraph
  3. // @namespace https://twitter.com/merom686
  4. // @version 1.0
  5. // @description レーティンググラフを最近のだけにするボタンを追加
  6. // @author merom686
  7. // @match https://atcoder.jp/users/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function(){
  12. if (typeof rating_history === 'undefined' || rating_history.length < 2) return;
  13. let rating_history_original = rating_history;
  14. let k = Math.min(64, Math.ceil(rating_history.length / 2));
  15.  
  16. let button = document.createElement('button');
  17. button.className = 'btn btn-default';
  18. button.innerText = 'recent';
  19. button.onclick = () => {
  20. if (rating_history.length == k) {
  21. rating_history = rating_history_original;
  22. } else {
  23. rating_history = rating_history.slice(-k);
  24. }
  25. const e = new CustomEvent('load');
  26. window.dispatchEvent(e);
  27. };
  28. let a = document.getElementById('rating-graph-expand');
  29. a.parentNode.insertBefore(button, a.nextSibling);
  30. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址