3 // Log with deep clone, so that the browser will show the object at time of log,
4 // instead of what it looks like at time of view.
8 for (const arg of arguments) {
9 args.push(JSON.parse(JSON.stringify(arg)));
14 function addheading(carousel, colspan, content)
16 let thead = document.createElement("thead");
17 let tr = document.createElement("tr");
18 let th = document.createElement("th");
19 th.innerHTML = content;
20 th.setAttribute("colspan", colspan);
22 thead.appendChild(tr);
23 carousel.appendChild(thead);
26 function addtd(tr, className, content) {
27 let td = document.createElement("td");
28 td.appendChild(document.createTextNode(content));
29 td.className = className;
33 function addth(tr, className, content) {
34 let th = document.createElement("th");
35 th.appendChild(document.createTextNode(content));
36 th.className = className;
40 function subrank_partitions(games, parts, start_rank, tiebreakers, func) {
42 for (let i = 0; i < parts.length; ++i) {
43 let part = func(games, parts[i], start_rank, tiebreakers);
44 for (let j = 0; j < part.length; ++j) {
47 start_rank += part.length;
52 function partition(teams, compare)
57 let curr_part = [teams[0]];
58 for (let i = 1; i < teams.length; ++i) {
59 if (compare(teams[i], curr_part[0]) != 0) {
60 parts.push(curr_part);
63 curr_part.push(teams[i]);
65 if (curr_part.length != 0) {
66 parts.push(curr_part);
71 function explain_tiebreaker(parts, rule_name)
74 for (let i = 0; i < parts.length; ++i) {
75 result.push(parts[i].map(function(x) { return x.shortname; }).join("/"));
77 return result.join(" > ") + " (" + rule_name + ")";
80 function make_teams_to_idx(teams)
82 let teams_to_idx = [];
83 for (let i = 0; i < teams.length; i++) {
84 teams_to_idx[teams[i].name] = i;
85 teams_to_idx[teams[i].mediumname] = i;
86 teams_to_idx[teams[i].shortname] = i;
91 function partition_by_beat(teams, fill_beatmatrix)
93 // Head-to-head score by way of components. First construct the beat matrix.
95 let beat = new Array(n);
96 let teams_to_idx = make_teams_to_idx(teams);
97 for (let i = 0; i < n; i++) {
98 beat[i] = new Array(n);
99 for (let j = 0; j < n; j++) {
103 fill_beatmatrix(beat, teams_to_idx);
104 // Floyd-Warshall for transitive closure.
105 for (let k = 0; k < n; ++k) {
106 for (let i = 0; i < n; ++i) {
107 for (let j = 0; j < n; ++j) {
108 if (beat[i][k] && beat[k][j]) {
115 // See if we can find any team that is comparable to all others.
116 for (let pivot_idx = 0; pivot_idx < n; pivot_idx++) {
117 let incomparable = false;
118 for (let i = 0; i < n; ++i) {
119 if (i != pivot_idx && beat[pivot_idx][i] == 0 && beat[i][pivot_idx] == 0) {
125 // Split the teams into three partitions:
126 let better_than_pivot = [], equal = [], worse_than_pivot = [];
127 for (let i = 0; i < n; ++i) {
128 let we_beat = (beat[pivot_idx][i] == 1);
129 let they_beat = (beat[i][pivot_idx] == 1);
130 if ((i == pivot_idx) || (we_beat && they_beat)) {
131 equal.push(teams[i]);
132 } else if (we_beat && !they_beat) {
133 worse_than_pivot.push(teams[i]);
134 } else if (they_beat && !we_beat) {
135 better_than_pivot.push(teams[i]);
137 console.log("this shouldn't happen");
141 if (better_than_pivot.length > 0) {
142 result = partition_by_beat(better_than_pivot, fill_beatmatrix);
144 result.push(equal); // Obviously can't be partitioned further.
145 if (worse_than_pivot.length > 0) {
146 result = result.concat(partition_by_beat(worse_than_pivot, fill_beatmatrix));
152 // No usable pivot was found, so the graph is inherently
153 // disconnected, and we cannot partition it.
157 // Takes in an array, gives every element a rank starting with 1, and returns.
158 function rank(games, teams, start_rank, tiebreakers) {
159 if (teams.length <= 1) {
160 // Only one team, so trivial.
161 teams[0].rank = start_rank;
165 // Rule #0: Partition the teams by score.
166 let score_parts = partition(teams, function(a, b) { return b.pts - a.pts });
167 if (score_parts.length > 1) {
168 return subrank_partitions(games, score_parts, start_rank, tiebreakers, rank);
171 // Rule #1: Head-to-head wins.
172 let num_relevant_games = 0;
173 let beat_parts = partition_by_beat(teams, function(beat, teams_to_idx) {
174 for (let i = 0; i < games.length; ++i) {
175 let idx1 = teams_to_idx[games[i].name1];
176 let idx2 = teams_to_idx[games[i].name2];
177 if (idx1 !== undefined && idx2 !== undefined) {
178 if (games[i].score1 > games[i].score2) {
179 beat[idx1][idx2] = 1;
180 ++num_relevant_games;
181 } else if (games[i].score1 < games[i].score2) {
182 beat[idx2][idx1] = 1;
183 ++num_relevant_games;
188 if (beat_parts.length > 1) {
189 tiebreakers.push(explain_tiebreaker(beat_parts, 'head-to-head'));
190 return subrank_partitions(games, beat_parts, start_rank, tiebreakers, rank);
193 // Rule #2: Number of games played (fewer is better).
194 // Actually the rule says “fewest losses”, but fewer games is equivalent
195 // as long as teams have the same amount of points and ties don't exist.
196 let nplayed_parts = partition(teams, function(a, b) { return a.nplayed - b.nplayed });
197 if (nplayed_parts.length > 1) {
198 tiebreakers.push(explain_tiebreaker(nplayed_parts, 'fewer losses'));
199 return subrank_partitions(games, nplayed_parts, start_rank, tiebreakers, rank);
202 // Rule #3: Head-to-head goal difference (if all have played).
203 let teams_to_idx = make_teams_to_idx(teams);
204 if (num_relevant_games >= teams.length * (teams.length - 1) / 2) {
205 for (let i = 0; i < teams.length; i++) {
207 teams[i].h2h_goals = 0;
209 for (let i = 0; i < games.length; ++i) {
210 let idx1 = teams_to_idx[games[i].name1];
211 let idx2 = teams_to_idx[games[i].name2];
212 if (idx1 !== undefined && idx2 !== undefined &&
213 !isNaN(games[i].score1) && !isNaN(games[i].score2)) {
214 teams[idx1].h2h_gd += games[i].score1;
215 teams[idx1].h2h_gd -= games[i].score2;
216 teams[idx2].h2h_gd += games[i].score2;
217 teams[idx2].h2h_gd -= games[i].score1;
219 teams[idx1].h2h_goals += games[i].score1;
220 teams[idx2].h2h_goals += games[i].score2;
223 let h2h_gd_parts = partition(teams, function(a, b) { return b.h2h_gd - a.h2h_gd });
224 if (h2h_gd_parts.length > 1) {
225 tiebreakers.push(explain_tiebreaker(h2h_gd_parts, 'head-to-head goal difference'));
226 return subrank_partitions(games, h2h_gd_parts, start_rank, tiebreakers, rank);
230 // Rule #4: Goal difference against common opponents.
232 for (let i = 0; i < games.length; ++i) {
233 if (results[games[i].name1] === undefined) {
234 results[games[i].name1] = {};
236 if (results[games[i].name2] === undefined) {
237 results[games[i].name2] = {};
239 results[games[i].name1][games[i].name2] = [ games[i].score1, games[i].score2 ];
240 results[games[i].name2][games[i].name1] = [ games[i].score2, games[i].score1 ];
242 let gd_parts = partition_by_beat(teams, function(beat, teams_to_idx) {
243 for (const team_i of Object.keys(teams_to_idx)) {
244 let i = teams_to_idx[team_i];
245 for (const team_j of Object.keys(teams_to_idx)) {
246 let j = teams_to_idx[team_j];
247 let results_i = results[team_i], results_j = results[team_j];
248 let gd_i = 0, gd_j = 0;
250 // See if the two teams have both played a third team k.
251 for (let k in results_i) {
252 if (!results_i.hasOwnProperty(k)) continue;
253 if (results_j !== undefined && results_j[k] !== undefined) {
254 gd_i += results_i[k][0] - results_i[k][1];
255 gd_j += results_j[k][0] - results_j[k][1];
261 } else if (gd_i < gd_j) {
267 if (gd_parts.length > 1) {
268 tiebreakers.push(explain_tiebreaker(gd_parts, 'goal difference versus common opponents'));
269 return subrank_partitions(games, gd_parts, start_rank, tiebreakers, rank);
272 // Rule #5: Head-to-head scored goals (if all have played).
273 if (num_relevant_games >= teams.length * (teams.length - 1) / 2) {
274 let h2h_goals_parts = partition(teams, function(a, b) { return b.h2h_goals - a.h2h_goals });
275 if (h2h_goals_parts.length > 1) {
276 tiebreakers.push(explain_tiebreaker(h2h_goals_parts, 'head-to-head scored goals'));
277 return subrank_partitions(games, h2h_goals_parts, start_rank, tiebreakers, rank);
281 // Rule #6: Goals scored against common opponents.
282 let goals_parts = partition_by_beat(teams, function(beat, teams_to_idx) {
283 for (const team_i of Object.keys(teams_to_idx)) {
284 let i = teams_to_idx[team_i];
285 for (const team_j of Object.keys(teams_to_idx)) {
286 let j = teams_to_idx[team_j];
287 let results_i = results[team_i], results_j = results[team_j];
288 let goals_i = 0, goals_j = 0;
290 // See if the two teams have both played a third team k.
291 for (let k in results_i) {
292 if (!results_i.hasOwnProperty(k)) continue;
293 if (results_j !== undefined && results_j[k] !== undefined) {
294 goals_i += results_i[k][0];
295 goals_j += results_j[k][0];
299 if (goals_i > goals_j) {
301 } else if (goals_i < goals_j) {
307 if (goals_parts.length > 1) {
308 tiebreakers.push(explain_tiebreaker(goals_parts, 'goals scored against common opponents'));
309 return subrank_partitions(games, goals_parts, start_rank, tiebreakers, rank);
312 // OK, it's a tie. Give them all the same rank.
314 for (let i = 0; i < teams.length; ++i) {
315 result.push(teams[i]);
316 result[i].rank = start_rank;
321 // Same, but with the simplified rules for ranking thirds. games isn't used and can be empty.
322 function rank_thirds(games, teams, start_rank, tiebreakers) {
323 if (teams.length <= 1) {
324 // Only one team, so trivial.
325 teams[0].rank = start_rank;
329 // Rule #1: Partition the teams by score.
330 let score_parts = partition(teams, function(a, b) { return b.pts - a.pts });
331 if (score_parts.length > 1) {
332 tiebreakers.push(explain_tiebreaker(score_parts, 'most games won'));
333 return subrank_partitions(games, score_parts, start_rank, tiebreakers, rank_thirds);
336 // Rule #2: Goal difference against common opponents.
337 let gd_parts = partition(teams, function(a, b) { return b.gd - a.gd });
338 if (gd_parts.length > 1) {
339 tiebreakers.push(explain_tiebreaker(gd_parts, 'goal difference'));
340 return subrank_partitions(games, gd_parts, start_rank, tiebreakers, rank_thirds);
343 // Rule #3: Goals scored.
344 let goal_parts = partition(teams, function(a, b) { return b.goals - a.goals });
345 if (goal_parts.length > 1) {
346 tiebreakers.push(explain_tiebreaker(goal_parts, 'goals scored'));
347 return subrank_partitions(games, goal_parts, start_rank, tiebreakers, rank_thirds);
350 // OK, it's a tie. Give them all the same rank.
352 for (let i = 0; i < teams.length; ++i) {
353 result.push(teams[i]);
354 result[i].rank = start_rank;
359 function parse_teams_from_spreadsheet(response) {
361 for (let i = 2; response.values[i].length >= 1; ++i) {
363 "name": response.values[i][0],
364 "mediumname": response.values[i][1],
365 "shortname": response.values[i][2],
366 //"tags": response.values[i][3],
377 function parse_games_from_spreadsheet(response, group_name, include_unplayed) {
380 for (i = 0; i < response.values.length; ++i) {
381 if (response.values[i][0] === 'Results') {
387 for ( ; response.values[i] !== undefined && response.values[i].length >= 1; ++i) {
388 if ((response.values[i][2] && response.values[i][3]) || include_unplayed) {
389 let real_group_name = response.values[i][9];
390 if (real_group_name === undefined) {
391 real_group_name = group_name;
394 "name1": response.values[i][0],
395 "name2": response.values[i][1],
396 "score1": parseInt(response.values[i][2]),
397 "score2": parseInt(response.values[i][3]),
398 "streamday": response.values[i][7],
399 "streamtime": response.values[i][8],
400 "group_name": real_group_name
407 function apply_games_to_teams(games, teams)
409 let teams_to_idx = make_teams_to_idx(teams);
410 for (let i = 0; i < games.length; ++i) {
411 let idx1 = teams_to_idx[games[i].name1];
412 let idx2 = teams_to_idx[games[i].name2];
413 if (games[i].score1 === undefined || games[i].score2 === undefined ||
414 isNaN(games[i].score1) || isNaN(games[i].score2) ||
415 idx1 === undefined || idx2 === undefined ||
416 games[i].score1 == games[i].score2) {
419 ++teams[idx1].nplayed;
420 ++teams[idx2].nplayed;
421 teams[idx1].goals += games[i].score1;
422 teams[idx2].goals += games[i].score2;
423 teams[idx1].gd += games[i].score1;
424 teams[idx2].gd += games[i].score2;
425 teams[idx1].gd -= games[i].score2;
426 teams[idx2].gd -= games[i].score1;
427 if (games[i].score1 > games[i].score2) {
428 teams[idx1].pts += 2;
430 teams[idx2].pts += 2;
435 // So that we can just have one team list, and let membership be defined by games.
436 function filter_teams(teams, response)
438 let teams_to_idx = make_teams_to_idx(teams);
439 let games = parse_games_from_spreadsheet(response, 'irrelevant group name', true);
440 for (let i = 0; i < games.length; ++i) {
441 let idx1 = teams_to_idx[games[i].name1];
442 let idx2 = teams_to_idx[games[i].name2];
443 if (idx1 !== undefined) {
444 ++teams[idx1].ngames; // FIXME: shouldn't nplayed be just as good?
446 if (idx2 !== undefined) {
447 ++teams[idx2].ngames;
450 return teams.filter(function(team) { return team.ngames > 0; });
453 function display_group_parsed(teams, games, group_name)
455 document.getElementById('entire-bug').style.display = 'none';
457 apply_games_to_teams(games, teams);
458 let tiebreakers = [];
459 teams = rank(games, teams, 1, tiebreakers);
461 let carousel = document.getElementById('carousel');
462 clear_carousel(carousel);
464 addheading(carousel, 5, "Current standings, " + ultimateconfig['tournament_title'] + "<br />" + group_name);
465 let tr = document.createElement("tr");
466 tr.className = "subfooter";
467 addth(tr, "rank", "");
468 addth(tr, "team", "");
469 addth(tr, "nplayed", "P");
470 addth(tr, "gd", "GD");
471 addth(tr, "pts", "Pts");
472 carousel.appendChild(tr);
475 for (let i = 0; i < teams.length; ++i) {
476 let tr = document.createElement("tr");
478 addth(tr, "rank", teams[i].rank);
479 addtd(tr, "team", teams[i].name);
480 addtd(tr, "nplayed", teams[i].nplayed);
481 addtd(tr, "gd", teams[i].gd.toString().replace(/-/, '−'));
482 addtd(tr, "pts", teams[i].pts);
484 carousel.appendChild(tr);
487 if (tiebreakers.length > 0) {
488 let tie_tr = document.createElement("tr");
489 tie_tr.className = "footer";
490 let td = document.createElement("td");
491 td.appendChild(document.createTextNode("Tiebreaks applied: " + tiebreakers.join(', ')));
492 td.setAttribute("colspan", "5");
493 tie_tr.appendChild(td);
494 carousel.appendChild(tie_tr);
497 let footer_tr = document.createElement("tr");
498 footer_tr.className = "footer";
499 let td = document.createElement("td");
500 td.appendChild(document.createTextNode(ultimateconfig['tournament_footer']));
501 td.setAttribute("colspan", "5");
502 footer_tr.appendChild(td);
503 carousel.appendChild(footer_tr);
505 fade_in_rows(carousel);
507 carousel.style.display = 'table';
510 function fade_in_rows(table)
512 let trs = table.getElementsByTagName("tr");
513 for (let i = 1; i < trs.length; ++i) { // The header already has its own fade-in.
514 if (trs[i].className === "footer") {
515 trs[i].style = "-webkit-animation: fade-in 1.0s ease; -webkit-animation-delay: " + (0.25 * i) + "s; -webkit-animation-fill-mode: both;";
517 trs[i].style = "-webkit-animation: fade-in 2.0s ease; -webkit-animation-delay: " + (0.25 * i) + "s; -webkit-animation-fill-mode: both;";
522 function fade_out_rows(table)
524 let trs = table.getElementsByTagName("tr");
525 for (let i = 0; i < trs.length; ++i) {
526 if (trs[i].className === "footer") {
527 trs[i].style = "-webkit-animation: fade-out 1.0s ease; -webkit-animation-delay: " + (0.125 * i) + "s; -webkit-animation-fill-mode: both;";
529 trs[i].style = "-webkit-animation: fade-out 1.0s ease; -webkit-animation-delay: " + (0.125 * i) + "s; -webkit-animation-fill-mode: both;";
534 function clear_carousel(table)
536 while (table.childNodes.length > 0) {
537 table.removeChild(table.firstChild);
542 let max_list_len = 7;
544 function display_stream_schedule(response, group_name) {
545 let teams = parse_teams_from_spreadsheet(response);
546 let games = parse_games_from_spreadsheet(response, group_name, true);
547 display_stream_schedule_parsed(teams, games, 0);
550 function sort_game_list(games) {
551 games = games.filter(function(game) { return game.streamtime !== undefined && game.streamtime.match(/[0-9]+:[0-9]+/) != null; });
552 games.sort(function(a, b) {
553 if (a.streamday !== b.streamday) {
554 return a.streamday - b.streamday;
557 let m1 = a.streamtime.match(/([0-9]+):([0-9]+)/);
558 let m2 = b.streamtime.match(/([0-9]+):([0-9]+)/);
559 return (m1[1] * 60 + m1[2]) - (m2[1] * 60 + m2[2]);
564 function find_game_start_idx(games) {
565 // Pick out a reasonable place to start the list. We'll show the last
566 // completed match and start from there.
567 let start_idx = games.length - 1;
568 for (let i = 0; i < games.length; ++i) {
569 if (isNaN(games[i].score1) || isNaN(games[i].score2) &&
570 games[i].score1 === games[i].score2) {
575 if (start_idx > 0) start_idx--;
576 if (games.length >= max_list_len) {
577 start_idx = Math.min(start_idx, games.length - max_list_len);
582 function find_num_pages(games) {
583 games = sort_game_list(games);
584 let start_idx = find_game_start_idx(games);
585 return Math.ceil((games.length - start_idx) / max_list_len);
588 function display_stream_schedule_parsed(teams, games, page) {
589 document.getElementById('entire-bug').style.display = 'none';
591 games = sort_game_list(games);
592 let start_idx = find_game_start_idx(games);
594 start_idx += page * max_list_len;
595 if (start_idx >= games.length) {
600 let days = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"];
601 let shortdays = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
602 let today = days[(new Date).getDay()];
604 let covered_days = [];
606 for (let i = start_idx; i < games.length && row_num++ < max_list_len; ++i) {
607 if (i == start_idx || games[i].streamday != games[i - 1].streamday) {
608 covered_days.push(days[games[i].streamday]);
612 let carousel = document.getElementById('carousel');
613 clear_carousel(carousel);
614 addheading(carousel, 3, "Stream schedule, " + ultimateconfig['tournament_title'] + "<br />" + covered_days.join('/') + " (all times CET)");
616 let teams_to_idx = make_teams_to_idx(teams);
618 for (let i = start_idx; i < games.length && row_num < max_list_len; ++i) {
619 let tr = document.createElement("tr");
621 let name1 = teams[teams_to_idx[games[i].name1]].mediumname;
622 let name2 = teams[teams_to_idx[games[i].name2]].mediumname;
624 addtd(tr, "matchup", name1 + "–" + name2);
625 addtd(tr, "group", games[i].group_name);
627 if (!isNaN(games[i].score1) && !isNaN(games[i].score2) &&
628 games[i].score1 !== games[i].score2) {
629 addtd(tr, "streamtime", games[i].score1 + "–" + games[i].score2);
631 let streamtime = games[i].streamtime;
632 let streamday = days[games[i].streamday];
633 if (streamday !== today) {
634 streamtime = shortdays[games[i].streamday] + " " + streamtime;
636 addth(tr, "streamtime", streamtime);
640 carousel.appendChild(tr);
643 fade_in_rows(carousel);
645 carousel.style.display = 'table';
648 function get_group(group_name, cb)
650 let req = new XMLHttpRequest();
651 req.onload = function(e) {
652 cb(JSON.parse(req.responseText), group_name);
654 req.open('GET', 'https://sheets.googleapis.com/v4/spreadsheets/' + ultimateconfig['score_sheet_id'] + '/values/\'' + group_name + '\'!A1:J50?key=' + ultimateconfig['api_key']);
658 function showgroup(group_name)
660 get_group(group_name, function(response, group_name) {
661 let teams = parse_teams_from_spreadsheet(response);
662 let games = parse_games_from_spreadsheet(response, group_name, false);
663 teams = filter_teams(teams, response);
664 display_group_parsed(teams, games, group_name);
665 publish_group_rank(response, group_name); // Update the spreadsheet in the background.
670 function showgroup_from_state()
672 showgroup(state['group_name']);
675 let carousel_timeout = null;
679 fade_out_rows(document.getElementById('carousel'));
682 function showschedule(page)
688 let cb = function(response, group_name) {
689 teams = teams.concat(parse_teams_from_spreadsheet(response));
690 games = games.concat(parse_games_from_spreadsheet(response, group_name, true));
691 if (--num_left == 0) {
692 display_stream_schedule_parsed(teams, games, 0);
696 get_group('Group A', cb);
697 get_group('Group B', cb);
698 get_group('Group C', cb);
699 get_group('Playoffs', cb);
700 get_group('Playoffs 9th-13th', cb);
703 function do_series(series)
705 do_series_internal(series, 0);
708 function do_series_internal(series, idx)
711 if (idx + 1 < series.length) {
712 carousel_timeout = setTimeout(function() { do_series_internal(series, idx + 1); }, series[idx][0]);
716 function showcarousel()
718 let teams_per_group = [];
719 let games_per_group = [];
720 let combined_teams = [];
721 let combined_games = [];
724 let cb = function(response, group_name) {
725 let teams = parse_teams_from_spreadsheet(response);
726 let games = parse_games_from_spreadsheet(response, group_name, true);
727 teams = filter_teams(teams, response);
728 teams_per_group[group_name] = teams;
729 games_per_group[group_name] = games;
731 combined_teams = combined_teams.concat(teams);
732 combined_games = combined_games.concat(games);
733 if (--num_left == 0) {
735 [ 13000, function() { display_group_parsed(teams_per_group['Group A'], games_per_group['Group A'], 'Group A'); } ],
736 [ 2000, function() { hidetable(); } ],
737 [ 13000, function() { display_group_parsed(teams_per_group['Group B'], games_per_group['Group B'], 'Group B'); } ],
738 [ 2000, function() { hidetable(); } ],
739 [ 13000, function() { display_group_parsed(teams_per_group['Group C'], games_per_group['Group C'], 'Group C'); } ],
740 [ 2000, function() { hidetable(); } ],
741 [ 13000, function() { display_group_parsed(teams_per_group['Playoffs 9th-13th'], games_per_group['Playoffs 9th-13th'], 'Playoffs 9th–13th'); } ],
742 [ 2000, function() { hidetable(); } ]
744 let num_pages = find_num_pages(combined_games);
745 for (let page = 0; page < num_pages; ++page) {
746 series.push([ 13000, function() { display_stream_schedule_parsed(combined_teams, combined_games, page); } ]);
747 series.push([ 2000, function() { hidetable(); } ]);
754 get_group('Group A', cb);
755 get_group('Group B', cb);
756 get_group('Group C', cb);
757 get_group('Playoffs 9th-13th', cb);
758 get_group('Playoffs', cb);
761 function stopcarousel()
763 if (carousel_timeout !== null) {
765 clearTimeout(carousel_timeout);
766 carousel_timeout = null;
770 function hidescorebug()
772 document.getElementById('entire-bug').style.display = 'none';
775 function showscorebug()
777 document.getElementById('entire-bug').style.display = null;
780 function showmatch2()
782 let css = "-webkit-animation: fade-in 1.0s ease; -webkit-animation-fill-mode: both;";
783 document.getElementById('scorebug2').style = css;
784 document.getElementById('clockbug2').style = css;
787 function hidematch2()
789 let css = "-webkit-animation: fade-out 1.0s ease; -webkit-animation-fill-mode: both;";
790 document.getElementById('scorebug2').style = css;
791 document.getElementById('clockbug2').style = css;
794 function showmatch3()
796 let css = "-webkit-animation: fade-in 1.0s ease; -webkit-animation-fill-mode: both;";
797 document.getElementById('scorebug3').style = css;
798 document.getElementById('clockbug3').style = css;
801 function hidematch3()
803 let css = "-webkit-animation: fade-out 1.0s ease; -webkit-animation-fill-mode: both;";
804 document.getElementById('scorebug3').style = css;
805 document.getElementById('clockbug3').style = css;