Skip to content

Commit

Permalink
v1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
morioprog committed Mar 10, 2024
1 parent e8dcc6e commit af1d00f
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// ==UserScript==
// @name AtCoder Submission User Colorizer
// @namespace https://github.com/morioprog
// @version 1.2
// @version 1.3
// @description 提出一覧のユーザ名を色付けします
// @author morio_prog
// @match https://atcoder.jp/contests/*/submissions*
Expand Down Expand Up @@ -110,16 +110,25 @@ $(function() {

lscache.flushExpired();
getRankingMap().then((rankingMap) => {
let index = 0;
$('a[href*="/users"]').each(function(_, u) {
// Skip "My Profile"
if ($(u).find('span').length) return true;
const userName = $(this).attr('href').slice(7);
const partUri = $(this).attr('href');
const userName = partUri.slice(7);
const lskey = "rating-" + userName;
const ranking = getRanking(rankingMap, userName);
let rating = lscache.get(lskey);
if (rating === null) {

if (rating !== null) {
colorize(u, ranking, rating);
return;
}

index += 1;
setTimeout(function() {
$.ajax({
url: "https://atcoder.jp" + $(this).attr('href') + "/history/json",
url: "https://atcoder.jp" + partUri + "/history/json",
type: 'GET',
dataType: 'json'
})
Expand All @@ -136,9 +145,7 @@ $(function() {
.then(function() {
colorize(u, ranking, rating);
});
} else {
colorize(u, ranking, rating);
}
}, index * 300);
});
});

Expand Down

0 comments on commit af1d00f

Please sign in to comment.