Skip to content

Commit

Permalink
chore(trello): code formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
askides committed Sep 26, 2024
1 parent a092431 commit 1ed1a4c
Showing 1 changed file with 39 additions and 37 deletions.
76 changes: 39 additions & 37 deletions src/content/trello.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
* @urlAlias trello.com
* @urlRegex *://trello.com/*
*/
'use strict';
'use strict'
/* global createTag */

const getProject = () => {
const project = document.querySelector('.board-header [data-testid="board-name-display"]')
return project ? project.textContent.trim() : '';
};
const project = document.querySelector(
'.board-header [data-testid="board-name-display"]',
)
return project ? project.textContent.trim() : ''
}

const cardContainerSelector = '.card-detail-window';
const cardContainerSelector = '.card-detail-window'
togglbutton.render(
'.window-header:not(.toggl)',
{ observe: true, debounceInterval: 300 },
Expand All @@ -20,68 +22,68 @@ togglbutton.render(
$('.js-move-card') ||
$('.js-copy-card') ||
$('.js-archive-card') ||
$('.js-more-menu');
$('.js-more-menu')

if (!actionButton) {
return;
return
}

const getDescription = () => {
const description = $('.window-title h2', elem);
return description ? description.textContent.trim() : '';
};
const description = $('.window-title h2', elem)
return description ? description.textContent.trim() : ''
}

const container = createTag('div', 'button-link trello-tb-wrapper');
const container = createTag('div', 'button-link trello-tb-wrapper')
const link = togglbutton.createTimerLink({
className: 'trello',
description: getDescription,
projectName: getProject,
container: cardContainerSelector
});
container: cardContainerSelector,
})

// Pass through click on Trello button to the timer link
container.addEventListener('click', (e) => {
link.click();
});
link.click()
})

container.appendChild(link);
actionButton.parentNode.insertBefore(container, actionButton);
container.appendChild(link)
actionButton.parentNode.insertBefore(container, actionButton)
},
cardContainerSelector
);
cardContainerSelector,
)

/* Checklist buttons */
togglbutton.render(
'.checklist-item-details:not(.toggl)',
{ observe: true },
(elem) => {
const getTitleText = () => {
const title = $('.window-title h2');
return title ? title.textContent.trim() : '';
};
const title = $('.window-title h2')
return title ? title.textContent.trim() : ''
}

const getTaskText = () => {
const task = $('.checklist-item-details-text', elem);
return task ? task.textContent.trim() : '';
};
const task = $('.checklist-item-details-text', elem)
return task ? task.textContent.trim() : ''
}

const getDescription = () => {
return `${getTitleText()} - ${getTaskText()}`;
};
return `${getTitleText()} - ${getTaskText()}`
}

const link = togglbutton.createTimerLink({
className: 'trello-list',
buttonType: 'minimal',
projectName: getProject,
description: getDescription,
container: cardContainerSelector
});
const wrapper = document.createElement('span');
wrapper.classList.add('checklist-item-menu');
wrapper.style.display = 'flex';
wrapper.style.alignItems = 'center';
wrapper.appendChild(link);
elem.querySelector('.checklist-item-controls').appendChild(wrapper);
container: cardContainerSelector,
})
const wrapper = document.createElement('span')
wrapper.classList.add('checklist-item-menu')
wrapper.style.display = 'flex'
wrapper.style.alignItems = 'center'
wrapper.appendChild(link)
elem.querySelector('.checklist-item-controls').appendChild(wrapper)
},
`.checklist-items-list, ${cardContainerSelector}`
);
`.checklist-items-list, ${cardContainerSelector}`,
)

0 comments on commit 1ed1a4c

Please sign in to comment.