Toggl-Button Redmine

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

当前为 2015-07-06 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Toggl-Button Redmine
  3. // @namespace https://github.com/jurgenhaas/toggl-button-greasemonkey
  4. // @version 1.2
  5. // @include http*://www.redmine.org/issues/*
  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://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. new TogglButtonGM('#content', function (elem) {
  18. var description, projectIds = [],
  19. numElem = elem.querySelector('h2', elem),
  20. titleElem = elem.querySelector('h3', elem),
  21. authorElem = elem.querySelector('.author .user', elem),
  22. projectElem = document.querySelector('h1');
  23.  
  24. description = titleElem.textContent.trim();
  25. if (numElem !== null) {
  26. description = numElem.textContent.trim() + " " + description;
  27. }
  28.  
  29. if (authorElem !== null) {
  30. projectIds.push(authorElem.textContent.trim());
  31. }
  32.  
  33. if (projectElem !== null) {
  34. projectIds.push(projectElem.textContent.trim());
  35. }
  36.  
  37. return {
  38. className: 'redmine',
  39. description: description,
  40. projectIds: projectIds
  41. };
  42. });