Fixed calc in Instant Answers
Some checks failed
Run Integration Tests / test (push) Failing after 41s
Some checks failed
Run Integration Tests / test (push) Failing after 41s
This commit is contained in:
parent
57507756ec
commit
fa266ec993
1 changed files with 8 additions and 2 deletions
|
@ -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('');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue