-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlevelSelection.html
110 lines (96 loc) · 2.64 KB
/
levelSelection.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="jquery-3.2.1.min.js"></script>
<script src="utils/cookies.js"></script>
<script type="text/javascript">
var levelList = [
{name : "showroom", file : "showroom"},
{name : "flower", file : "minisun"},
{name : "another-flower", file : "minisun3"},
{name : "flower-again", file : "minisun2"},
{name : "4", file : "four"}
]
$(document).ready(function(){
var levelName = new URL(window.location.href).searchParams.get("level");
var score = parseInt(new URL(window.location.href).searchParams.get("score"));
if(!checkCookie(levelName))
setCookie(levelName, score);
if(checkCookie(levelName) && parseInt(getCookie(levelName)) < score)
setCookie(levelName, score);
for(var i = 0; i < levelList.length; i++)
{
var a = $("#model a").clone();
if(i > 0 && checkCookie(levelList[i].name))
{
if(levelList[i].name == levelName)
a.html(i + " - " + levelList[i].name + " <span class='score'>" + score + "</span> <span class='highscore'> " + getCookie(levelList[i].name) + "</span>" );
else
a.html(i + " - " + levelList[i].name + " <span class='highscore'> " + getCookie(levelList[i].name) + "</span>" );
}
else
a.html(i + " - " + levelList[i].name);
a.attr("href", "index.html?level="+levelList[i].file);
$("#levels").append(a);
}
})
</script>
<style>
body {
margin: 0;
background-color : black;
}
#levels{
margin : auto;
width : 30%;
margin-top : 50px;
border : solid 3px white;
border-radius : 10px;
}
#levels a{
position : relative;
color : white;
text-decoration : none;
display : block;
font-size : 26px;
text-shadow : 0 0 6px white;
padding : 6px;
}
.score{
position : absolute;
bottom : 6px;
right : 40px;
font-size : 20px;
font-style : italic;
color : green;
text-shadow : 0 0 6px green;
}
.highscore{
position : absolute;
bottom : 6px;
right : 10px;
font-size : 20px;
font-style : italic;
}
#levels a:hover{
background-color : rgba(255, 255, 255, 0.4);
}
h1{
text-align : center;
color : white;
font-size : 3em;
text-shadow : 0 0 12px white;
padding : 6px;
}
</style>
</head>
<body>
<h1>Fourdee Showroom</h1>
<div id="levels">
</div>
<span id="model">
<a href=""></a>
</span>
</body>
</html>