Forums

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

How to capture hover event in JQL Filter content

Bob Murata
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 16, 2020

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
AUG Leaders

Atlassian Community Events