Bookmarklet to get the number of your GitLab contributions in 2018

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! 🎉

Screenshot of GitLab contributions bookmarklet

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 + '.');
}())
Shortlink: eay.li/38a Syndication: twitter.com, twitter.com, eay.social Format: JSON

5 Reaktionen

  1. Danke @eay – für deinen Einsatz!

  2. Streber 😘

  3. Kennst mich ja. 😎