Send to VJudge

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

目前為 2023-08-10 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Send to VJudge
// @namespace    -
// @version      4
// @description  Get code submitted to other task sites and send it to VJudge
// @author       Plantt
// @match        https://open.kattis.com/problems/*
// @match        https://open.kattis.com/contests/*/problems/*
// @match        https://cses.fi/problemset/*/*
// @match        https://oj.uz/problem/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=vjudge.net
// @grant        none
// @license      Unlicense
// ==/UserScript==

window.addEventListener("load", function() {
	var btn;
    if (document.URL.includes("https://open.kattis.com")) {
        btn = document.createElement("a");
        btn.innerText = "Send to VJudge";
        btn.className = "tab-nav-item tab-nav-js";
        btn.onclick = () => {
            window.open("https://vjudge.net/problem/kattis-" + document.URL.substr(document.URL.lastIndexOf("/") + 1), "_blank");
        };
        document.querySelector("#edit-and-submit-tab > div > div.strip-item-plain > nav").appendChild(btn);
    }
    else if (document.URL.includes("https://cses.fi")) {
        btn = document.createElement("li");
        btn.innerHTML = `<a href="https://vjudge.net/problem/cses-${document.URL.substr(document.URL.lastIndexOf("/") + 1)}" target="_blank">Send to VJudge</a>`;
        document.querySelector("body > div.skeleton > div.navigation > div.title-block > ul").appendChild(btn);
    }
	else if (document.URL.includes("https://oj.uz")) {
		btn = document.createElement("li");
		btn.innerHTML = `<a href="https://vjudge.net/problem/OJUZ-${document.URL.substr(document.URL.lastIndexOf("/") + 1)}" target="_blank">Send to VJudge</a>`;
		document.querySelector("#content > div > div > div.col-lg-9 > ul").appendChild(btn);
	}
});