atcoder_all_open

当前为 2019-07-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name atcoder_all_open
  3. // @namespace jp.misw
  4. // @author hotman
  5. // @description:ja 問題Tabの隣に全ての問題を(ワンクリックで)開く全ての問題Tabを作成します。
  6. // @version 1.0.0
  7. // @include https://atcoder.jp/contests/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11.  
  12. function toURL(){
  13. var cnt=document.getElementsByClassName("table table-bordered table-striped")[0].children[1].childElementCount;
  14. var test_name=location.href.split('/')[4];
  15. for(var i=0;i<cnt;i++){
  16. window.open('https://atcoder.jp/contests/'+test_name+'/tasks/'+test_name+'_'+String.fromCharCode('a'.charCodeAt(0)+i));
  17. }
  18. }
  19.  
  20.  
  21. function all_open(){
  22. var parent=document.getElementsByClassName("nav nav-tabs")[0];
  23. var add=document.createElement("li");
  24. parent.insertBefore(add,parent.children[2]);
  25. var a=document.createElement("a");
  26. add.appendChild(a);
  27. a.textContent="全ての問題";
  28. a.setAttribute("href","javascript:void(0);");
  29. a.addEventListener('click',toURL, false);
  30. }
  31. all_open();