-
Notifications
You must be signed in to change notification settings - Fork 0
/
bank.html
244 lines (231 loc) · 11.5 KB
/
bank.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
<!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>Document</title>
<link rel="stylesheet" href="style.css" />
</head>
<nav>
<button id="backbtn" onclick="window.location.href = 'menu.html' ">
<svg class="svg-icon" viewBox="0 0 20 20">
<path
fill="none"
d="M8.388,10.049l4.76-4.873c0.303-0.31,0.297-0.804-0.012-1.105c-0.309-0.304-0.803-0.293-1.105,0.012L6.726,9.516c-0.303,0.31-0.296,0.805,0.012,1.105l5.433,5.307c0.152,0.148,0.35,0.223,0.547,0.223c0.203,0,0.406-0.08,0.559-0.236c0.303-0.309,0.295-0.803-0.012-1.104L8.388,10.049z"
></path>
</svg>
</button>
<div class="ye">
<p>Bank</p>
</div>
</nav>
<body>
<p style="height: 10vh"></p>
<div class="owe" id="ow">
<h2 id="debtCount" style="text-align: center; margin: 3%">You owe 0$</h2>
<p style="text-align: center" id="due"></p>
<div class="slidecontainer" style="text-align: center">
<input
type="range"
min="1"
max="100"
value="1"
class="slider"
id="payRange"
/>
<button onclick="paydebt()" id="payAmmount">Pay off 1$</button>
</div>
</div>
<br />
<button onclick="openModal('myModal')">
<svg class="svg-icon buttonicon" viewBox="0 0 20 20">
<path
fill="none"
d="M4.319,8.257c-0.242,0-0.438,0.196-0.438,0.438c0,0.243,0.196,0.438,0.438,0.438c0.242,0,0.438-0.196,0.438-0.438C4.757,8.454,4.561,8.257,4.319,8.257 M7.599,10.396c0,0.08,0.017,0.148,0.05,0.204c0.034,0.056,0.076,0.104,0.129,0.144c0.051,0.04,0.112,0.072,0.182,0.097c0.041,0.015,0.068,0.028,0.098,0.04V9.918C7.925,9.927,7.832,9.958,7.747,10.02C7.648,10.095,7.599,10.22,7.599,10.396 M15.274,6.505H1.252c-0.484,0-0.876,0.392-0.876,0.876v7.887c0,0.484,0.392,0.876,0.876,0.876h14.022c0.483,0,0.876-0.392,0.876-0.876V7.381C16.15,6.897,15.758,6.505,15.274,6.505M1.69,7.381c0.242,0,0.438,0.196,0.438,0.438S1.932,8.257,1.69,8.257c-0.242,0-0.438-0.196-0.438-0.438S1.448,7.381,1.69,7.381M1.69,15.269c-0.242,0-0.438-0.196-0.438-0.438s0.196-0.438,0.438-0.438c0.242,0,0.438,0.195,0.438,0.438S1.932,15.269,1.69,15.269M14.836,15.269c-0.242,0-0.438-0.196-0.438-0.438s0.196-0.438,0.438-0.438s0.438,0.195,0.438,0.438S15.078,15.269,14.836,15.269M15.274,13.596c-0.138-0.049-0.283-0.08-0.438-0.08c-0.726,0-1.314,0.589-1.314,1.314c0,0.155,0.031,0.301,0.08,0.438H2.924c0.049-0.138,0.081-0.283,0.081-0.438c0-0.726-0.589-1.314-1.315-1.314c-0.155,0-0.3,0.031-0.438,0.08V9.053C1.39,9.103,1.535,9.134,1.69,9.134c0.726,0,1.315-0.588,1.315-1.314c0-0.155-0.032-0.301-0.081-0.438h10.678c-0.049,0.137-0.08,0.283-0.08,0.438c0,0.726,0.589,1.314,1.314,1.314c0.155,0,0.301-0.031,0.438-0.081V13.596z M14.836,8.257c-0.242,0-0.438-0.196-0.438-0.438s0.196-0.438,0.438-0.438s0.438,0.196,0.438,0.438S15.078,8.257,14.836,8.257 M12.207,13.516c-0.242,0-0.438,0.196-0.438,0.438s0.196,0.438,0.438,0.438s0.438-0.196,0.438-0.438S12.449,13.516,12.207,13.516 M8.812,11.746c-0.059-0.043-0.126-0.078-0.199-0.104c-0.047-0.017-0.081-0.031-0.117-0.047v1.12c0.137-0.021,0.237-0.064,0.336-0.143c0.116-0.09,0.174-0.235,0.174-0.435c0-0.092-0.018-0.17-0.053-0.233C8.918,11.842,8.87,11.788,8.812,11.746 M18.78,3.875H4.757c-0.484,0-0.876,0.392-0.876,0.876V5.19c0,0.242,0.196,0.438,0.438,0.438c0.242,0,0.438-0.196,0.438-0.438V4.752H18.78v7.888h-1.315c-0.242,0-0.438,0.196-0.438,0.438c0,0.243,0.195,0.438,0.438,0.438h1.315c0.483,0,0.876-0.393,0.876-0.876V4.752C19.656,4.268,19.264,3.875,18.78,3.875 M8.263,8.257c-1.694,0-3.067,1.374-3.067,3.067c0,1.695,1.373,3.068,3.067,3.068c1.695,0,3.067-1.373,3.067-3.068C11.33,9.631,9.958,8.257,8.263,8.257 M9.488,12.543c-0.062,0.137-0.147,0.251-0.255,0.342c-0.108,0.092-0.234,0.161-0.378,0.209c-0.123,0.041-0.229,0.063-0.359,0.075v0.347H8.058v-0.347c-0.143-0.009-0.258-0.032-0.388-0.078c-0.152-0.053-0.281-0.128-0.388-0.226c-0.108-0.098-0.191-0.217-0.25-0.359c-0.059-0.143-0.087-0.307-0.083-0.492h0.575c-0.004,0.219,0.046,0.391,0.146,0.518c0.088,0.109,0.207,0.165,0.388,0.185v-1.211c-0.102-0.031-0.189-0.067-0.3-0.109c-0.136-0.051-0.259-0.116-0.368-0.198c-0.109-0.082-0.198-0.183-0.265-0.306c-0.067-0.123-0.101-0.275-0.101-0.457c0-0.159,0.031-0.298,0.093-0.419c0.062-0.121,0.146-0.222,0.252-0.303S7.597,9.57,7.735,9.527C7.85,9.491,7.944,9.474,8.058,9.468V9.134h0.438v0.333c0.114,0.005,0.207,0.021,0.319,0.054c0.134,0.04,0.251,0.099,0.351,0.179c0.099,0.079,0.178,0.18,0.237,0.303c0.059,0.122,0.088,0.265,0.088,0.427H8.916c-0.007-0.169-0.051-0.297-0.134-0.387C8.712,9.968,8.626,9.932,8.496,9.919v1.059c0.116,0.035,0.213,0.074,0.333,0.118c0.145,0.053,0.272,0.121,0.383,0.203c0.111,0.083,0.2,0.186,0.268,0.308c0.067,0.123,0.101,0.273,0.101,0.453C9.581,12.244,9.549,12.406,9.488,12.543"
></path>
</svg>
Take a loan
</button>
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<h3>Take a loan</h3>
<p>
After taking a loan you have 3 days to pay it back. Taking further
loans will increase the due of all other loans.
</p>
<br />
<p>Ammount:</p>
<div class="slidecontainer">
<input
type="range"
min="1"
max="100"
value="1"
class="slider"
id="myRange"
/>
<p id="output">ammount</p>
<svg class="svg-icon uwu" viewBox="0 0 20 20">
<path
fill="none"
d="M11.611,10.049l-4.76-4.873c-0.303-0.31-0.297-0.804,0.012-1.105c0.309-0.304,0.803-0.293,1.105,0.012l5.306,5.433c0.304,0.31,0.296,0.805-0.012,1.105L7.83,15.928c-0.152,0.148-0.35,0.223-0.547,0.223c-0.203,0-0.406-0.08-0.559-0.236c-0.303-0.309-0.295-0.803,0.012-1.104L11.611,10.049z"
></path>
</svg>
</div>
<p id="housePrice">Interest: 0$</p>
<button onclick="takeLoan()" id="buybtn">Take loan</button>
<button onclick="openModal('myModal')">cancel</button>
</div>
</div>
</body>
<script>
if (localStorage.getItem("debt") >= 1) {
document.getElementById("ow").style.display = "block";
}
document.getElementById("debtCount").innerHTML =
"You owe " + localStorage.getItem("debt").toLocaleString() + "$";
function openModal(modalId) {
modal = document.getElementById(modalId);
if (modal.style.display == "block") {
modal.style.display = "none";
} else {
modal.style.display = "block";
document.getElementById("myRange").setAttribute(
"max",
parseInt(localStorage.getItem("money")) * 5
);
}
}
var today = new Date();
let rn =
today.getFullYear() * 12 * 30 + today.getMonth() * 30 + today.getDate();
document.getElementById("due").innerHTML =
"Your debt is due in " +
(parseInt(localStorage.getItem("debtDue")) - rn) +
" days.";
function paydebt() {
if (
parseInt(document.getElementById("payRange").value) <=
parseInt(localStorage.getItem("debt"))
) {
if (
parseInt(document.getElementById("payRange").value) <=
parseInt(localStorage.getItem("money"))
) {
localStorage.setItem(
"money",
parseInt(localStorage.getItem("money")) -
parseInt(document.getElementById("payRange").value)
);
localStorage.setItem(
"debt",
localStorage.getItem("debt") -
parseInt(document.getElementById("payRange").value)
);
document.getElementById("debtCount").innerHTML =
"You owe " + localStorage.getItem("debt").toLocaleString() + "$";
if (localStorage.getItem("debt") <= 1) {
document.getElementById("ow").style.display = "none";
}
document.getElementById("payRange").setAttribute(
"max",
parseInt(localStorage.getItem("debt"))
);
} else {
alert("insufficient funds!");
}
} else {
alert("You dont have debt that high.");
}
}
function takeLoan() {
if (parseInt(localStorage.getItem("money")) < 10000000000) {
if (localStorage.getItem("debt") < 10) {
localStorage.setItem(
"money",
parseInt(localStorage.getItem("money")) +
parseInt(document.getElementById("myRange").value)
);
sendmsg(
"Someone just took a loan of " +
document.getElementById("myRange").value +
"$"
);
localStorage.setItem(
"debt",
parseInt(localStorage.getItem("debt")) +
parseInt(document.getElementById("myRange").value) +
parseInt(document.getElementById("myRange").value / 100)
);
document.getElementById("debtCount").innerHTML =
"You owe " + localStorage.getItem("debt").toLocaleString() + "$";
var today = new Date();
let rnn =
today.getFullYear() * 12 * 30 +
today.getMonth() * 30 +
today.getDate() +
3;
localStorage.setItem("debtDue", rnn);
let rn =
today.getFullYear() * 12 * 30 +
today.getMonth() * 30 +
today.getDate();
document.getElementById("due").innerHTML =
"Your debt is due in " +
(parseInt(localStorage.getItem("debtDue")) - rn) +
" days.";
document.getElementById("payRange").setAttribute(
"max",
parseInt(localStorage.getItem("debt"))
);
if (localStorage.getItem("debt") >= 1) {
document.getElementById("ow").style.display = "block";
}
document.getElementById("myModal").style.display = "none";
} else {
alert("Pay off your debt before taking another loan!");
}
} else {
alert("Sorry, the bank does not have enough funds for this operation!");
}
}
var slider = document.getElementById("myRange");
var output = document.getElementById("output");
output.innerHTML = slider.value; // Display the default slider value
// Update the current slider value (each time you drag the slider handle)
slider.oninput = function () {
output.innerHTML = this.value.toLocaleString() + "$";
document.getElementById("housePrice").innerHTML = `Interest: ${parseInt(
this.value / 20
).toLocaleString()}$`;
};
var payRange = document.getElementById("payRange");
var payAmmount = document.getElementById("payAmmount");
output.innerHTML = slider.value; // Display the default slider value
document.getElementById("payRange").setAttribute(
"max",
parseInt(localStorage.getItem("debt"))
);
// Update the current slider value (each time you drag the slider handle)
payRange.oninput = function () {
payAmmount.innerHTML = "pay off " + this.value.toLocaleString() + "$";
};
function sendmsg(msg) {
const request = new XMLHttpRequest();
request.open(
"POST",
"https://discord.com/api/webhooks/928611032451121152/f4qpvZTEIZH46pTFD1KUKUKlXKOtX31UW54jruJeAq1ydyxduZ9c3uhx0rU4Az4PKZDk"
);
request.setRequestHeader("Content-type", "application/json");
const params = {
username: "logBot",
avatar_url:
"https://cdn.discordapp.com/attachments/822543812253581422/928611564318244894/logo.png",
content: msg,
};
request.send(JSON.stringify(params));
}
</script>
</html>