-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
364 lines (353 loc) · 16.1 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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-61JVJ6NTZ1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-61JVJ6NTZ1');
</script>
<title> Bói tình iu - CamNguyen's Code </title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
#name2 {
text-align: center;
top: 15px;
}
#label2 {
position: relative;
top: 15px;
}
#myProgress {
width: 100%;
background-color: #ddd;
position: relative;
top: 20px;
}
#myBar {
width: 1%;
height: 40px;
background-color: pink;
text-align: center;
line-height: 40px;
color: black;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
body {
padding-top: 20px;
background: #726eb7;
position: absolute;
left: 50%;
transform: translate(-50%);
margin: 0;
overflow-x: hidden;
}
#hnag {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 70px;
color: #f28482;
display: block;
font-weight: bold;
text-align: center;
}
a {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 20px;
color: black;
display: block;
text-align: center;
}
label {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 35px;
color: #da66ac;
display: block;
text-align: center;
font-weight: bold;
}
b {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 27px;
color: black;
display: block;
text-align: center;
font-weight: bold;
}
button {
background-color: #fde89e;
color: #bd8051;
width: 100%;
height: 60px;
font-size: 25px;
position: relative;
top: 20px;
}
#teller {
width: 90%;
}
input {
width: 100%;
height: 30px;
font-size: 20px;
text-align: center;
}
h1 {
color: #ffe100;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 27px;
display: block;
text-align: center;
font-weight: bold;
}
q {
color: #fde89e;
font-size: 25px;
display: block;
text-align: center;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
#done {
position: relative;
}
</style>
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.11/firebase-app.js";
import { getDatabase, ref, set} from "https://www.gstatic.com/firebasejs/9.6.11/firebase-database.js";
const firebaseConfig = {
apiKey: "AIzaSyBsP3OnQ-YZSHVsNAK4NzcniWi1nyF2zh0",
authDomain: "fortune-teller-54927.firebaseapp.com",
databaseURL: "https://fortune-teller-54927-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "fortune-teller-54927",
storageBucket: "fortune-teller-54927.appspot.com",
messagingSenderId: "114466403738",
appId: "1:114466403738:web:2623d5eab4f1731ca3f623",
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const db = getDatabase(app);
document.getElementById('myForm').addEventListener('submit', function(e) {
e.preventDefault();
startbar();
var per1 = document.getElementById('name1').value, per2 = document.getElementById('name2').value;
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0');
var yyyy = today.getFullYear();
today = mm + '/' + dd + '/' + yyyy;
set(ref(db, 'users/' + per1 +'_'+ per2), {date: today});
setTimeout(cal, 3000);
});
var haha = 0;
function startbar() {
if (haha === 0) {
haha = 1;
var elem = document.getElementById("myBar");
var width = 0;
var id = setInterval(frame, 25);
function frame() {
if (width >= 100) {
clearInterval(id);
haha = 0;
} else {
width++;
elem.style.width = width + "%";
elem.innerHTML = width + "%";
}
}
}
}
var cung = ["Bạch Dương", "Kim Ngưu","Song Tử","Cự Giải","Sư Tử","Xử Nữ","Thiên Bình","Hổ Cáp","Nhân Mã","Ma Kết","Bảo Bình","Song Ngư"];
var divdone = document.getElementById("done"),
brr = document.createElement("br"),
ngang = document.createElement("a");
ngang.innerHTML = "----------";
function cal() {
var n1 = document.getElementById("name1").value,
n2 = document.getElementById("name2").value,
sc1 = 0,
sc2 = 0;
for (let i = 0, maxi = n1.length; i < maxi; ++i) {
var tmp = n1[i].charCodeAt(0);
sc1 += tmp;
}
for (let i = 0, maxi = n2.length; i < maxi; ++i) {
var tmp = n2[i].charCodeAt(0);
sc2 += tmp;
}
var tmp1 = (sc1 / sc2) * 100,
tmp2 = (sc2 / sc1) * 100;
tmp1 %= 100;
tmp2 %= 100;
var ans = Math.max(tmp1, tmp2);
ans = Math.max(12.21, ans);
ans = ans.toFixed(2);
divdone.innerHTML = "";
var dmy1 = document.getElementById("date1").value;
var sd1 = dmy1.substring(8,10), sm1 = dmy1.substring(5,7);
var dmy2 = document.getElementById("date2").value;
var sd2 = dmy2.substring(8,10), sm2 = dmy2.substring(5, 7);
var d1 = parseInt(sd1), m1 = parseInt(sm1), d2 = parseInt(sd2), m2 = parseInt(sm2);
var c1, c2;
if ((d1 >= 21 && m1 === 3) || (d1 <= 19 && m1 === 4)) c1 = 1;
if ((d1 >= 20 && m1 === 4) || (d1 <= 20 && m1 === 5)) c1 = 2;
if ((d1 >= 21 && m1 === 5) || (d1 <= 21 && m1 === 6)) c1 = 3;
if ((d1 >= 22 && m1 === 6) || (d1 <= 22 && m1 === 7)) c1 = 4;
if ((d1 >= 23 && m1 === 7) || (d1 <= 22 && m1 === 8)) c1 = 5;
if ((d1 >= 23 && m1 === 8) || (d1 <= 22 && m1 === 9)) c1 = 6;
if ((d1 >= 23 && m1 === 9) || (d1 <= 23 && m1 === 10)) c1 = 7;
if ((d1 >= 24 && m1 === 10) || (d1 <= 21 && m1 === 11)) c1 = 8;
if ((d1 >= 22 && m1 === 11) || (d1 <= 21 && m1 === 12)) c1 = 9;
if ((d1 >= 22 && m1 === 12) || (d1 <= 19 && m1 === 1)) c1 = 10;
if ((d1 >= 20 && m1 === 1) || (d1 <= 18 && m1 === 2)) c1 = 11;
if ((d1 >= 19 && m1 === 2) || (d1 <= 20 && m1 === 3)) c1 = 12;
if ((d2 >= 21 && m2 === 3) || (d2 <= 19 && m2 === 4)) c2 = 1;
if ((d2 >= 20 && m2 === 4) || (d2 <= 20 && m2 === 5)) c2 = 2;
if ((d2 >= 21 && m2 === 5) || (d2 <= 21 && m2 === 6)) c2 = 3;
if ((d2 >= 22 && m2 === 6) || (d2 <= 22 && m2 === 7)) c2 = 4;
if ((d2 >= 23 && m2 === 7) || (d2 <= 22 && m2 === 8)) c2 = 5;
if ((d2 >= 23 && m2 === 8) || (d2 <= 22 && m2 === 9)) c2 = 6;
if ((d2 >= 23 && m2 === 9) || (d2 <= 23 && m2 === 10)) c2 = 7;
if ((d2 >= 24 && m2 === 10) || (d2 <= 21 && m2 === 11)) c2 = 8;
if ((d2 >= 22 && m2 === 11) || (d2 <= 21 && m2 === 12)) c2 = 9;
if ((d2 >= 22 && m2 === 12) || (d2 <= 19 && m2 === 1)) c2 = 10;
if ((d2 >= 20 && m2 === 1) || (d2 <= 18 && m2 === 2)) c2 = 11;
if ((d2 >= 19 && m2 === 2) || (d2 <= 20 && m2 === 3)) c2 = 12;
var check = 0;
if (c1 === 1) {
if (c2 === 5 || c2 === 9) check = 1;
else if (c2 === 4 || c2 === 10 || c2 === 7) check = -1;
}
if (c1 === 2) {
if (c2 === 10 || c2 === 6) check = 1;
else if (c2 === 11 || c2 === 5) check = -1;
}
if (c1 === 3) {
if (c2 === 11 || c2 === 7) check = 1;
else if (c2 === 12 || c2 === 4 || c2 === 6) check = -1;
}
if (c1 === 4) {
if (c2 === 12 || c2 === 8) check = 1;
else if (c2 === 1 || c2 === 7) check = -1;
}
if (c1 === 5) {
if (c2 === 1 || c2 === 9) check = 1;
else if (c2 === 10 || c2 === 2 || c2 === 8) check = -1;
}
if (c1 === 6) {
if (c2 === 10 || c2 === 2) check = 1;
else if (c2 === 3 || c2 === 12) check = -1;
}
if (c1 === 7) {
if (c2 === 3 || c2 === 11) check = 1;
else if (c2 === 2 || c2 === 4 || c2 === 10) check = -1;
}
if (c1 === 8) {
if (c2 === 12 || c2 === 4) check = 1;
else if (c2 === 11 || c2 === 5) check = -1;
}
if (c1 === 9) {
if (c2 === 1 || c2 === 5 || c2 === 9) check = 1;
else if (c2 === 6 || c2 === 12) check = -1;
}
if (c1 === 10) {
if (c2 === 6 || c2 === 2) check = 1;
else if (c2 === 7 || c2 === 1) check = -1;
}
if (c1 === 11) {
if (c2 === 3 || c2 === 7) check = 1;
else if (c2 === 8 || c2 === 12 || c2 === 4) check = -1;
}
if (c1 === 12) {
if (c2 === 4 || c2 === 8) check = 1;
else if (c2 === 6 || c2 === 9) check = -1;
}
var txt11 = document.createElement("b"), heart = document.createElement("label"), txt2 = document.createElement("b"), txt1 = document.createElement("h1");
var ans2;
if (check === 1) ans2 = Math.min(100, 100 - c1 - c2 - 1);
else if (check === -1) ans2 = Math.max(35, 40 - c1*2 - 2*c2);
else ans2 = 60-c1-c2+5;
ans2 = ans2.toFixed(2);
txt11.innerHTML = "Mức độ hợp theo tên";
heart.innerHTML = ans + "%" ;
divdone.append(brr);
divdone.append(txt11);
divdone.append(brr);
divdone.append(heart);
divdone.append(brr);
var ngang1 = document.createElement("a");
ngang1.innerHTML = "----------";
divdone.append(ngang1);
var txt113 = document.createElement("b"), heart3 = document.createElement("label"), txt23 = document.createElement("b"), txt13 = document.createElement("h1"), cung1 = document.createElement("b");
cung1.innerHTML = "("+cung[c1-1]+" và " + cung[c2-1] + ")";
txt113.innerHTML = "Mức độ hợp theo ngày sinh ";
heart3.innerHTML = ans2 + "%";
divdone.append(brr);
divdone.append(brr);
divdone.append(txt113);
divdone.append(cung1);
divdone.append(brr);
divdone.append(heart3);
divdone.append(brr);
var ngang2 = document.createElement("a");
ngang2.innerHTML = "----------";
divdone.append(ngang2);
var txt114 = document.createElement("b"), heart4 = document.createElement("label"), txt24 = document.createElement("b"), txt14 = document.createElement("h1");
var maxx = Math.max(ans, ans2),
minn = Math.min(ans, ans2);
ans = (minn + maxx)/2;
if (ans <= 20) ans += 11;
else if (ans >= 100) ans = 100;
ans = ans.toFixed(2);
txt114.innerHTML = n1;
heart4.innerHTML = " ❤ " + ans + "%" + " ❤ ";
txt24.innerHTML = n2;
divdone.append(brr);
divdone.append(txt114);
divdone.append(heart4);
divdone.append(txt24);
if (ans < 10) txt14.innerHTML = "Xin lũi nhưng mà hai bạn hông hợp nhau rùi 😥";
else if (ans < 50) txt14.innerHTML = "Nếu biết nắm bắt cơ hội thì sẽ đến được với nhau. Chúc may mắn nheeeeee 😉";
else if (ans < 70) txt14.innerHTML = "Ở trên tình bạn dưới tình iu 🤔 Còn tí xíu nữa thì hai bạn là của nhau rồi ...";
else if (ans < 90) txt14.innerHTML = "Sin trút mừnq 😙 Hai bạn rất hợp nhau";
else if (ans <= 100) txt14.innerHTML = "Tuyệt zờiiiiiiiii. Hai bạn sinh ra là dành cho nhauuuuuuu 🎉🤗";
else txt14.innerHTML = "Có trục trặc gì rồi ... Tui hông bói được :<";
divdone.append(ngang);
divdone.append(txt14);
}
</script>
</head>
<body>
<label id="hnag"> 👉 BÓI TÌNH IU 👈 </label>
<q> 🥰 Code written by Cam Nguyen 🥰 </q>
<br />
<form id="myForm">
<a>Họ và tên của bạn</a>
<input name="Name1" id="name1" />
<br />
<a>Ngày sinh của bạn</a>
<input type="date" id="date1" min="1900-01-01" max="2021-04-17">
<br />
<a id="label2">Họ và tên của bạn kia</a>
<br/>
<input name="Name2" id="name2" />
<br/>
<a>Ngày sinh của bạn kia</a>
<input type="date" id="date2" min="1900-01-01" max="2021-04-17">
<br />
<button type="submit" id="start">START</button>
</form>
<br />
<div id="myProgress">
<div id="myBar">0%</div>
</div>
<br />
<div id="done"><br /></div>
<img src="teller.png" id="teller" />
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7310599997431097"
crossorigin="anonymous"></script>
</body>
</html>