From 529676edf2d363dc32d3063e3657826891494bc4 Mon Sep 17 00:00:00 2001 From: Renato Pozzi Date: Mon, 2 Sep 2024 13:09:31 +0200 Subject: [PATCH] fix(wrike): selector broken (#2325) * chore(wrike): lint code * fix(wrike): project selector --- src/content/wrike.js | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/content/wrike.js b/src/content/wrike.js index a7bd2174f..5f1d1bb2f 100644 --- a/src/content/wrike.js +++ b/src/content/wrike.js @@ -4,43 +4,42 @@ * @urlRegex *://*.wrike.com/* */ -'use strict'; - +'use strict' togglbutton.render( 'work-item-title:not(.toggl)', { observe: true }, function (elem) { const container = document.querySelector('action-panel') - const viewContainer = document.querySelector('entity-view') + const viewContainer = document.querySelector('work-item-location') const getTitleElement = function () { - const wsTaskTitle = elem.querySelectorAll('task-title'); + const wsTaskTitle = elem.querySelectorAll('task-title') if (wsTaskTitle.length === 1 && wsTaskTitle[0].textContent !== '') { - return wsTaskTitle[0]; + return wsTaskTitle[0] } - return $('title'); - }; + return $('title') + } const descriptionText = function () { - const titleElem = getTitleElement(); - const titleElemText = titleElem ? titleElem.textContent : 'not found'; - - return `${titleElemText.trim().replace(' - Wrike', '')}`.trim(); - }; + const titleElem = getTitleElement() + const titleElemText = titleElem ? titleElem.textContent : 'not found' + + return `${titleElemText.trim().replace(' - Wrike', '')}`.trim() + } const projectText = function () { - const projectElem = viewContainer.querySelector('wrike-tag'); + const projectElem = viewContainer.querySelector('wrike-tag') // We process the project element text content. - return projectElem ? projectElem.textContent : ''; - }; + return projectElem ? projectElem.textContent : '' + } const link = togglbutton.createTimerLink({ className: 'wrike', description: descriptionText, - projectName: projectText - }); + projectName: projectText, + }) - container.prepend(link); - } -); + container.prepend(link) + }, +)