AtCoder Style Optimizer for Single Display

Overrides AtCoder styles for single display

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name            AtCoder Style Optimizer for Single Display
// @name:ja         AtCoder Style Optimizer for Single Display
// @namespace       https://github.com/xe-o
// @version         0.4
// @description     Overrides AtCoder styles for single display
// @description:ja  シングルディスプレイ向けにAtCoderのスタイルを最適化します
// @author          XERO
// @license         MIT
// @match           https://atcoder.jp/*
// @run-at          document-start
// @grant           none
// ==/UserScript==

(function () {
  "use strict";

  const css = `
    @media (max-width: 1100px) {
      .container {
        width: 100%;
      }

      #main-container {
        padding: 30px 20px 10px;
      }

      #main-div.float-container {
        background: none;
      }

      .float-container > #main-container {
        box-shadow: none;
      }

      .h2 {
        font-size: 20px;
      }

      h3 {
        font-size: 20px;
      }

      #main-container > div.row > div:nth-child(2) > span.h2 > a {
        font-size: 11px;
        padding: 2px 6px;
        margin-left: 8px;
      }

      #contest-nav-tabs > div > small.back-to-home.pull-right {
        display: none !important;
      }

      #contest-nav-tabs > ul > li {
        width: auto;
      }

      #contest-nav-tabs > ul > li > a {
        font-size: 12px;
        padding: 6px 8px;
      }
    }

    @media screen and (min-width: 768px) {
      #header .header-page, .header-lang {
        display: -webkit-box !important;
      }
    }
  `;

  const styleNode = document.createTextNode(css);
  document.head.insertAdjacentHTML("beforeend", "<style></style>");
  document.head.lastElementChild.appendChild(styleNode);
})();