Skip to content

Instantly share code, notes, and snippets.

@blicksky
Created November 28, 2025 16:17
Show Gist options
  • Select an option

  • Save blicksky/a0ac02c4ccbedf81140a8814e1a77dd0 to your computer and use it in GitHub Desktop.

Select an option

Save blicksky/a0ac02c4ccbedf81140a8814e1a77dd0 to your computer and use it in GitHub Desktop.
An Arc Boost for adding reimbursement search buttons to the YNAB transactions page
(function () {
const buttons = [
{
label: 'All Reimbursements',
searchText: 'Flag: πŸ”„πŸ“ Reimbursement Needed (Orange), Flag: πŸ”„β³ Reimbursement Submitted (Yellow), Flag: πŸ”„βœ… Reimbursement Complete (Green), ',
buttonId: 'ynab-all-reimbursements-search-button'
},
{
label: 'Outstanding Reimbursements',
searchText: 'Flag: πŸ”„πŸ“ Reimbursement Needed (Orange), Flag: πŸ”„β³ Reimbursement Submitted (Yellow), ',
buttonId: 'ynab-outstanding-reimbursements-search-button'
}
]
function insertButtonsIfOnAccountsPage() {
const isAccountsPage = window.location.pathname.includes('/accounts');
buttons.forEach(({label, searchText, buttonId}) => {
if (!isAccountsPage) {
document.getElementById(buttonId)?.remove();
return;
}
const accountHeaderBalancesEl = document.querySelector(".accounts-header-balances");
if (!accountHeaderBalancesEl || document.getElementById(buttonId)) {
return;
}
const button = document.createElement('button');
button.id = buttonId;
button.textContent = label;
button.className = 'button button-primary';
Object.assign(button.style, {
marginLeft: '10px',
});
button.onclick = () => {
const input = document.querySelector('input.transaction-search-input');
if (!input) {
console.warn('No input found with class "transaction-search-input"');
return;
}
input.value = searchText;
input.dispatchEvent(new Event('input', { bubbles: true }));
input.dispatchEvent(new KeyboardEvent('keydown', {
bubbles: true,
cancelable: true,
key: 'Enter',
code: 'Enter',
keyCode: 13,
which: 13
}));
};
accountHeaderBalancesEl.appendChild(button);
});
}
function startObserver() {
// Observe changes in the body (DOM mutations from Ember route transitions)
const observer = new MutationObserver(() => {
insertButtonsIfOnAccountsPage();
});
observer.observe(document.body, {
childList: true,
subtree: true
});
// Run once initially
insertButtonsIfOnAccountsPage();
}
// Wait until the document is fully ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', startObserver);
} else {
startObserver();
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment