Skip to content

Commit

Permalink
feat(hubspot): Display button on all objects using generic selector (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
with-shrey authored Sep 24, 2024
1 parent 7339ad6 commit 031c0ec
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions src/content/hubspot.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,33 @@
'use strict';

togglbutton.render(
'div[data-selenium-test="ticket-highlight-details"]:not(.toggl)',
'div[data-selenium-test$="-highlight-details"]:not(.toggl)',
{ observe: true },
$container => {
function descriptionSelector () {
const $description = $('div[data-selenium-test="ticket-highlight-details"] h3');
return $description.textContent.trim();
}
try {
function descriptionSelector() {
const $description = $('div[data-selenium-test$="-highlight-details"] h3') ?? $('div[data-selenium-test$="highlightTitle"]');
return $description.textContent.trim();
}

function tagsSelector() {
const pipeline = $('div#pipeline-select') ? $('div#pipeline-select').textContent.trim() : '';
const stage = $('div#stage-select') ? $('div#stage-select').textContent.trim() : '';

function tagsSelector () {
const pipeline = $('div#pipeline-select') ? $('div#pipeline-select').textContent.trim(): '';
const stage = $('div#stage-select') ? $('div#stage-select').textContent.trim(): '';
return [pipeline, stage];
}

return [pipeline, stage];
const link = togglbutton.createTimerLink({
className: 'hubspot',
description: descriptionSelector,
tags: tagsSelector
});
const rowContainer = document.createElement('div');
rowContainer.setAttribute('class', 'flex-row align-center');
rowContainer.appendChild(link);
$container.parentNode.appendChild(rowContainer);
} catch (e) {
console.error(e)
}
const link = togglbutton.createTimerLink({
className: 'hubspot',
project: 'Hubspot',
description: descriptionSelector,
tags: tagsSelector
});
const rowContainer = document.createElement('div');
rowContainer.setAttribute('class', 'flex-row align-center');
rowContainer.appendChild(link);
$container.appendChild(rowContainer);
}
);

0 comments on commit 031c0ec

Please sign in to comment.