-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjira-bulk-edit-hide-unused-fields.user.js
70 lines (58 loc) · 2.03 KB
/
jira-bulk-edit-hide-unused-fields.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// ==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.1
// ==/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.hasOwnProperty(i) &&
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 = 0, n = hideAwayFields.length; i < n; i++) {
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();