track-extension
track-extension copied to clipboard
Add support for Pull Requests in Bitbucket
Toggl Button worked with Bitbucket PRs at one point, but it got lost down the line.
Describe the changes you'd like
Add the "Start timer" button to Pull Requests in Bitbucket. Currently, we only display it in issues.
Relevant links or screenshots
This is how it currently looks like (in issues). Do the same in PRs.

Additional context
I was using the Toggl button in PR's up until today when I switched to the "New PR Experience", and now it's missing. So it's only stopped working since Bitbucket changed things. The "Refined Bitbucket" Chrome extension had the same problem but they've mostly resolved it.
Update: OK, I see. The structure of the page has completely changed, so the Toggl-button plugin can't find an element to hook into.
Unfortunately Bitbucket's new CSS classes are the most poorly named things I've ever seen. I don't know whether these are static or if they'll change regularly, but targeting specific elements is going to be pretty challenging:

Heya, i was also wondering about bitbucket PRs so i took a minute to look at source and it seems all we need is to find a concrete querySelector to match an element where we want to add the button, right?
If it's the case then document.querySelector('nav li > a[href$="/pull-requests"]').closest('ol') would be sufficient to add the button right after the breadcrumbs, just like it does with Jira issues.
As for the description, i reckon document.querySelector('h1').textContent should do the job too.
I would do a PR but as far as i can tell there no way for me to test locally. Or is there?