Skip to content

Commit

Permalink
fix(youtrack): add correct selector
Browse files Browse the repository at this point in the history
  • Loading branch information
askides committed Nov 22, 2024
1 parent 7b792bb commit ae97d02
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/content/youtrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,17 @@ togglbutton.render(
'div[data-test="issue-container"]:not(.toggl)',
{ observe: true },
function (elem) {
console.log('Toggl Button: Reporter info not found.')
const reporterInfo = elem.querySelector('span[data-test="reporter-info"]')
const reporterInfo = elem.querySelector('[data-test="reporter-info"]')

if (reporterInfo === null) {
console.log('Toggl Button: Reporter info not found.')
return
}
const reporterInfoContainer = reporterInfo.parentElement

const issueIdElem = reporterInfoContainer.querySelector(
'a[href*="issue/"] > span',
)
const issueId = issueIdElem ? issueIdElem.textContent.trim() : ''
const reporterInfoContainer = reporterInfo.parentElement

const issueTitleElem = elem.querySelector('h1')
const issueTitle = issueTitleElem ? issueTitleElem.textContent.trim() : ''
const issueId = $('.idLink__ee62').textContent.trim()
const issueTitle = $('h1').textContent.trim()

const link = togglbutton.createTimerLink({
description: issueId + ' ' + issueTitle,
Expand Down

0 comments on commit ae97d02

Please sign in to comment.