您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds some convenience links to stats in problems in Kattis
// ==UserScript== // @name Kattis Stats Links // @description Adds some convenience links to stats in problems in Kattis // @version 1 // @include https://open.kattis.com/* // @namespace https://greasyfork.org/users/8233 // @grant none // @license MIT // ==/UserScript== // create stat link from given URL function makeStatLinkNode(url) { var ret = document.createElement('a'); ret.href = url + '/statistics'; ret.innerText = ' (stats)'; return ret; } // add stat link behind any <a> element that has href going to URL that has a "problems/(somename)" part var links = document.querySelectorAll('a'); for (const a of links) { if (a.getAttribute('href') !== null && a.getAttribute('href').match(/problems\/[0-9a-z]*/i) !== null) { var newa = makeStatLinkNode(a.getAttribute('href')); a.parentElement.appendChild(newa); } } // add stat link behind a problm name in problem page itself var urlparts = window.location.toString().split('/'); if (urlparts[urlparts.length - 2] == 'problems') { var heading = document.querySelector('.book-page-heading'); var newa = makeStatLinkNode(window.location); heading.appendChild(newa); }