AtCoder TLE Police

TLE提出は逮捕('TLE' を 'AR'(ArRested)に置き換えます)

  1. // ==UserScript==
  2. // @name AtCoder TLE Police
  3. // @namespace https://fuwa.dev
  4. // @version 0.2
  5. // @description TLE提出は逮捕('TLE' を 'AR'(ArRested)に置き換えます)
  6. // @author ibuki2003
  7. // @match https://atcoder.jp/contests/*/submissions*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. function replaceTLE2AR(){
  12. const tips=document.getElementsByClassName('label');
  13. for(let e of tips){
  14. if(e.innerText.match(/TLE/)){
  15. e.innerText = e.innerText.replace(/TLE/g, 'AR');
  16. e.setAttribute('data-original-title','逮捕');
  17. e.classList.remove('label-warning');
  18. e.classList.add('label-danger');
  19. }
  20. }
  21. }
  22. (function() {
  23. 'use strict';
  24.  
  25. const target = document.getElementsByTagName('tbody')[0];
  26. const observer = new MutationObserver(function (mutations) {
  27. for(let i in mutations){
  28. replaceTLE2AR();
  29. }
  30. });
  31.  
  32. replaceTLE2AR();
  33.  
  34. observer.observe(target, {
  35. //attributes: true,
  36. characterData: true,
  37. childList: true,
  38. subtree: true
  39. });
  40. })();