Jira Workflow transitioner shortcuts

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==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);