diff --git a/src/content/youtrack.js b/src/content/youtrack.js index c9b085908..d6bf7a477 100644 --- a/src/content/youtrack.js +++ b/src/content/youtrack.js @@ -44,6 +44,34 @@ togglbutton.render( } ); +/* new view for single issues — since YouTrack 2023.3 */ +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"]'); + 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 issueTitleElem = elem.querySelector('h1'); + const issueTitle = issueTitleElem ? issueTitleElem.textContent.trim() : ""; + + const link = togglbutton.createTimerLink({ + description: issueId + ' ' + issueTitle, + projectName: issueId.split('-')[0] + }); + + reporterInfoContainer.insertBefore(link, reporterInfo); + } +); + // Agile board togglbutton.render('.yt-agile-card:not(.toggl)', { observe: true }, function ( elem diff --git a/src/origins.js b/src/origins.js index 5dfe18bfe..10705648c 100644 --- a/src/origins.js +++ b/src/origins.js @@ -675,8 +675,8 @@ export default { name: 'Xero', file: 'xero.js' }, - 'myjetbrains.com': { - url: '*://*.myjetbrains.com/*', + 'jetbrains.com': { + url: '*://*.jetbrains.com/*', name: 'YouTrack', file: 'youtrack.js' },