angry-meow commited on
Commit
36c60f7
·
1 Parent(s): 3104c80

char select list fix

Browse files
Files changed (1) hide show
  1. templates/index.html +10 -20
templates/index.html CHANGED
@@ -260,7 +260,7 @@
260
  <div id="characterSelectionArea" style="display:none;">
261
  <h4>Pick your group:</h4>
262
  <div id="selectAllContainer">
263
- <input type="checkbox" id="selectAllRaiders" /> <label for="selectAllRaiders" style="font-weight:bold; display:inline; width: auto; margin-right: 0;">Select/Deselect All</label>
264
  </div>
265
  <div id="characterList" style="max-height: 300px; overflow-y: auto; margin-bottom:15px; display: flex; flex-wrap: nowrap; justify-content: space-between;">
266
  <!-- Character checkboxes will be populated here into three columns -->
@@ -390,34 +390,24 @@
390
  const charsPerColumn = Math.ceil(numCharacters / 3);
391
 
392
  let columns = [[], [], []];
393
- let currentColumn = 0;
394
 
395
  for (let i = 0; i < numCharacters; i++) {
396
- if (columns[currentColumn].length >= charsPerColumn && currentColumn < 2) {
397
- // Ensure we distribute more evenly if the last column would be too small due to Math.ceil
398
- if ( (numCharacters - i) <= ((2-currentColumn) * (charsPerColumn -1)) && charsPerColumn > 1){
399
- // if remaining chars can fit into remaining columns with one less item each, move to next column
400
- } else {
401
- currentColumn++;
402
- }
403
- }
404
- // A more direct way to distribute characters:
405
  if (i < charsPerColumn) {
406
  columns[0].push(data.characters[i]);
407
- } else if (i < 2 * charsPerColumn) {
408
  columns[1].push(data.characters[i]);
409
- } else {
410
  columns[2].push(data.characters[i]);
411
  }
412
  }
413
 
414
- // Re-distribute for better balance if Math.ceil caused imbalance
415
- // This is a common simple distribution method:
416
- columns = [[], [], []]; // Reset columns
417
- for (let i = 0; i < numCharacters; i++) {
418
- columns[i % 3].push(data.characters[i]);
419
- }
420
-
421
 
422
  columns.forEach(columnCharacters => {
423
  const columnDiv = document.createElement('div');
 
260
  <div id="characterSelectionArea" style="display:none;">
261
  <h4>Pick your group:</h4>
262
  <div id="selectAllContainer">
263
+ <input type="checkbox" id="selectAllRaiders" checked/> <label for="selectAllRaiders" style="font-weight:bold; display:inline; width: auto; margin-right: 0;">Select/Deselect All</label>
264
  </div>
265
  <div id="characterList" style="max-height: 300px; overflow-y: auto; margin-bottom:15px; display: flex; flex-wrap: nowrap; justify-content: space-between;">
266
  <!-- Character checkboxes will be populated here into three columns -->
 
390
  const charsPerColumn = Math.ceil(numCharacters / 3);
391
 
392
  let columns = [[], [], []];
393
+ // let currentColumn = 0; // Not needed for this simpler distribution
394
 
395
  for (let i = 0; i < numCharacters; i++) {
396
+ // This logic populates columns downwards alphabetically
 
 
 
 
 
 
 
 
397
  if (i < charsPerColumn) {
398
  columns[0].push(data.characters[i]);
399
+ } else if (i < (charsPerColumn * 2)) { // Fill second column
400
  columns[1].push(data.characters[i]);
401
+ } else { // Fill third column
402
  columns[2].push(data.characters[i]);
403
  }
404
  }
405
 
406
+ // The following block for re-distribution is no longer needed and will be removed.
407
+ // columns = [[], [], []]; // Reset columns
408
+ // for (let i = 0; i < numCharacters; i++) {
409
+ // columns[i % 3].push(data.characters[i]);
410
+ // }
 
 
411
 
412
  columns.forEach(columnCharacters => {
413
  const columnDiv = document.createElement('div');