|
3 | 3 | * @urlAlias hubspot.com |
4 | 4 | * @urlRegex *://app.hubspot.com/* |
5 | 5 | */ |
6 | | -'use strict'; |
| 6 | +'use strict' |
7 | 7 |
|
8 | 8 | // This generic implementation works for most objects details page |
9 | 9 | togglbutton.render( |
10 | | - 'div[data-selenium-component="ProfileHighlightContainer"] [data-selenium-test="highlightTitle"]:not(.toggl)', |
| 10 | + '[data-card-type="OBJECT_HIGHLIGHT"]:not(.toggl)', |
11 | 11 | { observe: true }, |
12 | | - $container => { |
| 12 | + ($container) => { |
13 | 13 | try { |
14 | 14 | function descriptionSelector() { |
15 | | - const $description = $('div[data-selenium-test$="-highlight-details"] h3') ?? $('[data-selenium-test="highlightTitle"]'); |
16 | | - return $description.textContent.trim(); |
| 15 | + const $description = |
| 16 | + $('div[data-selenium-test$="-highlight-details"] h3') ?? |
| 17 | + $('[data-selenium-test="highlightTitle"]') |
| 18 | + return $description.textContent.trim() |
17 | 19 | } |
18 | 20 |
|
19 | 21 | const link = togglbutton.createTimerLink({ |
20 | 22 | className: 'hubspot', |
21 | 23 | description: descriptionSelector, |
22 | 24 | autoTrackable: true, |
23 | | - }); |
24 | | - const rowContainer = document.createElement('div'); |
25 | | - rowContainer.setAttribute('class', 'flex-row align-center'); |
26 | | - rowContainer.appendChild(link); |
| 25 | + }) |
| 26 | + const rowContainer = document.createElement('div') |
| 27 | + rowContainer.setAttribute('class', 'flex-row align-center') |
| 28 | + rowContainer.appendChild(link) |
27 | 29 | const cardContainer = $('[data-selenium-test="highlightTitle"]') |
28 | | - cardContainer.parentNode.parentNode.appendChild(rowContainer); |
| 30 | + const parent = cardContainer.parentNode.parentNode.parentNode |
| 31 | + parent.insertAdjacentElement('afterend', rowContainer) |
29 | 32 | } catch (e) { |
30 | 33 | console.error(e) |
31 | 34 | } |
32 | | - } |
33 | | -); |
| 35 | + }, |
| 36 | +) |
34 | 37 |
|
35 | 38 | // This generic implementation works for most objects details page |
36 | 39 | togglbutton.render( |
37 | 40 | 'td[data-table-external-id*="name-"]:not(.toggl)', |
38 | 41 | { observe: true }, |
39 | | - $container => { |
| 42 | + ($container) => { |
40 | 43 | try { |
41 | 44 | function descriptionSelector() { |
42 | | - return $('[data-test-id="truncated-object-label"]', $container).textContent.trim(); |
| 45 | + return $( |
| 46 | + '[data-test-id="truncated-object-label"]', |
| 47 | + $container, |
| 48 | + ).textContent.trim() |
43 | 49 | } |
44 | 50 |
|
45 | 51 | const link = togglbutton.createTimerLink({ |
46 | 52 | className: 'hubspot-list-item', |
47 | 53 | description: descriptionSelector, |
48 | | - buttonType: 'minimal' |
49 | | - }); |
50 | | - const rowContainer = document.createElement('div'); |
51 | | - rowContainer.setAttribute('class', 'flex-row align-center'); |
52 | | - rowContainer.appendChild(link); |
53 | | - $('.media', $container).prepend(rowContainer); |
| 54 | + buttonType: 'minimal', |
| 55 | + }) |
| 56 | + const rowContainer = document.createElement('div') |
| 57 | + rowContainer.setAttribute('class', 'flex-row align-center') |
| 58 | + rowContainer.appendChild(link) |
| 59 | + $('.media', $container).prepend(rowContainer) |
54 | 60 | } catch (e) { |
55 | 61 | console.error(e) |
56 | 62 | } |
57 | | - } |
58 | | -); |
| 63 | + }, |
| 64 | +) |
0 commit comments