-
Notifications
You must be signed in to change notification settings - Fork 1
/
bossggle.js
52 lines (45 loc) · 1.22 KB
/
bossggle.js
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
//setup letters
var playWord = '';
setupLetters();
setupListeners();
$(document).ready(function() {
var wordArray = [];
$('#submit').on('click', function() {
if (wordArray.indexOf(playWord) != -1) {
Materialize.toast('You already found that word', 3000);
clearWord();
} else if (playWord.length < 3) {
Materialize.toast('Your word must have at least 3 letters', 3000);
clearWord();
} else if (!Word_List.isInList(playWord)) {
Materialize.toast('That\'s not a word we know :-(, try again!', 3000);
clearWord();
} else {
wordArray.push(playWord);
givePoints();
addWord();
clearWord();
}
});
$('#clear').on('click', function() {
clearWord();
});
$('#reset').on('click', function() {
setupLetters(true);
clearWord();
});
// start button
$('#startButton').on('click', function() {
$('#rightColumnStart').hide();
$('#rightColumnGame').hide().removeClass('hide').fadeIn('slow');
startTimer();
});
// play again
$('#reStartButton').on('click', function() {
$('#rightColumnTimeUp').hide();
$('#rightColumnGame').hide().removeClass('hide').fadeIn('slow');
setupLetters();
clearWord();
startTimer();
});
});