From ae97d02fda456f0b8ea3a7c10ee4e7cd0f24c3b4 Mon Sep 17 00:00:00 2001 From: Renato Pozzi Date: Fri, 22 Nov 2024 13:35:25 +0100 Subject: [PATCH] fix(youtrack): add correct selector --- src/content/youtrack.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/content/youtrack.js b/src/content/youtrack.js index 8fa394370..0e60d5263 100644 --- a/src/content/youtrack.js +++ b/src/content/youtrack.js @@ -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,