forked from N3v1/Calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
110 lines (99 loc) · 4.24 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!--
--------------------------------------------------------------------------------------
Calculator in HTML,CSS and JS - (c) 2023 NH (N3v1) - Use at your own risk, no warranty
--------------------------------------------------------------------------------------
-->
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Calculator</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
rel="stylesheet"
/>
<!--Import css file-->
<link rel="stylesheet" href="style.css" />
<!--Add the 'math.js' lib script tag (using the minified version of the library)-->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/11.10.0/math.min.js"
integrity="sha512-Y5iDNm1edrOTaYkJGH4GlmiKhvSHMBJ9st3DOchcFvsLdrVrMs345L6SE/3KNxRQpUqSSnuwYU8QuN/crfKdmg=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<!--Link the manifest file-->
<link rel="manifest" href="manifest.webmanifest" />
</head>
<body>
<div id="previousExpression"></div>
<!-- New div for previous expression -->
<div id="resultArea">
<div id="result">
<!-- added a new result div for font reduction -ify47 -->
<div class="resultCalc"></div>
</div>
</div>
<table>
<div class="heading">
<span class="magic"><span class="magic-text">Calculator</span></span>
</div>
<tr>
<!-- ! For special things (e, pi, pow) start -->
<td onclick="appendFunction('√')" class="specialNumber">√</td>
<td onclick="appendFunction('^')" class="specialNumber">pow</td>
<td class="specialNumber" onclick="appendOperation('e')">e</td>
<td class="specialNumber" onclick="appendOperation('π')">π</td>
<!-- ! For special things (e, pi, pow) start end -->
</tr>
<tr>
<!-- ! For trigonometry, ... start -->
<td class="trigonometric" onclick="appendTrigonometric('sin')">sin</td>
<!-- sin -->
<td class="trigonometric" onclick="appendTrigonometric('cos')">cos</td>
<!-- cos -->
<td class="trigonometric" onclick="appendTrigonometric('tan')">tan</td>
<!-- tan -->
<!-- ! For trigonometry, ... end -->
<td onclick="clearResult()" class="operators" id="clrButton">AC</td>
</tr>
<tr>
<td onclick="appendOperation('(')">(</td>
<td onclick="appendOperation(')')">)</td>
<td onclick="appendOperation(' % ')">%</td>
<td onclick="deleteLast()" class="operators">C</td>
</tr>
<tr>
<td onclick="appendOperation(7)">7</td>
<td onclick="appendOperation(8)">8</td>
<td onclick="appendOperation(9)">9</td>
<td onclick="appendOperation(' / ')" class="operators">/</td>
</tr>
<tr>
<td onclick="appendOperation(4)">4</td>
<td onclick="appendOperation(5)">5</td>
<td onclick="appendOperation(6)">6</td>
<td onclick="appendOperation(' * ')" class="operators">x</td>
</tr>
<tr>
<td onclick="appendOperation(1)">1</td>
<td onclick="appendOperation(2)">2</td>
<td onclick="appendOperation(3)">3</td>
<td onclick="appendOperation(' + ')" class="operators">+</td>
</tr>
<tr>
<td onclick="appendOperation(0)">0</td>
<td onclick="appendDecimal('.')" class="operators">.</td>
<td onclick="calculateResult()" id="equalsign">=</td>
<!--The minus operation didn't have the appendOperation function in the onclick event.
After adding the appendOperation the subtraction is functioning properly. Phillip Andrews-->
<td onclick="appendOperation(' - ')" class="operators">-</td>
</tr>
</table>
<!-- brought js file down so it will run properly - ify47 -->
<script src="index.js"></script>
</body>
</html>