Skip to content

Commit

Permalink
fix(wrike): selector broken (#2325)
Browse files Browse the repository at this point in the history
* chore(wrike): lint code

* fix(wrike): project selector
  • Loading branch information
askides authored Sep 2, 2024
1 parent 87ac0cb commit 529676e
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions src/content/wrike.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
)

0 comments on commit 529676e

Please sign in to comment.