Hide a button via Announcement Banner

I am using the "JIRA Email This Issue (JETI)" add-on to handle emails.  I want to utilize this rather than Jira's native share button since it saves the emails into the issue.  Being the case, I want to hide the share button.

I want to utilize JavaScript in the announcement banner to achieve this:

<script type='text/javascript'>
AJS.toInit(function() {
    AJS.$("#announcement-banner").hide();
    var shareButton = AJS.$("#jira-share-trigger").closest("li"); 
    shareButton.remove();
});
</script>

 

However, the behavior is inconsistent.

 

It works when:

  • A URL is entered into the browser
  • A refresh (F5) of a entire page.

It does not work when using a link within JIRA:

  • Issue Link
  • Issue search
  • parent link of sub-task (above the Summary)

 

How can I get the announcement banner to fire every time rather than only at full page refreshes?

 

1 answer

0 vote
Stephen Deutsch Community Champion Mar 17, 2016

It might just be easier to use pure CSS to do this.  At least for JIRA 6.4, something like this should work:

ul#opsbar-jira\.issue\.tools > li:nth-of-type(2) {
  display:none;
}

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published yesterday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

35 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you