Skip to content

Commit

Permalink
fix(trello): adjust selectors and debounce interval, and tweak margins (
Browse files Browse the repository at this point in the history
#2276)

Closes: #2275

* chore(trello): add trello.js metadata
* Update origins.js
  • Loading branch information
niyiAO authored Feb 20, 2024
1 parent 28a6719 commit aa3bc6f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
18 changes: 12 additions & 6 deletions src/content/trello.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @name Trello
* @urlAlias trello.com
* @urlRegex *://trello.com/*
*/
'use strict';
/* global createTag */

Expand All @@ -6,9 +11,11 @@ const getProject = () => {
return project ? project.textContent.trim() : '';
};

const cardContainerSelector = '.window-overlay .window-wrapper'

togglbutton.render(
'.window-header:not(.toggl)',
{ observe: true },
{ observe: true, debounceInterval: 300 },
(elem) => {
const actionButton =
$('.js-move-card') ||
Expand All @@ -30,7 +37,7 @@ togglbutton.render(
className: 'trello',
description: getDescription,
projectName: getProject,
container: '.window-wrapper'
container: cardContainerSelector
});

// Pass through click on Trello button to the timer link
Expand All @@ -42,7 +49,7 @@ togglbutton.render(
container.appendChild(link);
actionButton.parentNode.insertBefore(container, actionButton);
},
'.window-wrapper'
cardContainerSelector
);

/* Checklist buttons */
Expand All @@ -69,15 +76,14 @@ togglbutton.render(
buttonType: 'minimal',
projectName: getProject,
description: getDescription,
container: '.window-wrapper'
container: cardContainerSelector
});
const wrapper = document.createElement('span');
wrapper.classList.add('checklist-item-menu');
wrapper.style.display = 'flex';
wrapper.style.alignItems = 'center';
wrapper.style.marginRight = '4px';
wrapper.appendChild(link);
elem.querySelector('.checklist-item-controls').appendChild(wrapper);
},
'.checklist-items-list, .window-wrapper'
`.checklist-items-list, ${cardContainerSelector}`
);
5 changes: 3 additions & 2 deletions src/origins.js
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,9 @@ export default {
clone: 'true'
},
'trello.com': {
url: '*://*.trello.com/*',
name: 'Trello'
url: '*://trello.com/*',
name: 'Trello',
file: 'trello.js'
},
'unfuddle.com': {
url: '*://*.unfuddle.com/*',
Expand Down
2 changes: 2 additions & 0 deletions src/styles/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ SingleTaskPaneToolbar .toggl-button.asana-board, /* new ui v1 */
.toggl-button.trello-list:not(.toggl-button-edit-form-button) {
visibility: hidden;
pointer-events: none;
margin-top: 6px;
margin-left: 1px;
}
.checklist-item-details:hover .toggl-button.trello-list, .toggl-button.trello-list.active:not(.toggl-button-edit-form-button) {
visibility: visible;
Expand Down

0 comments on commit aa3bc6f

Please sign in to comment.