enableAnswerButton function enabled var buttons game button if enabled

 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
enableAnswerButton = function (enabled) {
var $buttons = $(".game.button");
if (!enabled) {
$buttons.removeClass("on");
$buttons.addClass("off");
} else {
$buttons.removeClass("off");
$buttons.addClass("on");
}
};
enableBankButton = function (enabled) {
var $bankBtn = $(".game.bank_gold, .game.bank_silver");
if (enabled) {
$bankBtn.removeClass("bank_silver");
$bankBtn.addClass("bank_gold");
} else {
$bankBtn.removeClass("bank_gold");
$bankBtn.addClass("bank_silver");
}
};
displayScore = function (bank, costID) {
var $bankBtn = $(".game.bank_gold, .game.bank_silver");
var $costs = $(".game.little_cost_blue, .game.little_cost_red");
$($bankBtn.children("span")[0]).text(bank);
$costs.removeClass("little_cost_red");
$costs.addClass("little_cost_blue");
$($costs[costID]).addClass("little_cost_red");
};
displayBank = function (bank) {
var $bankBtn = $(".game.bank_gold, .game.bank_silver");
$($bankBtn.children("span")[0]).text(bank);
};
displayCost = function (costID) {
var $costs = $(".game.little_cost_blue, .game.little_cost_red");
$costs.removeClass("little_cost_red");
$costs.addClass("little_cost_blue");
$($costs[costID]).addClass("little_cost_red");
};
displayPlayers = function (players) {
var $players = $(".game.player");
$players.each(function (index, elem) {
$(elem).removeClass("gold");
$(elem).addClass("blue");
$($(elem).children("span")[0]).text(players[index]);
})
};
refreshTime = function (t) {};
highlightCurrentPlayer = function (id) {
var $players = $(".game.player");
$players.removeClass("gold");
$players.addClass("blue");
$players.each(function (index, elem) {
if ($($(elem).children("span")[0]).text() == id) {
$(elem).addClass("gold");
}
})
};
displayQuestion = function (quest) {
var $question = $(".game.question");
$question.text(quest);
};
displayAnswers = function (answers) {
var $answers = $(".game.button");
$answers.removeClass("selected correct");
$answers.each(function (index, elem) {
$(elem).text(answers[index]);
})
};
selectAnswer = function (selected) {
var $answers = $(".game.button");
$($answers[selected]).addClass("selected");
};
displayCorrectAndSelectedAnswer = function (selected, correct) {
var $answers = $(".game.button");
$($answers[selected]).addClass("selected");
$($answers[correct]).addClass("correct");
};