Jira Workflow transitioner shortcuts

Shortcut keys of > and < to trigger first two options in workflow transition.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name          Jira Workflow transitioner shortcuts
// @namespace     randomecho.com
// @description   Shortcut keys of > and < to trigger first two options in workflow transition.
// @include       https://*.atlassian.net/browse/*
// @include       */browse/*
// @grant         none
// @copyright     2017 Soon Van
// @author        Soon Van - randomecho.com
// @license       http://opensource.org/licenses/BSD-3-Clause
// @version       1.1
// ==/UserScript==

function transitionIssue(e) {
  var workflowTransitions = document.getElementsByClassName('issueaction-workflow-transition');

  if (!workflowTransitions[0])
    return;

  if (e.target.tagName.toLowerCase() === 'textarea')
    return;

  if (e.key === '>' || (e.shiftKey && e.keyCode === 190)) {
    workflowTransitions[0].click();
  } else if (e.key === '<' || (e.shiftKey && e.keyCode === 188) && workflowTransitions[1]) {
    workflowTransitions[1].click();
  }
}

document.addEventListener('keydown', transitionIssue, false);