AtCoder Crouch Start

Add a link to problem A on upcoming AtCoder contest pages

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name            AtCoder Crouch Start
// @name:ja         AtCoder Crouch Start
// @namespace       https://github.com/xe-o
// @version         0.2
// @description     Add a link to problem A on upcoming AtCoder contest pages
// @description:ja  AtCoderの開始前のコンテストページにA問題へのリンクを追加します
// @author          XERO
// @license         MIT
// @match           https://atcoder.jp/contests/*
// @exclude         https://atcoder.jp/contests/
// @grant           none
// ==/UserScript==

(function () {
  "use strict";

  const fixtime = document.querySelector(".fixtime-full");
  const navTabs = document.querySelector(".nav.nav-tabs");
  const pullRightListItem = document.querySelector("li.pull-right");

  if (fixtime && Date.parse(fixtime.innerText) > Date.now()) {
    const contestID = window.location.pathname.split("/")[2];
    const tab = document.createElement("li");
    tab.innerHTML = `<a href="/contests/${contestID}/tasks/${contestID}_a"><span class="glyphicon glyphicon-paperclip" style="margin-right:4px;" aria-hidden="true"></span>A問題</a>`;
    navTabs.insertBefore(tab, pullRightListItem);
  }
})();