Skip to content
This repository has been archived by the owner on Jan 28, 2020. It is now read-only.

Commit

Permalink
Fix Freshdesk Mint button duplicating
Browse files Browse the repository at this point in the history
The button was placed in an element that was not necessarily removed when navigating between views. Move the button to a deeper element that is removed/cleaned up when navigating.
  • Loading branch information
tcrammond committed Dec 13, 2018
1 parent e73341f commit 1fafd2d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/scripts/content/freshdesk.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ togglbutton.render('#Pagearea:not(.toggl)', { observe: true }, function(elem) {
});

// Freshdesk mint (late 2018)
togglbutton.render('.page-actions__right:not(.toggl)', { observe: true }, elem => {
togglbutton.render('.page-actions__left:not(.toggl)', { observe: true }, elem => {
const descriptionElem = $('.description-subject');

// if there's no description element it's overview page, don't show
if (!descriptionElem) { return }

const description = descriptionElem ? descriptionElem.textContent.trim() : '';
const descriptionSelector = () => {
return $('.description-subject').textContent.trim()
}

const link = togglbutton.createTimerLink({
className: 'freshdesk__mint',
description,
description: descriptionSelector,
buttonType: 'minimal',
tags: () => {
const tagList = $('.list-items');
Expand All @@ -45,5 +47,5 @@ togglbutton.render('.page-actions__right:not(.toggl)', { observe: true }, elem =
}
})

elem.parentNode.prepend(link);
elem.appendChild(link);
});
7 changes: 5 additions & 2 deletions src/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -1120,9 +1120,12 @@ li > .toggl-button.phabricator {
margin-top: 3px;
}
.toggl-button.freshdesk__mint {
margin-top: 14px;
margin-left: 5px;
margin: 0;
position: relative;
top: 6px;
left: 5px;
}

/********* CLOUDES.ME *********/
.boxedDotted .toggl-button.cloudes {
margin-left: 7px;
Expand Down

0 comments on commit 1fafd2d

Please sign in to comment.