diff --git a/apps/calculator/index.html b/apps/calculator/index.html index 68c3412..9f31a7b 100644 --- a/apps/calculator/index.html +++ b/apps/calculator/index.html @@ -5,154 +5,161 @@ MilkNet | Calculator -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- - // Add event listener for keyboard input - document.addEventListener('keydown', function(event) { - const key = event.key; - - // Handle digit keys and operators - if ((key >= '0' && key <= '9') || key === '.' || key === '+' || key === '-' || key === '*' || key === '/' || key === '%' || key === '^') { - appendToDisplay(key); - } - // Handle special characters and functions - else if (key === '(') { - appendToDisplay('('); - } else if (key === ')') { - appendToDisplay(')'); - } else if (key === 'Enter') { - calculateResult(); - } else if (key === 'Backspace') { - backspace(); - } - }); - - // Function for handling Backspace - function backspace() { - let display = document.getElementById('display').value; - document.getElementById('display').value = display.slice(0, -1); - } -