Jira Hide unused bulk edit fields

Hide fields from Bulk Edit screen that are not usually bulk edited

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 Hide unused bulk edit fields
// @namespace     randomecho.com
// @description   Hide fields from Bulk Edit screen that are not usually bulk edited
// @include       https://*.atlassian.net/secure/views/bulkedit/BulkChooseOperation!default.jspa
// @include       */secure/views/bulkedit/BulkChooseOperation!default.jspa
// @include       https://*.atlassian.net/secure/views/bulkedit/BulkEditDetails.jspa
// @include       */secure/views/bulkedit/BulkEditDetails.jspa
// @grant         none
// @copyright     2017 Soon Van
// @author        Soon Van - randomecho.com
// @license       http://opensource.org/licenses/BSD-3-Clause
// @version       1.0
// ==/UserScript==

// Pre-selects the Edit Issues option on the Step 2 of 4 page before Operation Details
var bulkEditOptionOfPage2 = document.getElementById('bulk.edit.operation.name_id');
if (bulkEditOptionOfPage2) {
  bulkEditOptionOfPage2.checked = true;
}

function hideCustomFields() {
  var customFields = document.getElementsByClassName('checkbox');

  for (var i in customFields) {
    if (customFields[i].getAttribute('id').indexOf('cbcustomfield_') !== -1) {
        customFields[i].parentNode.parentNode.style.display = 'none';
    }
  }
}

function hideStandardFields() {
  var hideAwayFields = [
    'cbassignee',
    'cbcomment',
    'cbduedate',
    'cbenvironment',
    'cbissuetype',
    'cbpriority',
    'cbreporter',
    'cbversions',
  ];

  for (var i in hideAwayFields) {
    var fieldName = document.getElementById(hideAwayFields[i]);

    if (fieldName) {
      fieldName.parentNode.parentNode.style.display = 'none';
    }
  }
}

function hideUnusedTextFields() {
  var textField = document.getElementById('versions-textarea');

  if (textField) {
    textField.parentNode.parentNode.style.display = 'none';
  }
}

function hideUnusedFields() {
  hideStandardFields();

  setTimeout(function() {hideUnusedTextFields()}, 2000);

  hideCustomFields();
}

window.onload = hideUnusedFields();