AtCoder CustomTest Run Shortcut

You can run by using Ctrl + Enter in Custom Test of AtCoder

As of 2022-11-05. See the latest version.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

  1. // ==UserScript==
  2. // @name AtCoder CustomTest Run Shortcut
  3. // @name:ja AtCoderカスタムテスト実行ショートカット
  4. // @namespace https://greatest.deepsurf.us/ja/users/570127
  5. // @version 0.2.2
  6. // @description You can run by using Ctrl + Enter in Custom Test of AtCoder
  7. // @description:ja AtCoderのコードテストにおいてCtrl+Enterで実行ができるようになります。
  8. // @author universato
  9. // @grant none
  10. // @match https://atcoder.jp/contests/*/custom_test
  11. // @match https://atcoder.jp/contests/*/custom_test*
  12. // @license MIT
  13. // @supportURL https://twitter.com/universato
  14. // ==/UserScript==
  15.  
  16. const element = document.querySelector('a.btn.btn-primary');
  17. if(element.innerText.match(/^(Run|実行)$/)){ element.innerText += ' (Ctrl + Enter)'; }
  18.  
  19. (function() {
  20. document.addEventListener('keydown', function (event) {
  21. if ((event.ctrlKey || event.metaKey) && event.key === 'Enter'){
  22. const buttons = document.querySelectorAll('a.btn.btn-primary');
  23. for(let button of buttons){
  24. if(button.innerText.match(/^(Run|実行)/)){
  25. button.click();
  26. }
  27. }
  28. }
  29. });
  30. })();