It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to capture hover event in JQL Filter content

What I'm trying to do is display a list of JIRA items in a Confluence page, and upon rollover get the description field for the JIRA item using the JIRA REST API, and load that text into a DIV on the same wiki. I almost have it working, but ran into one final hurdle.

What's working/not working:

  • Load a JQL filer showing a list of JIRA items from the connected JIRA instance (done)
  • Define a DIV section in that confluence wiki page (done)
  • Include an HTML macro with code that senses a hover over a link and pulls in the description content from the associated JIRA item via the JIRA REST API (done)
  • That same HTML macro puts the description text in the DIV when the link is statically/manually included in the Confluence page (done and working!)
  • Include an HTML macro with code that senses a hover over a link in the rendered JQL Filter and pulls in the description content from the associated JIRA item via the JIRA REST API and puts it in the DIV (not working)

The problem is that the hover code doesn't seem to even see the rollover in the rendered JQL Filter. Below is the JQuery code that I'm using to get the hover action when a link is embedded in a Confluence page (which works), but the alert (when uncommented) isn't triggered at all when rolling over any of the links in the rendered JQL Filter. How could I capture those events?

AJS.toInit(function() {
   AJS.$("a").hover(function() { 
	//alert ("Rollover!");
	if (this.href.includes("https://fakecompanyurl.com/browse/NGC")) {
		var IncomingURL = this.href;
		var JiraRef = IncomingURL.match(/NGC-\d+/);
		var ShortJiraRef = JiraRef.toString();
		ShortJiraRef = ShortJiraRef.substr(4);
		var result = LookupJiraInfo(ShortJiraRef); // function defined elsewhere
		document.getElementById("definition").innerHTML = result;
	} else {
		document.getElementById("definition").innerHTML = "No associated JIRA description for this URL";
	}
 });
});
</script>

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

4,120 views 4 6
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you