Skip to content

Instantly share code, notes, and snippets.

@codingthat
Last active February 11, 2021 08:34
Show Gist options
  • Save codingthat/b0930af12b6a519e44ea79ebb89f4db5 to your computer and use it in GitHub Desktop.
Save codingthat/b0930af12b6a519e44ea79ebb89f4db5 to your computer and use it in GitHub Desktop.
Bookmarklet to automatically set Trello card times to just before midnight whenever the due date is accessed...unless they're in a column called "Meetings"
javascript:(function () {
const set_time_to_midnight = (a,b) => {
if (!document.querySelector('.js-open-move-from-header')
|| document.querySelector('.js-open-move-from-header').innerText === 'Meetings'
|| !document.querySelector('.js-dpicker-time-input')) return;
document.querySelector('.js-dpicker-time-input').value = '11:59 PM'
};
const config = { childList: true, subtree: true };
let bootstrap_observer;
bootstrap_observer = new MutationObserver(set_time_to_midnight);
bootstrap_observer.observe(document.getElementById('trello-root'), config);
})();
@codingthat
Copy link
Author

Unfortunately, a recent Trello update has broken this, but also made it more complicated to fix. Simply updating the query selector doesn't do the trick, because changing the .value only changes what's displayed, and not what is sent when you click Save.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment