diff options
author | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2024-05-13 16:31:27 +0200 |
---|---|---|
committer | Mischa Untaga <99098079+MischaU8@users.noreply.github.com> | 2024-05-13 16:31:27 +0200 |
commit | b85e8f9ad08399e22445248ffe8703e6de7fe5a2 (patch) | |
tree | 65ec535e53fcc725d45dd7d4e7e65e3447655b1c | |
parent | 823d71519cd776ece9e89729774e4132fbcd6fe0 (diff) | |
download | votes-for-women-master.tar.gz |
-rw-r--r-- | play.js | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -503,13 +503,6 @@ function build_user_interface() { create_campaigner('red2', 6), ] - for (let i = 0; i < 190; ++i) { - elt = ui.cubes[i] = create("div", { - className: `piece cube`, - onmousedown: on_click_cube, - }) - } - for (let i = 0; i < green_check_count; ++i) { elt = ui.green_checks[i] = create("div", { className: `piece yes`, @@ -826,6 +819,12 @@ function on_update() { // eslint-disable-line no-unused-vars function place_cubes(state_cubes, us_state, count, color) { let others = colors.filter(c => c !== color) for (let c = 0; c < count; ++c) { + if (cube_idx >= ui.cubes.length) { + ui.cubes[cube_idx] = create("div", { + className: `piece cube`, + onmousedown: on_click_cube, + }) + } e = ui.cubes[cube_idx++] e.my_us_state = us_state e.my_cube_color = color |