AddLinkToNewAtcoder

ja

Verze ze dne 23. 10. 2017. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         AddLinkToNewAtcoder
// @namespace    AddLinkToNewAtcoder
// @version      1.2
// @author       Luzhiled
// @description  ja
// @include      http://*.contest.atcoder.jp/*
// @include      https://*.contest.atcoder.jp/*
// @grant        none
// ==/UserScript==

(function() {
  'use strict';

  function ConvertToNewAtcodersURL(url, pathName, query) {
    if (pathName.match(/settings/) || pathName.match(/users/)) {
      return 'https://beta.atcoder.jp' + pathName;
    }
    let contestName = url.replace(/^https?:\/\//, '').split('.')[0];
    pathName = pathName.replace(/assignments/g, "tasks");
    pathName = pathName.replace(/\/all/g, "");
    query = query.replace(/user_screen_name/g, "f.User");
    pathName = pathName.replace(/editorial/g, "");
    pathName = pathName.replace(/statistics/g, "");
    return 'https://beta.atcoder.jp/contests/' + contestName + pathName + query;
  }

  let linkToBeta = ConvertToNewAtcodersURL(location.href, location.pathname, location.search);

  $('ul.nav.nav-tabs').append(`
    <li>
      <a href="${linkToBeta}">
        <i class="icon-user"></i>
        <span class="lang lang-selected">
          <span class="lang-en lang-child hidden-lang">to Beta version</span>
          <span class="lang-ja lang-child">Beta版へ</span>
        <span>
      </a>
    </li>
  `);
})();