Last active
May 2, 2019 15:47
-
-
Save sleeyax/6eb9e7bfeb286f8c801f6c35ec384cc0 to your computer and use it in GitHub Desktop.
Calculate additions - deletions in the contributors graph on github
This file contains 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 Github contributors graph addon | |
// @author Sleeyax | |
// @namespace Violentmonkey Scripts | |
// @match https://github.com/*/graphs/contributors | |
// @grant none | |
// @inject-into content | |
// ==/UserScript== | |
var x = setInterval(function() { | |
var added = document.getElementsByClassName("text-green"); | |
var deleted = document.getElementsByClassName("text-red"); | |
for (var i=0; i<added.length; i++) { | |
var a = added[i].innerText.replace(",", "").replace(" ++", ""); | |
var b = deleted[i].innerText.replace(",", "").replace(" --", ""); | |
var c = a - b; | |
deleted[i].insertAdjacentHTML("afterEnd", '<span class="text-blue text-normal"> ' + c +' diff</span>'); | |
} | |
if (document.getElementsByClassName("text-blue").length > 0) { | |
clearInterval(x); | |
} | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment