Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Change status colors with javascript in announcement banner?

Tiffany Owen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 9, 2020

Is there a way to change the colors of the statuses with javascript inserted into the announcement banner? I've tried experimenting, but can't seem to get anything to work. 

<style>
.red-status {
background-color: #fed5d9;
color: #7b0b1d;
}
.yellow-status {
background-color: #fff5c9;
color: #8d6500;
}
</style>

<script type="text/javascript">
document.querySelectorAll('span.jira-issue-status-lozenge').forEach(i => {
i.textContent.indexOf("Hold") !== -1 ?
i.classList.add('yellow-status') :
i.innerText.indexOf("Awaiting Customer Response") !== -1 ?
i.classList.add('yellow-status') :
i.innerText.indexOf("Pending to") !== -1 ?
i.classList.add('yellow-status') :
i.innerText.indexOf("Ready at FA") !== -1 ?
i.classList.add('red-status') :
i.innerText.indexOf("Customer Reopened") !== -1 ?
i.classList.add('red-status') :
null;
});
</script>

Not sure if this is possible or maybe I just have the wrong class selector(s)? 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events