Last active
December 20, 2020 19:12
-
-
Save nbardiuk/d4cab37c2779e07fefdbadddf69e4f99 to your computer and use it in GitHub Desktop.
Render AoC stats as christmass tree
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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