jefgen / github-jira-linkifier-webextension

A WebExtension that automatically converts Jira issues into clickable links on GitHub.
MIT License
11 stars 4 forks source link

Linking PR title on the page #3

Closed Techn1x closed 5 years ago

Techn1x commented 5 years ago

I would find this most helpful - on the PR page, linking the issue number to the Jira ticket

Screen Shot 2019-06-25 at 9 06 11 am

Screen Shot 2019-06-25 at 9 07 23 am

Techn1x commented 5 years ago

Was just looking through the code and noticed that you do have code for this, so clearly it's not working for me for some reason...

https://github.com/jefgen/github-jira-linkifier-webextension/blob/master/src/background.js#L63-L74

Techn1x commented 5 years ago

I think the problem is this line; https://github.com/jefgen/github-jira-linkifier-webextension/blob/master/src/background.js#L67

When I call document.getElementsByClassName('js-issue-title') I get 2 elements Screen Shot 2019-06-25 at 9 16 02 am

The second occurrence of the element is just a link to the top of the page, and can probably be ignored. So maybe just do all elements with classname 'js-issue-title' that are not already links.

If I get some time I'll put a PR together but feel free to beat me (I've never developed a Firefox extension before so I have no idea how to test any changes I make)

jefgen commented 5 years ago

Thanks for reporting this issue, and for debugging the problem!

I think I'll change the code to only look for the span element, which would also avoid possibly creating nested links (nested "a" elements), as it looks like the second element is hidden on the GitHub PR page.

jefgen commented 5 years ago

I pushed an updated version of the extension (1.0.4) to the Mozilla Add-ons site. Try checking for updates and let me know if it fixes your issues. Thanks!

Techn1x commented 5 years ago

Works well, thanks for that!

For what it's worth, the a element isn't hidden on the page, if you have a longer PR and you scroll down the page it shows up at the top of the page in a small header - but it's probably not worth worrying about

Screen Shot 2019-06-25 at 6 25 55 pm