Created
July 11, 2024 16:15
-
-
Save rostyq/2cade3bd8ebfb57d12c88a4fbc67cde0 to your computer and use it in GitHub Desktop.
JS snippet to redraw GitHub contribution graph into DTEK power schedule
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
function convertToPeriodicValue(value, periodLength) { | |
let modValue = value % periodLength; | |
if (modValue < 4) { | |
return 0; | |
} else if (modValue >= 4 && modValue < 7) { | |
return 1; | |
} else if (modValue >= 7 && modValue < 9) { | |
return 4; | |
} | |
} | |
document.querySelectorAll("td.ContributionCalendar-day").forEach((e, i) => e.setAttribute("data-level", convertToPeriodicValue(i, 9))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment