-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
123 lines (112 loc) · 3.96 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
<!DOCTYPE HTML>
<html>
<head>
<title>Simple Word Game</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<header class="container-fluid text-center">
<h1>Simple Word Game</h1>
</header>
<section class="container-fluid">
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
<h3>How to play</h3>
<p>
Enter a word you would like your mate to guess and then hit the <i>New Game</i> button. Simple as that. Have fun.
</p>
</div>
<div class="col-md-3"></div>
</div>
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
<div id="partial">
</div>
</div>
<div class="col-md-3"></div>
</div>
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
<div id="attempts">
</div>
<div id="game" class="btn-group text-center" role="group">
</div>
</div>
<div class="col-md-3"></div>
</div>
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4 text-center">
<div>
<br>
<input class="form-control" type="password" id="word" name="word" placeholder="Type in a word"><br>
<button id="new-game" name="new-game" class="btn btn-primary">New Game</button>
</div>
</div>
<div class="col-md-4"></div>
</div>
</section>
<section>
<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
<div>
<h3>How to use this code</h3>
<p>
This simple website was created to demonstrate some code for the EU Code Week, and let me practise ECMASript 6 as well. Source available <a href="https://github.com/lszlkss/es6-wordgame-practice">@github</a>.
</p>
<p>
Using this code is fairly simple. You can go ahead and clone the git repository or download its content.
</p>
<p>
Take a close look at the code and you will very likely understand what's going on. Side note: you can define your own alphabet in the consctuctor of your class.
</p>
<pre>
<code>
document.getElementById('new-game').addEventListener('click', function() {
const word = document.getElementById('word').value;
const game = new wordGame(word, 10, ['a', 'b', 'c'...]);
game.uiDiv = 'game';
game.partialDiv = 'partial';
game.attemptsDiv = 'attempts';
game.initUI();
});
</code>
</pre>
<h3>Got any questions?</h3>
<p>Feel free to contact me via <a href="mailto:[email protected]">email</a>.</p>
</div>
</div>
<div class="col-md-3"></div>
</div>
</section>
<footer class="container-fluid text-center">
<div class="row">
<div class="col-md-12">
<p>(C) 2016 László Kiss | <a href="https://github.com/lszlkss/es6-wordgame-practice">github</a></p>
</div>
</div>
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/wordgamemodel.js"></script>
<script type="text/javascript" src="js/wordgameview.js"></script>
<script type="text/javascript">
document.getElementById('new-game').addEventListener('click', function() {
const word = document.getElementById('word').value;
const game = new wordGame(word, 10);
game.uiDiv = 'game';
game.partialDiv = 'partial';
game.attemptsDiv = 'attempts';
game.initUI();
});
</script>
</body>
</html>