Toggl-Button Jira

Toggle button for Jira

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name        Toggl-Button Jira
// @namespace   https://gitlab.paragon-es.de/toggl-button
// @version     0.9
// @include     http*://*.atlassian.com/browse/*
// @include     http*://*.atlassian.net/browse/*
// @grant       GM_xmlhttpRequest
// @grant       GM_addStyle
// @grant       GM_getResourceText
// @grant       GM_getValue
// @grant       GM_setValue
// @grant       GM_info
// @grant       GM_registerMenuCommand
// @require     https://greasyfork.org/scripts/2670-toggllibrary/code/TogglLibrary.js
// @resource    togglStyle https://gitlab.paragon-es.de/toggl-button/core/raw/master/TogglLibrary.css
// @description Toggle button for Jira
// ==/UserScript==

new TogglButtonGM('.issue-header-content', function (elem) {
  var description, projectIds = [],
    id = elem.querySelector('#key-val'),
    titleElem = elem.querySelector('#summary-val'),
    projectElem = elem.querySelector('#project-name-val'),
    tagsElem = document.querySelector('.labels-wrap-value span'),
    tags = [];

  description = titleElem.textContent.trim();
  if (id !== null) {
    description = id.textContent.trim() + " " + description;
  }

  if (projectElem !== null) {
    projectIds.push(projectElem.textContent.trim());
  }

  if (tagsElem !== null) {
    for (var i = 0, element; elements = tagsElem[i]; i++) {
      var text = element.textContent.trim();
      if (text != 'None') {
        tags.push(text);
      }
    }
  }

  return {
    className: 'jira',
    description: description,
    projectIds: projectIds,
    tags: tags
  };
});