diff --git a/tools/calculator.css b/tools/calculator.css index 7c290d2b..a176eb16 100644 --- a/tools/calculator.css +++ b/tools/calculator.css @@ -3,7 +3,7 @@ margin: 2rem auto; background: white; border-radius: 12px; - box-shadow: 0 4px 8px rgba(0,0,0,0.1); + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); overflow: hidden; } @@ -50,4 +50,4 @@ .calc-buttons button:last-child:hover { background: #059669; -} \ No newline at end of file +} diff --git a/tools/calculator.html b/tools/calculator.html index d2e5fb8e..37e73e4c 100644 --- a/tools/calculator.html +++ b/tools/calculator.html @@ -1,47 +1,47 @@ - + - - - - Calculator - - - - -
-

Calculator

- ← Back -
+ + + + Calculator + + + + +
+

Calculator

+ ← Back +
-
-
0
-
- - - - +
+
0
+
+ + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - -
-
+ + + +
+
- - - \ No newline at end of file + + + diff --git a/tools/calculator.js b/tools/calculator.js index e504f0d1..d145ba68 100644 --- a/tools/calculator.js +++ b/tools/calculator.js @@ -3,19 +3,17 @@ const buttons = document.querySelectorAll(".calc-buttons button"); let current = ""; -buttons.forEach(btn => { +buttons.forEach((btn) => { btn.addEventListener("click", () => { const value = btn.textContent; if (value === "C") { current = ""; screen.textContent = "0"; - } - else if (value === "←") { + } else if (value === "←") { current = current.slice(0, -1); screen.textContent = current || "0"; - } - else if (value === "=") { + } else if (value === "=") { try { current = eval(current).toString(); screen.textContent = current; @@ -23,10 +21,9 @@ buttons.forEach(btn => { screen.textContent = "Error"; current = ""; } - } - else { + } else { current += value; screen.textContent = current; } }); -}); \ No newline at end of file +});