Greasy Fork is available in English.

Toggl-Button GitHub

Toggle button for GitHub

  1. // ==UserScript==
  2. // @name Toggl-Button GitHub
  3. // @namespace https://gitlab.paragon-es.de/toggl-button
  4. // @version 1.6
  5. // @include http*://github.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://greasyfork.org/scripts/2670-toggllibrary/code/TogglLibrary.js
  14. // @resource togglStyle https://gitlab.paragon-es.de/toggl-button/core/raw/master/TogglLibrary.css
  15. // @description Toggle button for GitHub
  16. // ==/UserScript==
  17.  
  18. new TogglButtonGM('#partial-discussion-header', function (elem) {
  19. var description, projectIds = [],
  20. numElem = elem.querySelector('.gh-header-number', elem),
  21. titleElem = elem.querySelector('.js-issue-title', elem),
  22. authorElem = document.querySelector('.url.fn'),
  23. projectElem = document.querySelector('.js-current-repository');
  24.  
  25. description = titleElem.textContent.trim();
  26. if (numElem !== null) {
  27. description = numElem.textContent.trim() + " " + description;
  28. }
  29.  
  30. if (authorElem !== null) {
  31. projectIds.push(authorElem.textContent.trim());
  32. }
  33. if (projectElem !== null) {
  34. projectIds.push(projectElem.textContent.trim());
  35. }
  36.  
  37. return {
  38. className: 'github',
  39. description: description,
  40. projectIds: projectIds
  41. };
  42. });