Skip to content

Commit d5a1b39

Browse files
larsjehwith-shrey
authored andcommitted
feat(hubspot): Add Hubspot integration
1 parent 165bd8d commit d5a1b39

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/content/hubspot.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
'use strict';
2+
/* global togglbutton, $ */
3+
4+
togglbutton.render(
5+
'div[data-selenium-test="ticket-highlight-details"]:not(.toggl)',
6+
{ observe: true },
7+
$container => {
8+
const link = togglbutton.createTimerLink({
9+
className: 'hubspot',
10+
project: 'Hubspot',
11+
description: descriptionSelector,
12+
tags: tagsSelector
13+
});
14+
const rowContainer = document.createElement('div');
15+
rowContainer.setAttribute('class', 'flex-row align-center');
16+
rowContainer.appendChild(link);
17+
$container.appendChild(rowContainer);
18+
}
19+
);
20+
21+
function descriptionSelector () {
22+
const $description = $('div[data-selenium-test="ticket-highlight-details"] h3');
23+
return $description.textContent.trim();
24+
}
25+
26+
function tagsSelector () {
27+
const pipeline = $('div#pipeline-select').textContent.trim();
28+
const stage = $('div#stage-select').textContent.trim();
29+
30+
return [pipeline, stage];
31+
}

0 commit comments

Comments
 (0)