AtCoderLabelChanger

提出結果をまとめるスクリプト.ついでに色も変えます.

As of 23.03.2020. See ბოლო ვერსია.

  1. // ==UserScript==
  2. // @name AtCoderLabelChanger
  3. // @version 1.1
  4. // @description 提出結果をまとめるスクリプト.ついでに色も変えます.
  5. // @author y-oksaku
  6. // @namespace https://github.com/y-oksaku/AtCoderLabelChanger
  7. // @match https://atcoder.jp/contests/*/submissions/*
  8. // @grant none
  9. // @license CC0-1.0
  10. // ==/UserScript==
  11.  
  12. (function(callback) {
  13. var script = document.createElement("script");
  14. script.setAttribute("src", "//code.jquery.com/jquery-3.3.1.min.js");
  15. script.addEventListener('load', function() {
  16. var script = document.createElement("script");
  17. script.textContent = "(" + callback.toString() + ")(jQuery.noConflict(true));";
  18. document.body.appendChild(script);
  19. }, false);
  20. document.body.appendChild(script);
  21. })(function ($) {
  22. let ac = 0;
  23. let wa = 0;
  24. let tle = 0;
  25. let other = 0;
  26.  
  27. $('table > tbody > tr > td:not(#judge-status) > span.label').each(function () {
  28. const result = $(this).text();
  29. $(this).removeClass('label-success');
  30. $(this).removeClass('label-warning');
  31.  
  32. switch (result) {
  33. case 'AC':
  34. $(this).addClass('label-success');
  35. ac++;
  36. break;
  37. case 'WA':
  38. $(this).addClass('label-danger');
  39. wa++;
  40. break;
  41. case 'TLE':
  42. $(this).addClass('label-warning');
  43. tle++;
  44. break;
  45. case 'WJ':
  46. break;
  47. case 'CE':
  48. case 'RE':
  49. default:
  50. $(this).addClass('label-warning');
  51. other++;
  52. break;
  53. }
  54. });
  55.  
  56. let html = '';
  57. if(ac > 0) html += `<span class="label label-success">AC</span> ${ac}&emsp;`;
  58. if(wa > 0) html += `<span class="label label-danger">WA</span> ${wa}&emsp;`;
  59. if(tle > 0) html += `<span class="label label-warning">TLE</span> ${tle}&emsp;`;
  60. if(other > 0) html += `<span class="label label-warning">other</span> ${other}&emsp;`;
  61.  
  62. if(html != '') $('#judge-status').html(html);
  63. });