-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
285 lines (251 loc) · 7.39 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
269
270
271
272
273
274
275
276
277
<!DOCTYPE html>
<html lang="vi">
<head>
<meta charset="UTF-8">
<title>Công cụ tính lãi suất | dotrinh</title>
<meta name="viewport"
content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi"/>
<script type="text/javascript" src="https://code.jquery.com/jquery-latest.pack.js"></script>
<script type="application/javascript">
var firstCheck = 0;
var oldSaving = 0;
$(document).ready(function () {
$(".OKOK").click(function () {
tinhToan();
});
$('#songay, #sotien, #laisuat').bind("enterKey", function (e) {
tinhToan()
});
$('#songay, #sotien, #laisuat').keyup(function (e) {
if (e.keyCode == 13) {
$(this).trigger("enterKey");
}
});
$('#sotien').keyup(function () {
// let sotien = $('#sotien');
// let sotienVal = sotien.val().replace(',', '');
// let formatStr = String(sotienVal).replace(/(.)(?=(\d{3})+$)/g, '$1,')
// sotien.val(sotienVal);
// console.log(sotienVal)
});
function tinhToan() {
let sotien = $('#sotien').val();
let laisuat = $('#laisuat').val()
let songay = $('#songay').val()
// sotien = sotien.replace(',', '')
let tong = ((laisuat / 100) / (365 / songay)) * sotien;
let lamtron = Math.round(tong)
$("#ketQuaShow").prepend("<li>" + "Làm tròn: " + addCommas(lamtron) + "vnđ (" + addCommas(tong) + ")</li>");
// UX
if (sotien > 500000000 && firstCheck > 0 && oldSaving !== sotien) {
showSnackbar();
oldSaving = sotien;
}
firstCheck++;
}
function addCommas(nStr) {
nStr += '';
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
$(".OKOK").trigger("click");
});
function showSnackbar() {
let x = document.getElementById("snackbar");
x.className = "show";
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
}
</script>
</head>
<body>
<div class="wrapper" style="text-align:center;">
<br>
<label>
Số tiền (vốn)
<br>
<input type="number" id="sotien" value="1000000000" required>
</label>
<br>
<label>
Lãi suất % theo năm
<br>
<input type="number" id="laisuat" value="7" required>
</label>
<br>
<label>
Số ngày gửi (1 tháng = 30 ngày)
<br><input type="number" id="songay" value="365" required>
</label>
<br>
<button class="spc button OKOK" type="button">OK</button>
(ENTER)
<br>
<br>
<div id="ajaxphp-results">
<ol id="ketQuaShow"></ol>
</div>
</div>
<div class="" style="bottom: 0; width: 100%;background-color: azure;">
<p style="font-style: italic; text-align: center; font-size: 12px">ví dụ đầu tiên là: khi bạn gửi 1 tỷ trong 1 năm
với ls 7% bạn sẽ nhận được 70tr</p>
<p style="font-style: italic; text-align: center; font-size: 12px">so_tien_lai = ((lai_suat / 100) / (365 /
so_ngay)) * so_tien</p>
</div>
<footer class="footer mt-auto py-3" style="font-size: 9px;">
<div class=" text-center">
<span class=""> ✅ Công cụ tính lãi suất đơn - dotr Inc. ™</span>
</div>
<div class=" text-center">
<span class="">
<a class="p-2 text-dark" href="https://iphone81.top/" style="text-decoration: none"> ✅ Hosting trang này được tài trợ bởi iPhone81.top</a>
</span>
</div>
<div class=" text-center">
<span class=""> ✅ Đã test hoạt động tốt trên máy tính & điện thoại.</span>
</div>
<br>
<div class=" text-center">
<span class=""> v0.0.8 </span>
</div>
<div class="text-center">
<span class="">Open Source</span>
</div>
<div class=" text-center">
<span class=""> <a href="https://dotrinh.com/lai-suat-github"><img alt="tinh-lai-suat" width="70px" src="https://dotrinh.com/laisuat/github_logo.png"></a> </span>
</div>
<!--toast-->
<div id="snackbar">
Chà tiền tiết kiệm khá ấn tượng đó! </br>
<small style="font-size: 9px">Noti này chỉ hiển thị khi tiền TK > 500tr</small>
</div>
</footer>
<style>
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.wrapper {
margin: 0 auto;
width: 50%;
background: aqua;
padding: 50px;
}
.spc {
margin-top: 5px;
}
.button {
background-color: #4CAF50; /* Green */
border: none;
padding: 10px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
}
.OKOK {
border-radius: 9px;
background: #1811ea;
color: wheat;
margin: 0 auto;
width: 100px;
}
input[type=text], input[type=number] {
padding: 12px 20px;
margin: 8px 0;
border-radius: 35px;
box-sizing: border-box;
font-size: 20px;
}
li {
margin-bottom: 12px;
}
.text-center {
text-align: center !important;
}
@media (max-width: 1024px) {
/*mobile, tablet*/
.wrapper {
width: 100%;
padding: 5px;
}
li {
margin-bottom: 12px;
text-align: left;
}
}
/* snackbar */
#snackbar {
visibility: hidden;
min-width: 250px;
transform: translateX(-50%);
background-color: #673ab7;
color: #fff;
text-align: center;
padding: 16px;
position: fixed;
z-index: 1;
left: 50%;
top: 30px;
font-size: 17px;
border-radius: 40px;
font-weight: bold;
}
#snackbar.show {
visibility: visible;
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
animation: fadein 0.5s, fadeout 0.5s 2.5s;
}
@-webkit-keyframes fadein {
from {
top: 0;
opacity: 0;
}
to {
top: 30px;
opacity: 1;
}
}
@keyframes fadein {
from {
top: 0;
opacity: 0;
}
to {
top: 30px;
opacity: 1;
}
}
@-webkit-keyframes fadeout {
from {
top: 30px;
opacity: 1;
}
to {
top: 0;
opacity: 0;
}
}
@keyframes fadeout {
from {
top: 30px;
opacity: 1;
}
to {
top: 0;
opacity: 0;
}
}
</style>
</body>
</html>