GitHub Contribute Modifier

try to take over the world!

As of 2021-02-06. See the latest version.

  1. // ==UserScript==
  2. // @name GitHub Contribute Modifier
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.2
  5. // @description try to take over the world!
  6. // @author SheldonCoulson
  7. // @match *://github.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. // Your code here...
  15. let rect = document.getElementsByClassName("ContributionCalendar-day");
  16. let total = 0;
  17. for (let i = 0; i < rect.length - 5; i++) {
  18. let num = Math.floor(Math.random() * 4) + 1;
  19. total += num;
  20. i % Math.abs(Math.floor(Math.random() * 10) - Math.floor(Math.random() * 10) + 1) ? rect[i].attributes["data-count"].value = Math.floor(Math.random() * 10) + 1 : rect[i].attributes["data-count"].value = Math.floor(Math.random() * 10) * 4;
  21. let color = rect[i].attributes["data-count"].value;
  22. if (color > 1 && color <= 10) {
  23. rect[i].attributes["data-level"].value = 1;
  24. } else if (color > 10 && color <= 15) {
  25. rect[i].attributes["data-level"].value = 2;
  26. } else if (color > 15 && color <= 20) {
  27. rect[i].attributes["data-level"].value = 3;
  28. } else if (color > 20) {
  29. rect[i].attributes["data-level"].value = 4;
  30. } else {
  31. rect[i].attributes["data-level"].value = 0;
  32. }
  33. }
  34. let NUM = document.getElementsByClassName("f4 text-normal mb-2");
  35. NUM[1].innerText = total + " contributions in the last year";
  36. })();