Last active
April 27, 2017 10:49
-
-
Save RolandStuder/2c07ce04db8d4bacc76e10bb2a2fc8b7 to your computer and use it in GitHub Desktop.
Enables use of estimates on Github board
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
// custom javascript for github board | |
// Strings like '12h' are summed on the top of the columns. | |
var updateEstimates = window.setInterval(calculateEstimates, 500); | |
function calculateEstimates(){ | |
var columns = $('.project-column') | |
for (var i = 0; i < columns.length; i++) { | |
var sumOfColumn = getSumOfPoints($(columns[i]).find("a.h5").text()); | |
$(columns[i]).find(".Counter").text(sumOfColumn + "h"); | |
} | |
} | |
function getSumOfPoints(input) { | |
var pattern = /(\d+)h/g; | |
var sumOfPoints = 0 | |
while ((match = pattern.exec(input)) !== null) { | |
sumOfPoints += parseInt(match[1]); | |
} | |
return sumOfPoints | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can be used with https://www.google.ch/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiom8DvpZLTAhVLCcAKHWC8Bu8QFggjMAA&url=https%3A%2F%2Fchrome.google.com%2Fwebstore%2Fdetail%2Fcustom-javascript-for-web%2Fpoakhlngfciodnhlhhgnaaelnpjljija&usg=AFQjCNHSfwCdwGL1GabmIsu6tUNQHejQSw&sig2=E324VSDTC8-EYXbZRXcSzg&bvm=bv.152174688,d.bGs