Skip to content

Commit

Permalink
feat(dixa): Implement Dixa integration (#2029)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nederby authored Jan 13, 2022
1 parent c4c7bed commit 9a52736
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/content/dixa.js
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);
}
);
4 changes: 4 additions & 0 deletions src/origins.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ export default {
url: '*://devdocs.io/*',
name: 'Devdocs.io'
},
'dixa.com': {
url: '*://*.dixa.com/*',
name: 'Dixa'
},
'dobambam.com': {
url: '*://*.dobambam.com/*',
name: 'Dobambam'
Expand Down

0 comments on commit 9a52736

Please sign in to comment.