-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
113 lines (108 loc) · 2.26 KB
/
script.js
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
document.addEventListener("DOMContentLoaded", function () {
const khodamHewan = [
"Harimau Putih",
"Harimau Sumatra",
"Garuda",
"Kuda Sembrani",
"Naga Cina",
"Naga Merah",
"Elang Jawa",
"Airavata (Gajah)",
"Ganesha (Gajah)",
"Macan Tutul Jawa",
"Singa",
"Kucing Hitam",
"Burung Hantu",
"Serigala",
"Rubah",
"Kupu-Kupu",
"Gagak",
"Buaya",
"Ikan Koi",
"Naga Air",
"Paus",
"Dolphin (Lumba-Lumba)",
"Merak",
"Kura-Kura",
"Gajah Afrika",
"Banteng",
"Kijang",
"Lebah",
"Singa Putih",
"Burung Phoenix",
"Kuda Laut",
"Hiu",
"Kelelawar",
"Jaguar",
"Merpati",
"Beruang",
"Ular",
"Rajawali",
"Panda",
"Koala",
"Laba-Laba",
"Cheetah",
"Orca (Paus Pembunuh)",
"Flamingo",
"Kucing Siam",
"Antelope",
"Anjing Laut",
"Hamster",
"Penguin",
"Zebra",
"Kuda Nil",
"Penyu",
"Gorila",
"Babi Hutan",
"Rusa",
"Burung Kenari",
"Burung Elang",
"Katak",
"Komodo",
"Anjing Siberian Husky",
"Buaya Nil",
"Gagak Hitam",
"Ikan Pari",
"Beruang Kutub",
"Kelinci",
"Jangkrik",
"Burung Cendrawasih",
"Bunglon",
"Banteng Liar",
"Kuda Liar",
"Kucing Persia",
"Sapi",
"Ayam Jantan",
"Itik",
"Gajah India",
"Gus Penceng",
];
const inputField = document.getElementById("khodamInput");
function checkKhodam() {
const inputName = inputField.value.trim();
if (inputName) {
const randomKhodam =
khodamHewan[Math.floor(Math.random() * khodamHewan.length)];
Swal.fire({
title: "Khodam Ditemukan!",
html: `<b>${inputName}</b> memiliki khodam: <b>${randomKhodam}</b>`,
confirmButtonText: "Selesai Cek Khodam",
confirmButtonColor: "#202020",
});
inputField.value = "";
} else {
Swal.fire({
title: "Kesalahan",
text: "Harap masukkan nama.",
confirmButtonText: "Done",
confirmButtonColor: "#202020",
});
}
}
document.getElementById("checkButton").addEventListener("click", checkKhodam);
inputField.addEventListener("keypress", function (event) {
if (event.key === "Enter") {
checkKhodam();
}
});
});