Skip to content

Instantly share code, notes, and snippets.

@nbardiuk
Last active December 20, 2020 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nbardiuk/d4cab37c2779e07fefdbadddf69e4f99 to your computer and use it in GitHub Desktop.
Save nbardiuk/d4cab37c2779e07fefdbadddf69e4f99 to your computer and use it in GitHub Desktop.
Render AoC stats as christmass tree
// ==UserScript==
// @name AoC stats tree
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Render AoC stats as christmass tree
// @author nbardiuk
// @match https://adventofcode.com/*/stats
// @license MIT License
// @copyright Copyright (C) 2020, by Nazarii Bardiuk
// @grant none
// ==/UserScript==
for (var day of document.querySelectorAll(".stats > a")) {
var firstonly = day.querySelectorAll(".stats-firstonly")[1];
var both = day.querySelectorAll(".stats-both")[1];
var container = document.createElement("div");
container.setAttribute(
"style",
"display: inline-flex;width: 650px;justify-content: center;"
);
var whiteStars = firstonly.textContent;
whiteStars = whiteStars.substring(0, whiteStars.length / 2 + 1);
firstonly.replaceChildren(whiteStars);
container.append(firstonly.cloneNode(true));
container.append(both.cloneNode(true));
container.append(firstonly.cloneNode(true));
day.removeChild(firstonly);
day.removeChild(both);
day.append(container);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment