generated from NiklasEi/bevy_game_template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
94 lines (84 loc) · 5.29 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="My App">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta id="extViewportMeta" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<title>Trainyard</title> <!-- ToDo -->
<link data-trunk rel="copy-dir" href="assets" />
<link data-trunk rel="copy-dir" href="credits" />
<link data-trunk rel="copy-file" href="build/windows/icon.ico" />
<link rel="manifest" href="manifest.json">
<link rel="icon" href="icon.ico">
<link data-trunk rel="inline" href="build/web/styles.css" />
<link href="https://fonts.googleapis.com/css2?family=Oswald&display=swap" rel="stylesheet">
</head>
<body>
<link data-trunk rel="inline" href="build/web/sound.js" />
<div class="game-container">
<canvas id="bevy" style="
touch-action: none;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
outline: none;
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);">
Javascript and support for canvas is required
</canvas>
</div>
<!-- After 10 seconds on the page, show a static popup div in the middle of the page saying "thanks": -->
<!-- 1. Define the div: -->
<div id="popup_star" class="popup" style="display:none; position:fixed; top:50%; left:50%; transform:translate(-50%, -50%); background-color:rgba(13, 23, 30, 0.85); color:white; padding:20px; border-radius:10px; text-align:center;">
<h2>Thanks for playing Trainyard!</h2>
<p>You can join the <a href="https://discord.gg/umnMwFdA" target="_blank" style="color:rgb(159, 190, 255);">Discord here</a> to discuss about it.</p>
<p>If you like the game, please consider starring the Github Repo
<a href="https://github.com/micoloth" target="_blank" style="color:rgb(159, 190, 255);">here</a>.
<br>
It would mean a lot!
</p>
<div class="close" style="position:absolute; top:5px; right: 5px; height: 40px; width: 40px; padding-top: -50px; cursor:pointer; color:white; background-color:rgba(53, 53, 60, 0.8); font-size:40px;"><div style="margin-top: -15px;">×</div></div>
<div style="height:35px;"></div>
<div class="close" style="position:absolute; bottom:0; left:50%; transform:translate(-50%, 0); padding:10px 15px; margin-bottom:15px; margin-top:15px; color:white; font-size:20px; background-color:rgb(53, 53, 60);">Close</div>
</div>
<div id="popup_timer" class="popup" style="display:none; position:fixed; top:50%; left:50%; transform:translate(-50%, -50%); background-color:rgba(13, 23, 30, 0.85); color:white; padding:20px; border-radius:10px; text-align:center;">
<h2>Remember to not procrastinate too much!</h2>
<p>You probably have work to do... :)</p>
<p>Again, please consider adding a
<a href="https://github.com/micoloth" target="_blank" style="color:rgb(159, 190, 255);">star</a>.
</p>
<div class="close" style="position:absolute; top:5px; right: 5px; height: 40px; width: 40px; padding-top: -50px; cursor:pointer; color:white; background-color:rgba(53, 53, 60, 0.8); font-size:40px;"><div style="margin-top: -15px;">×</div></div>
<div style="height:35px;"></div>
<div class="close" style="position:absolute; bottom:0; left:50%; transform:translate(-50%, 0); padding:10px 15px; margin-bottom:15px; margin-top:15px; color:white; font-size:20px; background-color:rgb(53, 53, 60);">Close</div>
</div>
<!-- 2. Define Javascript logic to show the div after 10 seconds: -->
<script>
// Check if it is the first time the user is on the page:
if (localStorage.getItem("first_time") === null) {
localStorage.setItem("first_time", "false");
setTimeout(function () { document.getElementById("popup_star").style.display = "block"; }, 600000); // 3.3 minutes: 200000
setTimeout(function () { document.getElementById("popup_timer").style.display = "block"; }, 1200000); // 10 minutes: 600000
}
// WHen any of the elements of class "close" is clicked, hide the popup:
var close = document.getElementsByClassName("close");
for (var i = 0; i < close.length; i++) {
close[i].onclick = function () {
var div = this.parentElement;
div.style.display = "none";
}
}
// <!-- 3. Add another logi: when the user clicks anywhere in the page, hide the div: -->
// document.addEventListener("click", function () {
// document.getElementById("popup_star").style.display = "none";
// document.getElementById("popup_timer").style.display = "none";
// }
</script>
</body>
</html>