TamperMonkey script to add a button to Jira
The code is well commented. The indentation in most places seems to be four spaces but the last few lines have indentation of two spaces so that could be made more consistent. The last comment is a bit humorous...

It seems that if the button isn't found by the id attribute, it just bails. There could be alternative ways to find that button. For example, my company recently upgraded to version 7.11.2 and it appears that the create button still has an id attribute of create_link but the list item above it also has an id attribute of create-menu so that element could be found instead. And the unordered list also has a class name of aui-nav so if the create button can't be found the list could be found instead.  I also see in the latest online version 1001.0.0 (e.g. *.atlassian.net) that the navigation menu has been moved to the left side of the screen and no longer uses list items so if your Jira gets updated you'll need to update your approach to finding that element.

I know you are familiar with const given your answers like this one so why not use it for things like projectCode, idat?

Also, a list item element is created and then the innerHTML contains another list item element:


var node = document.createElement("LI");
node.innerHTML = '&lt;li style="padding-left: 20px; text-decoration: underline; cursor: pointer;"&gt;&lt;div id="idat"&gt;Log activity&lt;/div&gt;&lt;/li&gt;';



This yields HTML like below:


&lt;li&gt;&lt;li style="padding-left: 20px; text-decoration: underline; cursor: pointer;"&gt;&lt;div id="idat"&gt;Log activity&lt;/div&gt;&lt;/li&gt;&lt;/li&gt;  



MDN's documentation for &lt;li&gt; claims "It must be contained in a parent element: an ordered list (&lt;ol&gt;), an unordered list (&lt;ul&gt;), or a menu (&lt;menu&gt;)"1 and that the permitted content is Flow Content, which does not include list item elements.  But obviously our browsers render it as expected. Ideally that list item would not contain a child list item...

You could consider using the fetch API instead of classical XHR requests unless browser compatibilty is an issue.

And since you are using ecmascript-2015 features like let, you could consider using more arrow functions...

1https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li