Greasy Fork is available in English.
Adds some enhancements to USACO problems.
当前为
// ==UserScript==
// @name USACO Enhancements
// @namespace https://connorcode.com
// @version 0.1
// @description Adds some enhancements to USACO problems.
// @author Connor Slade
// @match http://www.usaco.org/index.php?page=viewproblem*
// @grant none
// @license GPLv3
// ==/UserScript==
(() => {
// == Problem year and date in page title ==
let problemDate = document.querySelector('.panel h2').innerText;
let problemName = document.querySelector('.panel h2:nth-child(2)').innerText.split('. ')[1];
let date = problemDate.match(/USACO (\d{4}) (.*) Contest/);
document.title = `USACO - ${problemName} (${date[2].substring(0, 3)} ${date[1]})`;
// == Persistent language selector ==
let selector = document.querySelector("select[name='language']");
let lastLang = localStorage.getItem('lastLang');
if (lastLang != null) selector.value = lastLang;
selector.addEventListener('change', () => {
console.log(selector.value);
localStorage.setItem("lastLang", selector.value);
});
})();