acscores-link

AtCoder に AtCoder Scores へのリンクを追加します.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         acscores-link
// @namespace    http://atcoder-scores.herokuapp.com/
// @version      0.1.3
// @description  AtCoder に AtCoder Scores へのリンクを追加します.
// @author       rsk0315
// @match        https://atcoder.jp/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    if (userScreenName === '') return;
    if (userScreenName.match(/\W/)) return;

    var match = window.location.href.match(/^https:\/\/atcoder\.jp\/users\/(\w+)$/);
    var param = 'user=' + userScreenName;
    if (match && match[1] != userScreenName)
        param += '&rivals=' + match[1];
    $($('#navbar-collapse .dropdown-menu li.divider')[0]).before(
        `<li><a href="//atcoder-scores.herokuapp.com/?${param}" target="_blank">AtCoder Scores</a></li>`
    );

    if (!match) return;
    var user = match[1];
    // 自分のページだけで表示される [アイコン設定] に注意
    $($('a.btn-text').last()).after(
        ` <span class="divider"></span> <a href="//atcoder-scores.herokuapp.com/graph?user=${user}" class="btn-text" target="_blank">精進グラフ&nbsp;<span class="glyphicon glyphicon-new-window"></span></a>`
    );
})();