AtCoder_submit_keyboard_shortcut

atcoderにおいてCtrl+Enterで提出ができるようになります

As of 2019-03-27. See the latest version.

  1. // ==UserScript==
  2. // @name AtCoder_submit_keyboard_shortcut
  3. // @version 1.1
  4. // @description atcoderにおいてCtrl+Enterで提出ができるようになります
  5. // @author Osmium_1008
  6. // @license MIT
  7. // @include https://atcoder.jp/contests/*/tasks/*
  8. // @include https://atcoder.jp/contests/*/submit
  9. // @include https://*.contest.atcoder.jp/submit*
  10. // @supportURL https://twitter.com/Osmium_1008
  11. // @namespace https://greatest.deepsurf.us/users/251827
  12. // ==/UserScript==
  13. (function() {
  14. document.addEventListener('keydown', function (event) {
  15. if ((event.ctrlKey||event.metaKey)&&event.keyCode==13){
  16. if((window.location.href).match(new RegExp('contests'))!=null){
  17. console.log("new");
  18. document.getElementById('submit').click();
  19. }
  20. else{
  21. console.log("old");
  22. (document.getElementsByClassName('btn btn-primary btn-large'))[0].click();
  23. }
  24. }
  25. }, false);
  26. })();