Created
January 27, 2013 17:44
-
-
Save andrhamm/4649393 to your computer and use it in GitHub Desktop.
Wanted to take a screenshot of GitHub diff-stats UI but didn't want to count some of the files/changes in the commit so I wrote a quick script to update them after deleting unwanted nodes from the DOM.
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
/* | |
* Use Chrome web inspector to remove elements for files | |
* you don't want to count in the diff stats, then run this | |
* function to update the diff stats in the UI | |
*/ | |
function () { | |
var allAdditions = 0; | |
$(".diffstat > a").each( function (index, element) { | |
$(".diffstat-bar", this).remove(); | |
var addition = $.trim($(this).text().replace(/[A-Za-z$-]/g, "")); | |
allAdditions += parseInt(addition); | |
}); | |
var allFiles = $("#toc > .content li").size(); | |
console.log(allFiles+' files changed with '+ allAdditions +' additions') | |
// update the dom | |
$("#toc > .explain > strong").eq(1).text( allAdditions + " additions"); | |
$("#toc > .explain > strong").eq(0).text( allFiles + " changed files"); | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment