-
Notifications
You must be signed in to change notification settings - Fork 0
/
judge_ui.js
65 lines (43 loc) · 1.95 KB
/
judge_ui.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
53
54
55
56
57
58
59
60
61
62
63
64
65
/*----------------------------------------------------------------------------------------------------------------------------------*/
function score_entered(judge_ui) {
//judge_ui.input.value = "" + parseFloat(judge_ui.input.value)/10);
var value = parseInt(judge_ui.input.value) / 10;
judge_ui.input.value = value;
judge_ui.performance.judge(judge_ui.judge_i, parseFloat(judge_ui.input.value));
}
/*----------------------------------------------------------------------------------------------------------------------------------*/
judge_ui_new = function (performance, judge_i) {
var judge_ui = {};
judge_ui.performance = performance;
judge_ui.judge_i = judge_i;
judge_ui.input = create_input(judge_ui, "score_entered(this.ui)");
var table = build_input_table("" + (judge_i + 1), judge_ui.input);
// Info
var tr = document.createElement("tr");
var td = document.createElement("td");
judge_ui.info = document.createElement("p");
td.appendChild(judge_ui.info);
tr.appendChild(td);
table.appendChild(tr);
/*--------------------------------------------------------------------------------------------------------------------------------*/
judge_ui.score_updated_f = function(me, performance) {
var message = ""; // + performance.judges[me.judge_i];
var color = "Black";
if (me.judge_i == performance.min_judge) {
message = "LOW";
color = "Red";
}
else if (me.judge_i == performance.max_judge) {
message = "HIGH";
color = "Red";
}
me.info.innerHTML = message;
me.input.style.color = color;
me.info.style.color = color;
}
/*--------------------------------------------------------------------------------------------------------------------------------*/
performance.add_notify_score(judge_ui.score_updated_f, judge_ui);
performance.calculate();
return table;
}
/*----------------------------------------------------------------------------------------------------------------------------------*/