Last active
March 12, 2019 21:52
-
-
Save cfarm/5528878e9a9474a5ed97 to your computer and use it in GitHub Desktop.
Bookmarklet to add up Github labels for points on project boards
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
javascript:!function(){ | |
var labels=document.getElementsByClassName("IssueLabel"); | |
var pointsCount = 0; | |
for (var i=0; i < labels.length; i++) { | |
var label = labels[i], | |
labelText = label.innerText; | |
if (labelText.indexOf("points: 13") != -1) { | |
pointsCount += 13; | |
} else if (labelText.indexOf("points: 8") != -1) { | |
pointsCount += 8; | |
} else if (labelText.indexOf("points: 5") != -1) { | |
pointsCount += 5; | |
} else if (labelText.indexOf("points: 3") != -1) { | |
pointsCount += 3; | |
} else if (labelText.indexOf("points: 2") != -1) { | |
pointsCount += 2; | |
} else if (labelText.indexOf("points: 1") != -1) { | |
pointsCount += 1; | |
} | |
} | |
document.querySelector('.progress-bar').style.marginRight = '10px' | |
var msg = document.createElement('span'); | |
var text = document.createTextNode(' ' + pointsCount + ' points!'); | |
msg.appendChild(text); | |
var projectHeader = document.querySelector(".js-project-header h3"); | |
projectHeader.appendChild(msg); | |
}(); |
new div class to insert text: repository-content
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
points should be added as labels with the following format: "points: 1" where 1 represents the number of points for each issue