AtCoderの提出結果の一覧のページにソースコードを表示します。
Ekde
// ==UserScript==
// @name atcoder-submission-wo-ikki-ni-miiru
// @namespace http://tampermonkey.net/
// @version 0.1
// @description AtCoderの提出結果の一覧のページにソースコードを表示します。
// @author pekempey
// @match https://atcoder.jp/contests/*
// @grant none
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
// ==/UserScript==
(function() {
var prettify = $('<script>').attr({
'src': "https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"
});
$('body').append(prettify);
var container = $('#main-container').append($('<div>').addClass('atcoder-submissions-container'));
$('tbody tr').each(function() {
var username = null;
var submission = null;
var problemName = null;
$(this).find('a').each(function() {
var href = $(this).attr('href');
if (/users\//.test(href)) {
username = $(this).text();
}
if (/submissions\/\d{8}/.test(href)) {
submission = href;
}
if (/tasks/.test(href)) {
problemName = $(this).text();
}
});
if (submission != null && username != null && problemName != null) {
$.get(submission, function(data) {
var html = $(data);
var src = html.find('#submission-code');
container.append($('<p>').html("<b>" + username + "</b> " + problemName));
container.append(src);
// src.css('max-height', 'none');
});
}
})
})();