-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalculator.html
96 lines (95 loc) · 3.5 KB
/
calculator.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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta charset="utf-8" />
<title>Fortune Street Address Converter</title>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<script src="addressConverter.js"></script>
<script type="text/javascript">
function init() {
const setAddress = function(input, address) {
if(address) {
input.classList.remove("w3-red");
input.value = address.toString(16);
} else {
input.classList.add("w3-red");
}
return address;
}
const inputHandler = function(e) {
e.target.classList.remove("w3-red");
address = parseInt(e.target.value, 16);
switch(e.target) {
case fsvirt_input:
fsvirt = address;
bsvirt = setAddress(bsvirt_input, bsvirt_to_fsvirt.inverseMap(fsvirt));
setAddress(fsfile_input, fsvirt_to_fsfile.map(fsvirt));
setAddress(bsfile_input, bsvirt_to_bsfile.map(bsvirt));
break;
case bsvirt_input:
bsvirt = address;
fsvirt = setAddress(fsvirt_input, bsvirt_to_fsvirt.map(bsvirt));
setAddress(fsfile_input, fsvirt_to_fsfile.map(fsvirt));
setAddress(bsfile_input, bsvirt_to_bsfile.map(bsvirt));
break;
case fsfile_input:
fsfile = address;
fsvirt = setAddress(fsvirt_input, fsvirt_to_fsfile.inverseMap(fsfile));
bsvirt = setAddress(bsvirt_input, bsvirt_to_fsvirt.inverseMap(fsvirt));
setAddress(bsfile_input, bsvirt_to_bsfile.map(bsvirt));
break;
case bsfile_input:
bsfile = address;
bsvirt = setAddress(bsvirt_input, bsvirt_to_bsfile.inverseMap(bsfile));
fsvirt = setAddress(fsvirt_input, bsvirt_to_fsvirt.map(bsvirt));
setAddress(fsfile_input, fsvirt_to_fsfile.map(fsvirt));
break;
}
}
const fsvirt_input = document.getElementById('fsvirt_input');
const bsvirt_input = document.getElementById('bsvirt_input');
const fsfile_input = document.getElementById('fsfile_input');
const bsfile_input = document.getElementById('bsfile_input');
fsvirt_input.addEventListener('input', inputHandler);
bsvirt_input.addEventListener('input', inputHandler);
fsfile_input.addEventListener('input', inputHandler);
bsfile_input.addEventListener('input', inputHandler);
}
</script>
<style>
@media screen and (min-width: 801px) {
body {
font-size: 32px;
}
}
@media screen and (max-width: 800px) {
body {
font-size: 4vw;
}
}
html {
overflow-y: hidden;
}
</style>
</head>
<body onload="init()">
<div class="w3-card-4 w3-center w3-display-topmiddle w3-margin-bottom-16">
<div class="w3-container w3-blue w3-padding-16">
Fortune Street Address Calculator
</div>
<div class="w3-container w3-padding-16"/>
<table class="w3-table">
<tr>
<td><label class="w3-text-blue">Fortune Street Virtual</label><input type="text" id="fsvirt_input" placeholder="80004000" class="w3-input w3-border w3-round-large" style="width:12em"/></td>
<td><label class="w3-text-blue">Boom Street Virtual</label><input type="text" id="bsvirt_input" placeholder="80004000" class="w3-input w3-border w3-round-large" style="width:12em"/></td>
</tr>
<tr>
<td><label class="w3-text-blue">Fortune Street File</label><input type="text" id="fsfile_input" placeholder="100" class="w3-input w3-border w3-round-large" style="width:12em"/></td>
<td><label class="w3-text-blue">Boom Street File</label><input type="text" id="bsfile_input" placeholder="100" class="w3-input w3-border w3-round-large" style="width:12em"/></td>
</tr>
</table>
<div class="w3-container w3-padding-16"/>
</div>
</body>
</html>