Last active
February 14, 2017 07:28
-
-
Save 6220119/8c08768b33e72af60e4b98ba9232bae5 to your computer and use it in GitHub Desktop.
JIRA scripts (JIRA v1000.747.1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
var assignee = $('#assignee-val > span').attr('rel'); | |
if (assignee) { | |
$('#footer-comment-button').click(); | |
$('#comment').val('[~' + assignee + '], This is an auto-generated comment, please add submitted change list number, Reviewed by, root cause analysis and solution if applicable'); | |
$('#issue-comment-add-submit').enable().click(); | |
} else { | |
alert('No assignee!'); | |
} | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($, window, newLabel) { | |
if (!$) { | |
alert('No JQuery!'); | |
return; | |
} | |
var issueId = $("input[name=id]")[0]; | |
if (issueId) { | |
issueId = issueId.value; | |
} else { | |
alert('Cannot find Issue ID! Please update the script!'); | |
return; | |
} | |
var atl_token = $("input[name=atl_token]")[0]; | |
if (atl_token) { | |
atl_token = atl_token.value; | |
} else { | |
alert('Cannot find ATL_TOKEN! Please update the script!'); | |
return; | |
} | |
var existingLabels = []; | |
var labelsSelector = "#labels-" + issueId + "-value"; | |
var elem = $(labelsSelector); | |
if (elem[0]) { | |
if (elem.prop('tagName').toUpperCase() === 'UL') { | |
$(labelsSelector + ' li a.lozenge[title]').each(function (index, e) { | |
existingLabels.push($(e).attr('title')); | |
}); | |
// this may change in the future? | |
if (existingLabels.length === 0) { | |
alert('Cannot get any label, even though there are a list of them. Please update the script!'); | |
return; | |
} | |
} else { | |
//NONE, no label, get SPAN elem | |
} | |
} else { | |
alert('Cannot find labels section! Please update the script!'); | |
return; | |
} | |
var formData = new FormData(); | |
existingLabels.map(function (label) { | |
formData.append('labels', label); | |
return label; | |
}); | |
formData.append('labels', newLabel); | |
formData.append('inline',true); | |
formData.append('id', issueId); | |
formData.append('decorator', 'dialog'); | |
formData.append('noLink', false); | |
formData.append('atl_token', atl_token); | |
$.ajax({ | |
url: '/secure/EditLabels.jspa?atl_token=' + atl_token, | |
data: formData, | |
processData: false, | |
contentType: false, | |
type: 'POST', | |
success: function(data){ | |
window.location.reload(); | |
} | |
}); | |
})($, this, '[AUTO]-Lacking-Details-Comment'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($, window, labelToBeRemoved) { | |
if (!$) { | |
alert('No JQuery!'); | |
return; | |
} | |
var issueId = $("input[name=id]")[0]; | |
if (issueId) { | |
issueId = issueId.value; | |
} else { | |
alert('Cannot find Issue ID! Please update the script!'); | |
return; | |
} | |
var atl_token = $("input[name=atl_token]")[0]; | |
if (atl_token) { | |
atl_token = atl_token.value; | |
} else { | |
alert('Cannot find ATL_TOKEN! Please update the script!'); | |
return; | |
} | |
var existingLabels = []; | |
var labelsSelector = "#labels-" + issueId + "-value"; | |
var elem = $(labelsSelector); | |
if (elem[0]) { | |
if (elem.prop('tagName').toUpperCase() === 'UL') { | |
$(labelsSelector + ' li a.lozenge[title]').each(function (index, e) { | |
existingLabels.push($(e).attr('title')); | |
}); | |
// this may change in the future? | |
if (existingLabels.length === 0) { | |
alert('Cannot get any label, even though there are a list of them. Please update the script!'); | |
return; | |
} | |
} else { | |
//NONE, no label, get SPAN elem | |
} | |
} else { | |
alert('Cannot find labels section! Please update the script!'); | |
return; | |
} | |
var formData = new FormData(); | |
existingLabels.map(function (label) { | |
if (labelToBeRemoved !== label) { | |
formData.append('labels', label); | |
} | |
return label; | |
}); | |
formData.append('inline',true); | |
formData.append('id', issueId); | |
formData.append('decorator', 'dialog'); | |
formData.append('noLink', false); | |
formData.append('atl_token', atl_token); | |
$.ajax({ | |
url: '/secure/EditLabels.jspa?atl_token=' + atl_token, | |
data: formData, | |
processData: false, | |
contentType: false, | |
type: 'POST', | |
success: function(data){ | |
window.location.reload(); | |
} | |
}); | |
})($, this, '[AUTO]-Lacking-Details-Comment'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment