Problem with a self written "CUTE" Extension

Stephan_Mallmann November 27, 2018

Hi @ all,

I wrote a CUTE extension with the plugin "Cute for Jira" and i have an issue I can't find.
The following jQuery load on any page reload and inject a text in the Service Desk Customer Portal footer section.

#cute-jsd-footer {
text-align: center;
color: #7a869a;
font-family: -apple-system,BlinkMacSystemFont,"Segoe UI","Roboto","Oxygen","Ubuntu","Fira Sans","Droid Sans","Helvetica Neue",sans-serif;
font-size: 12px;
}
// Execute after the page was fully loaded
setTimeout(function(){
if (jQuery('#jsonPayload').length) {
jQuery("#cute-jsd-footer").insertBefore('#footer');
}
}, 1)(jQuery);
 <div id="cute-jsd-footer">
@message
</div>

 

It works fine. Only if I switch between the request type groups it adds the string once more.
Anyone out there that can show me how to avoid that?

 

Unbenannt.PNG

Best regards,

Stephan

2 answers

1 accepted

1 vote
Answer accepted
Stephan_Mallmann November 27, 2018

Hi@ all

I fixed the problem with transferring the element not in #footer.
now i load it in

jQuery("#cute-jsd-footer").insertAfter('#content .cv-page-body');

It works now because if I click on a group. not the hole page is refreshed. only the content part was refreshed and that was the problem.

Thank you alot,

Stephan 

miikhy
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.
November 27, 2018

Great!

Thanks for sharing and glad you've found this out!

Cheers

0 votes
miikhy
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.
November 27, 2018

I'm not familiar with CUTE but your code seems not to go the right way.

Using setTimeout on a jquery payload does not run each time the page is refreshed IMO but more each time an XHR response is received which would explain why your message is popping multiple time.

Can you check the XHR console and see if it's in sync with requests?

Thanks

Stephan_Mallmann November 27, 2018

Hi Micky,

thank you for the quick reply.
I'm not familier with jquery. I have only transfer some code snipits to work like I think it should work.  I don't know what to do here because on Network analysis i can't see anything from the jquery code. 

BTW: The text is only duplicated if I klick on a issue group. If I refresh the page I see only on textline.

Best regards,

Stephan

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events