-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
268 lines (264 loc) · 11.3 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Direnç Hesaplama</title>
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx"
crossorigin="anonymous"
/>
</head>
<body>
<div class="container text-center">
<div class="row justify-content-center mt-5">
<div class="col"></div>
<div class="col-10">
<div class="card">
<div class="card-body">
<h3 class="card-title">Direnç Hesaplama</h3>
<br />
<div class="card-text">
<div class="row mb-3">
<div class="col">
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="direnc"
id="4-band"
value="4"
checked
/>
<label class="form-check-label" for="4-band"
>4 Bantlı Direnç</label
>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="direnc"
id="5-band"
value="5"
/>
<label class="form-check-label" for="5-band"
>5 Bantlı Direnç</label
>
</div>
<div class="form-check form-check-inline">
<input
class="form-check-input"
type="radio"
name="direnc"
id="6-band"
value="6"
/>
<label class="form-check-label" for="6-band"
>6 Bantlı Direnç
</label>
</div>
</div>
</div>
<div class="row">
<div class="col" id="band-1">
<div class="mb-3">
<label for="" class="form-label">1. Band</label>
<select class="form-control" name="" id="">
<option value="1">1 Kahverengi</option>
<option value="2">2 Kırmızı</option>
<option value="3">3 Turuncu</option>
<option value="4">4 Sarı</option>
<option value="5">5 Yeşil</option>
<option value="6">6 Mavi</option>
<option value="7">7 Mor</option>
<option value="8">8 Gri</option>
<option value="9">9 Beyaz</option>
</select>
</div>
</div>
<div class="col" id="band-2">
<div class="mb-3">
<label for="" class="form-label">2. Band</label>
<select class="form-control" name="" id="">
<option value="0">0 Siyah</option>
<option value="1">1 Kahverengi</option>
<option value="2">2 Kırmızı</option>
<option value="3">3 Turuncu</option>
<option value="4">4 Sarı</option>
<option value="5">5 Yeşil</option>
<option value="6">6 Mavi</option>
<option value="7">7 Mor</option>
<option value="8">8 Gri</option>
<option value="9">9 Beyaz</option>
</select>
</div>
</div>
<div class="col" id="band-3">
<div class="mb-3">
<label for="" class="form-label">3. Band</label>
<select class="form-control" name="" id="">
<option value="0">0 Siyah</option>
<option value="1">1 Kahverengi</option>
<option value="2">2 Kırmızı</option>
<option value="3">3 Turuncu</option>
<option value="4">4 Sarı</option>
<option value="5">5 Yeşil</option>
<option value="6">6 Mavi</option>
<option value="7">7 Mor</option>
<option value="8">8 Gri</option>
<option value="9">9 Beyaz</option>
</select>
</div>
</div>
<div class="col" id="band-factor">
<div class="mb-3">
<label for="" class="form-label">Çarpan</label>
<select class="form-control" name="" id="">
<option value="1">× 1 Siyah</option>
<option value="10">× 10 Kahverengi</option>
<option value="100">× 100 Kırmızı</option>
<option value="1000">× 1k Turuncu</option>
<option value="10000">× 10k Sarı</option>
<option value="100000">× 100k Yeşil</option>
<option value="1000000">× 1M Mavi</option>
<option value="10000000">× 10M Mor</option>
<option value="100000000">× 100M Gri</option>
<option value="1000000000">× 1G Beyaz</option>
<option value="/10">÷ 10 Altın</option>
<option value="/100">÷ 100 Gümüş</option>
</select>
</div>
</div>
<div class="col" id="band-tolerance">
<div class="mb-3">
<label for="" class="form-label">Tolerans</label>
<select class="form-control" name="" id="">
<option value=" ± %1">± %1 Kahverengi</option>
<option value=" ± %2">± %2 Kırmızı</option>
<option value=" ± %3">± %3 Turuncu</option>
<option value=" ± %4">± %4 Sarı</option>
<option value=" ± %0.5">± %0.5 Yeşil</option>
<option value=" ± %0.25">± %0.25 Mavi</option>
<option value=" ± %0.10">± %0.10 Mor</option>
<option value=" ± %0.05">± %0.05 Gri</option>
<option value=" ± %5">± %5 Altın</option>
<option value=" ± %10">± %10 Gümüş</option>
</select>
</div>
</div>
<div class="col" id="band-heat">
<div class="mb-3">
<label for="" class="form-label"
>Sıcaklık Katsayısı</label
>
<select class="form-control" name="" id="">
<option value="100">100 Kahverengi</option>
<option value="50">50 Kırmızı</option>
<option value="15">15 Turuncu</option>
<option value="25">25 Sarı</option>
<option value="10">10 Mavi</option>
<option value="5">5 Mor</option>
</select>
</div>
</div>
<div class="col" id="resista-change">
<div class="mb-3">
<label for="" class="form-label"
>1°C'deki Direnç Değişimi</label
>
<select class="form-control" name="" id="">
<option value="100"></option>
</select>
</div>
</div>
</div>
</div>
<br />
<h3 class="card-title" id="result">Sonuç</h3>
</div>
</div>
</div>
<div class="col"></div>
</div>
</div>
<script
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa"
crossorigin="anonymous"
></script>
<script
src="https://code.jquery.com/jquery-3.6.0.min.js"
integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4="
crossorigin="anonymous"
></script>
<script>
$(function () {
function calculate() {
var band1 = $("#band-1").find("select").val();
var band2 = $("#band-2").find("select").val();
var band3 = $("#band-3").find("select").val();
var bandfactor = $("#band-factor").find("select").val();
var bandtolerance = $("#band-tolerance").find("select").val();
var bandheat = $("#band-heat").find("select").val();
var result = 0;
var radio = $("input[type='radio']:checked").val();
if (radio == "4") {
var bands = band1 + band2;
result = parseInt(bands) * parseInt(bandfactor);
console.log(parseInt(bandfactor));
} else if (radio == "5") {
var bands = band1 + band2 + band3;
result = parseInt(bands) * parseInt(bandfactor);
console.log(parseInt(bandfactor));
} else if (radio == "6") {
var bands = band1 + band2 + band3;
result = parseInt(bands) * parseInt(bandfactor);
console.log(parseInt(bandfactor));
}
if (result >= 1000000) {
result = result / 1000000;
unit = "MΩ";
} else if (result >= 1000 && result < 1000000) {
result = result / 1000;
unit = "kΩ";
} else {
unit = "Ω";
}
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
}
$("#result").text(
numberWithCommas(result) + " " + unit + " " + bandtolerance
);
}
$("#band-3").hide();
$("#band-heat").hide();
$("#resista-change").hide();
$("select").change(function (e) {
calculate();
});
$("input[type=radio]").change(function (e) {
calculate();
var value = this.value;
if (value == "4") {
$("#band-3").hide();
$("#band-heat").hide();
$("#resista-change").hide();
} else if (value == "5") {
$("#band-3").show();
$("#band-heat").hide();
$("#resista-change").hide();
} else if (value == "6") {
$("#band-3").show();
$("#band-heat").show();
$("#resista-change").show();
}
console.log(this.value);
});
});
</script>
</body>
</html>