Send to VJudge

Get code submitted to other task sites and send it to VJudge

当前为 2023-08-08 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Send to VJudge
  3. // @namespace -
  4. // @version 3
  5. // @description Get code submitted to other task sites and send it to VJudge
  6. // @author Plantt
  7. // @match https://open.kattis.com/problems/*
  8. // @match https://open.kattis.com/contests/*/problems/*
  9. // @match https://cses.fi/problemset/*/*
  10. // @icon https://www.google.com/s2/favicons?sz=64&domain=vjudge.net
  11. // @grant none
  12. // @license Unlicense
  13. // ==/UserScript==
  14.  
  15. window.addEventListener("load", function() {
  16. if (/https:\/\/open\.kattis\.com\/(contests\/(\w)+?\/)?problems\/.+/.test(document.URL)) {
  17. var kattis_btn = document.createElement("a");
  18. kattis_btn.innerText = "Send to VJudge";
  19. kattis_btn.className = "tab-nav-item tab-nav-js";
  20. kattis_btn.onclick = () => {
  21. window.open("https://vjudge.net/problem/kattis-" + document.URL.substr(document.URL.lastIndexOf("/") + 1), "_blank");
  22. };
  23. document.querySelector("#edit-and-submit-tab > div > div.strip-item-plain > nav").appendChild(kattis_btn);
  24. }
  25. else if (/https:\/\/cses\.fi\/problemset\/.+\/.+/.test(document.URL)) {
  26. var cses_btn = document.createElement("li");
  27. cses_btn.innerHTML = `<a href="https://vjudge.net/problem/cses-${document.URL.substr(document.URL.lastIndexOf("/") + 1)}" target="_blank">Send to VJudge</a>`;
  28. document.querySelector("body > div.skeleton > div.navigation > div.title-block > ul").appendChild(cses_btn);
  29. }
  30. });