-
Notifications
You must be signed in to change notification settings - Fork 569
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dixa): Implement Dixa integration (#2029)
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
'use strict'; | ||
|
||
togglbutton.render( | ||
// Specify selector for element button needs to hook into | ||
// Make sure to include :not(.toggl) to avoid duplicates | ||
'.conversation-view__main [class^=conversationHeader__]:not(.toggl)', | ||
{ observe: true }, | ||
function (elem) { | ||
|
||
const getConversationId = () => { | ||
const csid = document.querySelector('.conversation-view__main button span').textContent; | ||
const title = document.querySelector('.conversation-view__main [class^=conversationHeader__] [class^=headline__] p').textContent; | ||
return `${csid} ${title}`; | ||
}; | ||
|
||
const getProject = () => { | ||
const subdomain = window.location.host.replace(".dixa.com", ""); | ||
return subdomain; | ||
} | ||
|
||
// Create timer link element | ||
const link = togglbutton.createTimerLink({ | ||
description: getConversationId, | ||
buttonType: 'minimal', | ||
projectName: getProject, | ||
className: 'dixa' | ||
}); | ||
|
||
// Add link to element | ||
const host = elem.querySelector('[class^=topActions__] [class^=root__]') | ||
host.insertBefore(link, null); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters