Fixed calc in Instant Answers
Some checks failed
Run Integration Tests / test (push) Failing after 41s

This commit is contained in:
partisan 2025-06-26 17:47:12 +02:00
parent 57507756ec
commit fa266ec993

View file

@ -7,13 +7,19 @@ document.addEventListener('DOMContentLoaded', function () {
if (staticCalc) staticCalc.style.display = 'none';
const input = document.getElementById('calc-input');
const result = document.getElementById('calc-result');
const history = document.getElementById('calc-history');
const buttons = document.querySelectorAll('.calc-buttons button');
let currentInput = '';
const staticCalcContent = staticCalc?.textContent.trim(); // load HTML calc
const initialQuery = input.value.trim();
let currentInput = initialQuery;
let historyLog = [];
if (initialQuery && staticCalcContent) {
historyLog.push(`${initialQuery} = ${staticCalcContent}`);
}
const updateUI = () => {
input.value = currentInput;
history.innerHTML = historyLog.map(entry => `<div>${entry}</div>`).join('');