-
Notifications
You must be signed in to change notification settings - Fork 571
/
Copy pathhubspot.js
38 lines (34 loc) · 1.14 KB
/
hubspot.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* @name Hubspot
* @urlAlias hubspot.com
* @urlRegex *://app.hubspot.com/*
*/
'use strict';
togglbutton.render(
'div[data-selenium-test$="-highlight-details"]:not(.toggl)',
{ observe: true },
$container => {
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() : '';
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)
}
}
);