AtCoderChristmasTree

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

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

Advertisement:

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.

(I already have a user style manager, let me install it!)

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";
})();