-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
121 lines (113 loc) · 4.51 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
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="css/index.css">
</head>
<body>
<div id="highscore"><button id="clsboard"> X </button>
<div id="stt">
<h5 style="color:#F37878;text-align: center;font-family: 'Righteous';font-weight: bolder;"> Highscore </h5>
</div>
<h3 id="yoursc"> </h3>
</div>
<div id="about" style="display: none;">
<div style="width: 55%; text-align: left;">
<h5 style = "font-weight: bolder;"> SƠ YẾU LÝ LỊCH</h5> <br>
<ul class = "abtMay">💛 Tên: Mây 2 lằn</ul>
<ul class = "abtMay">💛 Giới tính: Nam </ul>
<ul class = "abtMay">💛 Sở thích: Cắn người </ul>
<ul class = "abtMay">💛 Sợ: Mọi thứ, trừ con người </ul><br>
<button id="clsabout" onclick="abtme(0)"> ĐÓNG </button>
</div>
</div>
<div id="htp" style="display: none;">
<h5> CÁCH CHƠI </h5>
<ul class = "abtMay"> Mây đang ngủ, những ai đã từng bị nó cắn hãy nhân cơ hội này đánh nó thật nhanh. <br> Nếu đánh vào lúc nó tỉnh dậy, nó sẽ cắn bạn đấy</ul><br>
<button id="clsabout" onclick="htp(0)"> ĐÓNG </button>
</div>
<div id="maindiv">
<div class="wavy">
<h1>
<span style="--i:1">P</span>
<span style="--i:2">L</span>
<span style="--i:3">A</span>
<span style="--i:4">Y</span>
<span style="--i:5"> </span>
<span style="--i:6">M</span>
<span style="--i:7">Â</span>
<span style="--i:8">Y</span>
</h1>
</div>
<h4> "Đừng Play Together, hãy Play Mây" </h4><br>
<button class="btnhome" onclick="abtme(1)"> Mây là ai ? </button>
<button onclick="htp(1)" class="btnhome"> Cách chơi </button>
<button id = "opboard" class = "btnhome"> Highscore </button>
<button class="btnhome" onclick=" location.href='play.html'"> Bắt đầu </button>
</div>
<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/9.6.11/firebase-app.js";
import { getDatabase, ref, set, get, child, query, orderByValue } from "https://www.gstatic.com/firebasejs/9.6.11/firebase-database.js";
const firebaseConfig = {
apiKey: "AIzaSyBzKuL5L1QPydOXN6aey3GsycNZJLkj5vY",
authDomain: "playmay.firebaseapp.com",
databaseURL: "https://playmay-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "playmay",
storageBucket: "playmay.appspot.com",
messagingSenderId: "224075999052",
appId: "1:224075999052:web:85d3bd0abbbde2b308d1e9"
};
const app = initializeApp(firebaseConfig);
const db = getDatabase(app);
const dbRef = ref(getDatabase(app));
var divboard = document.getElementById("highscore"), tmpdata,
sttt = document.getElementById("stt");
function loadboard() {
tmpdata = [];
get(child(dbRef, 'users/')).then((snapshot) => {
if (snapshot.exists()) {
Object.keys(snapshot.val()).forEach((key) => {
tmpdata.push({'User':key, 'Score': snapshot.val()[key].score});
});
tmpdata.sort(function(a, b){return b.Score - a.Score});
var cnt = 1;
for (let i of tmpdata) {
var tagg = document.createElement("h3");
tagg.className="nameboard";
tagg.innerHTML = cnt + ". "+i.User + " 💜 " + i.Score + " điểm";
sttt.appendChild(tagg);
cnt++;
}
} else {
console.log("No data available");
}
}).catch((error) => {
console.error(error);
});
}
document.getElementById('opboard').addEventListener('click', openboard);
document.getElementById('clsboard').addEventListener('click', closeboard);
function closeboard() {
document.getElementById("highscore").style.display = 'none';
}
function openboard() {
document.getElementById("highscore").style.display = 'block';
}
document.addEventListener('click', loadboard, {once: true})
</script>
<script src = "js/homepage.js"></script>
</body>
<footer>
<a class="linkk" href = "https://github.com/camnguyenmeow">
<img src="img/github.svg" class = "icon">
</a>
<a class="linkk" href = "https://www.facebook.com/camnguyenmeow">
<img src="img/facebook.svg" class = "icon">
</a>
<a class="linkk" href = "mailto:[email protected]">
<img src="img/mail.svg" class = "icon">
</a>
<a class="linkk" href = "https://camnguyenmeow.github.io/">
<img src="img/web.svg" class = "icon">
</a>
</footer>
</html>