timemory-limit-emphasizer

AtCoderで実行時間制限が2 secでないとき、メモリ制限が1024 MBでないときに強調する

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         timemory-limit-emphasizer
// @namespace    https://github.com/hotarupoyo
// @version      0.0.0
// @author       hotarupoyo
// @description  AtCoderで実行時間制限が2 secでないとき、メモリ制限が1024 MBでないときに強調する
// @license      MIT
// @match        https://atcoder.jp/contests/*/tasks/*
// ==/UserScript==

(function () {
  'use strict';

  (() => {
    const pTags = document.getElementsByTagName("p");
    let limitP = void 0;
    for (let i = 0; i < pTags.length; i++) {
      const pTag = pTags[i];
      if (pTag.innerText.includes("実行時間制限: ") || pTag.innerText.includes("Time Limit: ")) {
        limitP = pTag;
        break;
      }
    }
    if (limitP == null) {
      return;
    }
    const timeLimit = limitP.innerText.match(/(実行時間制限|Time Limit): \d+(\.\d+)? sec/);
    if (timeLimit != null) {
      const s = timeLimit[0];
      if (!s.endsWith(" 2 sec")) {
        const replaced = s.replace(/\d+(\.\d+)?/, "<span style='color: red; font-size: 28px; '>$&</span>");
        limitP.innerHTML = limitP.innerHTML.replace(/(実行時間制限|Time Limit): \d+(\.\d+)? sec/, replaced);
      }
    }
    const memoryLimit = limitP.innerText.match(/(メモリ制限|Memory Limit): \d+(\.\d+)? MB/);
    if (memoryLimit != null) {
      const s = memoryLimit[0];
      if (!s.endsWith(" 1024 MB")) {
        const replaced = s.replace(/\d+(\.\d+)?/, "<span style='color: red; font-size: 28px; '>$&</span>");
        limitP.innerHTML = limitP.innerHTML.replace(/(メモリ制限|Memory Limit): \d+(\.\d+)? MB/, replaced);
      }
    }
  })();

})();