AtCoderVirtualContestNowColorize

Colorize virtual contest being held now

  1. // ==UserScript==
  2. // @name AtCoderVirtualContestNowColorize
  3. // @namespace https://github.com/tMasaaa
  4. // @version 1.0.0
  5. // @description Colorize virtual contest being held now
  6. // @author kaito_tateyama
  7. // @license MIT
  8. // @include https://not-522.appspot.com/
  9. // ==/UserScript==
  10.  
  11.  
  12. // 現在時刻(ページを開いた時のみ)
  13. const nowtime = new Date()
  14.  
  15. // テーブル取得
  16. const table = document.querySelectorAll('.container > table > tbody > tr > td')
  17.  
  18. // 各コンテストの開始時刻をstart, 終了時刻をendに入れ、現在時刻と比較
  19. for(let i=0;i<table.length; i+=3){
  20. let start = new Date(table[i+1].innerText)
  21. let end = new Date(table[i+2].innerText)
  22. if(start <= nowtime && nowtime < end) {
  23. table[i].style.backgroundColor = 'rgb(187, 242, 94, 0.5)'
  24. table[i+1].style.backgroundColor = 'rgb(187, 242, 94, 0.5)'
  25. table[i+2].style.backgroundColor = 'rgb(187, 242, 94, 0.5)'
  26. }
  27. }