AtCoderChristmasTree

AtCoderのユーザーページのレーティング瓦をクリスマスツリーにします

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

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

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

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

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

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

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

Advertisement:

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

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

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

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

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

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

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

Advertisement:

// ==UserScript==
// @name         AtCoderChristmasTree
// @namespace    https://github.com/ohirugoha-n/AtCoderChristmasTree
// @version      0.1.0
// @description  AtCoderのユーザーページのレーティング瓦をクリスマスツリーにします
// @author       ohirugohan
// @match        https://atcoder.jp/users/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
  'use strict';

  const kawara = document.getElementsByClassName("user-rating-stage-l");
  const star_elem = document.getElementsByClassName("fav-btn")[0];
  if(kawara.length != 1) return;
  const kawara_elem = kawara[0];

  star_elem.parentElement.insertBefore(star_elem, kawara_elem);

  const src = kawara_elem.getAttribute("src");
  const height = src[src.length-5] - '0';

  kawara_elem.style.position = "relative";
  star_elem.style.position = "absolute";
  star_elem.style.marginLeft = "7px";
  star_elem.style.marginTop = (12 + height*-6) + "px";
  star_elem.style.zIndex = "1";
})();