Skip to content

Instantly share code, notes, and snippets.

@cfarm
Last active March 12, 2019 21:52
Show Gist options
  • Save cfarm/5528878e9a9474a5ed97 to your computer and use it in GitHub Desktop.
Save cfarm/5528878e9a9474a5ed97 to your computer and use it in GitHub Desktop.
Bookmarklet to add up Github labels for points on project boards
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);
}();
@cfarm
Copy link
Author

cfarm commented Nov 12, 2015

points should be added as labels with the following format: "points: 1" where 1 represents the number of points for each issue

@cfarm
Copy link
Author

cfarm commented Jul 11, 2016

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