Send to VJudge

Get source code from other sites and send it to VJudge

Fra 07.09.2022. Se den seneste versjonen.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Send to VJudge
// @namespace    -
// @version      1
// @description  Get source code from other 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/*/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=vjudge.net
// @grant        none
// @license      Unlicense
// ==/UserScript==

window.addEventListener("load", function() {
    if (/https:\/\/open\.kattis\.com\/(contests\/(\w)+?\/)?problems\/.+/.test(document.URL)) {
        var kattis_btn = document.createElement("button");
        kattis_btn.innerText = "Send to VJudge";
        kattis_btn.style = "margin: 5px; cursor: pointer";
        kattis_btn.onclick = () => {
            window.open("https://vjudge.net/problem/kattis-" + document.URL.substr(document.URL.lastIndexOf("/") + 1), "_blank");
        };
        document.querySelector("body > main > div.top_bar > div.top_bar-content-wrapper > div.top_bar-section.top_bar-section-large").appendChild(kattis_btn);
    }
    else if (/https:\/\/cses\.fi\/problemset\/.+\/.+/.test(document.URL)) {
        var cses_btn = document.createElement("li");
        cses_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(cses_btn);
    }
});