diff --git a/src/content/hubspot.js b/src/content/hubspot.js index 114bdaaf5..15c5cf5ee 100644 --- a/src/content/hubspot.js +++ b/src/content/hubspot.js @@ -30,3 +30,28 @@ togglbutton.render( } } ); + +// This generic implementation works for most objects details page +togglbutton.render( + 'td[data-table-external-id*="name-"]:not(.toggl)', + { observe: true }, + $container => { + try { + function descriptionSelector() { + return $('[data-test-id="truncated-object-label"]', $container).textContent.trim(); + } + + const link = togglbutton.createTimerLink({ + className: 'hubspot-list-item', + description: descriptionSelector, + buttonType: 'minimal' + }); + const rowContainer = document.createElement('div'); + rowContainer.setAttribute('class', 'flex-row align-center'); + rowContainer.appendChild(link); + $('.media', $container).prepend(rowContainer); + } catch (e) { + console.error(e) + } + } +);