Skip to content

Commit

Permalink
another attempt to fix button rendering in Zendesk
Browse files Browse the repository at this point in the history
  • Loading branch information
reignmaker authored and nunofmn committed Oct 16, 2023
1 parent 6714965 commit 855543e
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/content/zendesk.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ setTimeout(() => {
}, 1000);


// Zendesk new UI Apr 2023
// Zendesk new UI Sept 2023
setTimeout(() => {
togglbutton.render(
'[data-garden-id="pane"]:not(.toggl)',
'.ticket-panes-grid-layout.active',
{ observe: true },
function (elem) {
if (elem.id === ':r1:--primary-pane') return
if (elem.querySelector('.toggl-button')) return
let description;
const projectName = $('title').textContent;

Expand All @@ -64,19 +64,13 @@ setTimeout(() => {
};

const link = togglbutton.createTimerLink({
className: 'zendesk',
className: 'zendesk-button',
description: titleFunc,
projectName: projectName && projectName.split(' - ').shift()
projectName: projectName && projectName.split(' ').shift()
});

// Check for strange duplicate buttons. Don't know why this happens in Zendesk.
if (document.querySelector('.toggl-button')) {
document.removeChild(elem.querySelector('.toggl-button'));
}
elem.querySelector('[data-side-conversations-anchor-id="1"]').firstChild
.firstChild
.firstChild
.appendChild(link);

elem.querySelector('[data-support-suite-trial-onboarding-id="conversationPane"] > div:nth-child(1)').lastChild.prepend(link);
}
);
}, 1000);
Expand Down

0 comments on commit 855543e

Please sign in to comment.