Send to VJudge

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

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

  1. // ==UserScript==
  2. // @name Send to VJudge
  3. // @namespace -
  4. // @version 4
  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. // @match https://oj.uz/problem/*
  11. // @icon https://www.google.com/s2/favicons?sz=64&domain=vjudge.net
  12. // @grant none
  13. // @license Unlicense
  14. // ==/UserScript==
  15.  
  16. window.addEventListener("load", function() {
  17. var btn;
  18. if (document.URL.includes("https://open.kattis.com")) {
  19. btn = document.createElement("a");
  20. btn.innerText = "Send to VJudge";
  21. btn.className = "tab-nav-item tab-nav-js";
  22. btn.onclick = () => {
  23. window.open("https://vjudge.net/problem/kattis-" + document.URL.substr(document.URL.lastIndexOf("/") + 1), "_blank");
  24. };
  25. document.querySelector("#edit-and-submit-tab > div > div.strip-item-plain > nav").appendChild(btn);
  26. }
  27. else if (document.URL.includes("https://cses.fi")) {
  28. btn = document.createElement("li");
  29. btn.innerHTML = `<a href="https://vjudge.net/problem/cses-${document.URL.substr(document.URL.lastIndexOf("/") + 1)}" target="_blank">Send to VJudge</a>`;
  30. document.querySelector("body > div.skeleton > div.navigation > div.title-block > ul").appendChild(btn);
  31. }
  32. else if (document.URL.includes("https://oj.uz")) {
  33. btn = document.createElement("li");
  34. btn.innerHTML = `<a href="https://vjudge.net/problem/OJUZ-${document.URL.substr(document.URL.lastIndexOf("/") + 1)}" target="_blank">Send to VJudge</a>`;
  35. document.querySelector("#content > div > div > div.col-lg-9 > ul").appendChild(btn);
  36. }
  37. });