Toggl-Button Gitlab

Toggl (see http://toggl.com) is an online time tracking platform and this user script integrates it so that you can easily start and stop time entries and quickly recognize which task is currently active. More details can be found at https://github.com/jurgenhaas/toggl-button-greasemonkey

As of 2015-07-06. See the latest version.

  1. // ==UserScript==
  2. // @name Toggl-Button Gitlab
  3. // @namespace https://github.com/jurgenhaas/toggl-button-greasemonkey
  4. // @version 1.2
  5. // @include http*://gitlab.com/*
  6. // @grant GM_xmlhttpRequest
  7. // @grant GM_addStyle
  8. // @grant GM_getResourceText
  9. // @grant GM_getValue
  10. // @grant GM_setValue
  11. // @grant GM_info
  12. // @grant GM_registerMenuCommand
  13. // @require https://greatest.deepsurf.us/scripts/2670-toggllibrary/code/TogglLibrary.js
  14. // @resource togglStyle https://raw.githubusercontent.com/jurgenhaas/toggl-button-greasemonkey/v1.1/TogglLibrary.css
  15. // @description Toggl (see http://toggl.com) is an online time tracking platform and this user script integrates it so that you can easily start and stop time entries and quickly recognize which task is currently active. More details can be found at https://github.com/jurgenhaas/toggl-button-greasemonkey
  16. // ==/UserScript==
  17.  
  18. new TogglButtonGM('.issue-details', function (elem) {
  19. var description, projectIds = [],
  20. numElem = elem.querySelector('.page-title', elem),
  21. titleElem = elem.querySelector('.issue-box .title, .issue-title', elem),
  22. projectElem = document.querySelector('.title');
  23.  
  24. description = titleElem.textContent.trim();
  25. if (numElem !== null) {
  26. description = numElem.childNodes[2].nodeValue.trim() + " " + description;
  27. }
  28.  
  29. if (projectElem !== null) {
  30. projectIds.push(projectElem.textContent.trim());
  31. }
  32.  
  33. return {
  34. className: 'gitlab',
  35. description: description,
  36. projectIds: projectIds
  37. };
  38. });