-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathindex.html
executable file
·230 lines (200 loc) · 9.16 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
<!doctype>
<html>
<head>
<title>💥</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Font Awesome -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
<!-- Bootstrap core CSS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<!-- Material Design Bootstrap -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.8.7/css/mdb.min.css" rel="stylesheet">
<!--Intro JS -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/intro.js/2.9.3/introjs.css" rel="stylesheet">
<!--Element specific styles -->
<link href="assets/css/style.css" rel="stylesheet">
</head>
<body class="grey lighten-5">
<!-- As a heading -->
<header>
<!--Navbar -->
<nav class="mb-1 navbar navbar-expand-lg navbar-dark info-color">
<a class="navbar-brand" href="#">MineSweeper</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent-4" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item active">
<a class="nav-link" href="https://github.com/mayankrajendrat/minesweeper">
<i class="fab fa-github"></i> github
<span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/mayankrajendrat/minesweeper/blob/master/README.md">
<i class="fas fa-info-circle"></i> Info</a>
</li>
</ul>
</div>
</nav>
<!--/.Navbar -->
</header>
<main>
<div class="container-fluid mt-2">
<section>
<!-- Grid row -->
<div class="row justify-content-md-center">
<!-- Grid column -->
<div class="col-lg-4 col-md-6 mb-4">
<div class="card panels-card wrapper">
<div class="rounded-top grey lighten-2 dark-grey-text row ml-0 mr-0">
<div class="col-12">
<ul class="list-inline float-center my-0 py-1 pr-3">
<li class="list-inline-item">
<button type="button" class="action-btn js-new-game btn btn-default btn-lg btn-block"
aria-label="New game" data-intro='Reset Game!' data-step=1>
<span class="default-emoji"></span>
<span id="result" class="result-emoji"></span>
</button>
</li>
</ul>
</div>
</div>
<!--Navbar-->
<nav
class="navbar navbar-expand-lg navbar-dark grey lighten-5 d-flex justify-content-between z-depth-1-bottom">
<div>
<ul class="list-inline my-2 py-1 dark-grey-text" data-intro='Game Timer' data-step=2>
<li class="list-inline-item">
<i class="fas fa-clock"></i>
</li>
<li class="list-inline-item font-weight-bold text-uppercase">
<div id="timer"></div>
</li>
</ul>
</div>
<div>
<ul class="list-inline my-2 py-1 dark-grey-text">
<li class="list-inline-item" data-intro='Number of hidden Bombs available in game' data-step=3>
<i class="fas fa-bomb" aria-hidden="true"></i>
<span id="bombs-left">0</span>
</li>
<li class="list-inline-item" data-intro='Number of moves taken by player' data-step=4>
<i class="fas fa-arrows-alt" aria-hidden="true"></i>
<span id="moves"></span><span> Move(s)</span>
</li>
<li class="list-inline-item">
<button type="button" class="settings js-settings" aria-haspopup="true" aria-expanded="false"
data-toggle="modal" data-target="#settingModal" aria-label="Settings"
data-intro='Customize game settings based on preference.' data-step=5>
<i class="fas fa-cogs"></i>
</button>
</li>
</ul>
</div>
</nav>
<!--/.Navbar-->
<div class="card-body grey lighten-5 rounded-bottom">
<!-- Grid row -->
<div class="row">
<div class="col-12 p-1">
<div id="map" role="grid" aria-label="Mine field" data-intro='Mine Field' data-step=6>
</div>
</div>
<!-- Grid column -->
</div>
<!-- Grid row -->
</div>
<!-- Card footer -->
<div class="card-footer text-muted text-center mt-4" data-intro='Field information based on player moves.'
data-step=7>
<div aria-live="assertive"><i class="fas fa-info-circle"></i> <span class="feedback"></span> </div>
</div>
</div>
<!-- Card -->
</div>
<!-- Grid column -->
</div>
<!-- Grid row -->
</section>
</div>
</main>
<!-- Setting Modal -->
<div class="modal fade" id="settingModal" tabindex="-1" role="dialog" aria-labelledby="settingModalTitle"
aria-hidden="true">
<!-- Add .modal-dialog-centered to .modal-dialog to vertically center the modal -->
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="settingModalTitle">Game Setting</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="js-settings-popup grey lighten-5">
<form class="text-center border border-light p-3" action="#!">
<div class="form-row mb-4">
<div class="col">
<!-- No. of Columns -->
<input type="number" value="10" min="1" max="500" aria-label="Columns" id="cols"
class="form-control" />
</div>
<span class="align-middle mt-3"><i class="fas fa-times"></i></span>
<div class="col">
<!-- No. of Rows -->
<input type="number" value="10" min="1" max="500" aria-label="Rows" id="rows" class="form-control">
</div>
</div>
<!-- No. of Bombs -->
<div class="prepend-input">💣</div>
<input id="bombs" class="form-control mb-4" type="number" value="10" min="1" max="2500"
aria-label="Number of bombs">
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary js-popup-new-game" data-dismiss="modal">Save and restart
game</button>
</div>
</div>
</div>
</div>
<!-- JQuery -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Bootstrap tooltips -->
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.4/umd/popper.min.js"></script>
<!-- Bootstrap core JavaScript -->
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
<!-- MDB core JavaScript -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mdbootstrap/4.8.7/js/mdb.min.js"></script>
<!-- Intro.js Step-by-step guide and feature introduction -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/intro.js/2.9.3/intro.min.js"></script>
<!-- Twitter Emoji Icons -->
<script src="assets/js/twemoji.js"></script>
<!-- Javscript Logic -->
<script src="assets/js/game.js"></script>
<script>
var emojiset = ['⭕️', '💣', '🚩', '◻️'];
var cols = document.getElementById('cols')
var rows = document.getElementById('rows')
var bombs = document.getElementById('bombs')
game = new mineSweeper(cols.value, rows.value, bombs.value, emojiset, true)
document.querySelector('.js-new-game').addEventListener('click', restart)
document.querySelector('.js-popup-new-game').addEventListener('click', restart)
introJs().start();
function restart() {
clearInterval(game.timer)
game = new mineSweeper(cols.value, rows.value, bombs.value, emojiset, true)
game.updateFeedback('Game restarted');
return false
}
</script>
</body>
</html>