您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
restricts navbar width
// ==UserScript== // @name AtCoder Navbar Restrictor // @namespace https://twitter.com/KakurenboUni // @version 0.0.3 // @description restricts navbar width // @author uni_kakurenbo // @match https://atcoder.jp/contests/** // @license MIT // @supportURL https://twitter.com/KakurenboUni // ==/UserScript== (function() { 'use strict'; const $navbar = document.getElementById("navbar-collapse"); if(!$navbar) return; const $contestTitle = document.getElementsByClassName("contest-title")[0]; if(!$contestTitle) return; $contestTitle.style["overflow-x"] = "clip" $contestTitle.style["text-overflow"] = "ellipsis" $contestTitle.style["text-wrap"] = "nowrap" const observer = new ResizeObserver(() => { const $navbarBrand = document.getElementsByClassName("navbar-brand")[0]; const $navbarRight = document.getElementsByClassName("navbar-right")[0]; if(!$navbarBrand || !$navbarRight) return; const width = $navbar.offsetWidth - ($navbarRight.offsetWidth + $navbarBrand.offsetWidth); $contestTitle.style["max-width"] = `${width}px`; }); observer.observe($navbar); })();