From 2a7174879a37a7620bf82c1830b536285da1ed40 Mon Sep 17 00:00:00 2001 From: Tdank <92543914+Tdank@users.noreply.github.com> Date: Tue, 5 May 2026 21:24:34 +0200 Subject: [PATCH 1/2] Also submit the form when clicking on the selected currency --- js/app.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/js/app.js b/js/app.js index 41f439d..8e031ab 100644 --- a/js/app.js +++ b/js/app.js @@ -684,6 +684,13 @@ function createCurrencyButtons() { `; container.appendChild(button); + // Add second submission method + button.addEventListener('click', () => { + if ( currency.code === currentCurrency ) { + handleFormSubmission(); + } + }); + // Add event listener button.addEventListener('click', () => { currentCurrency = currency.code; @@ -1029,9 +1036,13 @@ function displayResults(data) { updateDisplayOrderButtons(); } -// Form submission handler +// add form submission to calculate button document.getElementById('calculatorForm').addEventListener('submit', (e) => { e.preventDefault(); + handleFormSubmission(); +}) +// Form submission handler +function handleFormSubmission () { track('calculate', { currency: currentCurrency, asset_type: assetType, stock_mode: stockMode, amount: document.getElementById('amount').value }); // Check if we need to stop calculation From c45c1f6a58db93207946c450b10b216a375e8d7c Mon Sep 17 00:00:00 2001 From: Tdank <92543914+Tdank@users.noreply.github.com> Date: Thu, 14 May 2026 22:54:53 +0200 Subject: [PATCH 2/2] added another tour option for the the new function --- js/app.js | 3 ++- js/translations.js | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/js/app.js b/js/app.js index 8e031ab..7b336cc 100644 --- a/js/app.js +++ b/js/app.js @@ -1543,7 +1543,7 @@ function handleFormSubmission () { assetType: assetType } }); -}); +}; // Language switcher event handlers document.querySelectorAll('.lang-btn').forEach(btn => { @@ -2832,6 +2832,7 @@ const TOUR_STEPS = [ { target: '.enabled-cell', text: 'tourStep6' }, { target: '#calculateBtn', text: 'tourStep7' }, { target: '.results-panel', text: 'tourStep8' }, + { target: '#currencyButtons', text: 'tourStep9' }, ]; let tourStep = 0; diff --git a/js/translations.js b/js/translations.js index e8320ca..1b2f26d 100644 --- a/js/translations.js +++ b/js/translations.js @@ -90,6 +90,7 @@ export const TRANSLATIONS = { tourStep6: 'Use checkboxes to enable or disable specific denominations', tourStep7: 'Hit Calculate to get packing options', tourStep8: 'Results will appear here — pick a variant and execute the order', + tourStep9: 'Clicking the highlighted currecy also cacluates the packing options', }, ru: { title: 'Cash Cleaner Calculator', @@ -182,5 +183,6 @@ export const TRANSLATIONS = { tourStep6: 'Чекбоксы включают и отключают отдельные номиналы', tourStep7: 'Нажмите Посчитать для расчёта вариантов', tourStep8: 'Здесь появятся результаты — выберите вариант и выполните заказ', + tourStep9: 'При нажатии на выделенную валюту также рассчитываются варианты упаковки.', } };