If you are working with GitLab and are interested in the number of contributions you’ve made this year, here’s a handy, little bookmarklet to calculate your contributions.
→ GitLab Contributions Bookmarklet
- Drag the link above to your browser’s bookmark bar.
- Go to
https://gitlab.com/users/[username]/activity
(replace[username]
with, well, your username and, if necessary,gitlab.com
with your custom domain). - Hit the bookmarklet and – voilà – there’s the number of your contributions made in 2018! 🎉
Here’s the JavaScript, if you’re interested or want to run it in your console:
(function() {
var rects = document.querySelectorAll('#activity .js-contrib-calendar rect.user-contrib-cell');
var name = document.querySelectorAll('.user-info .cover-title')[0].textContent.replace(/(\r\n\t|\n|\r\t)/gm,'');
var yearToCount = '2018';
var counter = 0;
rects.forEach((item) => {
var text = item.getAttribute('data-original-title');
var count = text.substr(0, text.indexOf(' '));
if (text.indexOf(yearToCount) > -1 && count !== 'No') {
counter += parseInt(count);
}
});
alert(name + ' did ' + counter + ' contributions in ' + yearToCount + '.');
}())