| 2 | |
| 3 | // Initialize JSON editors when page loads |
| 4 | function initializeJSONEditors(metadata) { |
| 5 | // Initialize metadata JSON editor |
| 6 | const metadataContainer = document.getElementById("metadata-jsoneditor"); |
| 7 | if (metadataContainer) { |
| 8 | const metadataEditor = new JSONEditor(metadataContainer, { |
| 9 | mode: "view", |
| 10 | modes: ["view", "tree"], |
| 11 | name: "metadata", |
| 12 | }); |
| 13 | metadataEditor.set(metadata.results); |
| 14 | } |
| 15 | |
| 16 | // Initialize round results JSON editors |
| 17 | metadata.rounds.forEach((roundData) => { |
| 18 | if (roundData.results) { |
| 19 | const roundContainer = document.getElementById( |
| 20 | `round-${roundData.round_num}-results-jsoneditor`, |
| 21 | ); |
| 22 | if (roundContainer) { |
| 23 | const roundEditor = new JSONEditor(roundContainer, { |
| 24 | mode: "view", |
| 25 | modes: ["view", "tree"], |
| 26 | name: `round_${roundData.round_num}_results`, |
| 27 | }); |
| 28 | roundEditor.set(roundData.results); |
| 29 | } |
| 30 | } |
| 31 | }); |
| 32 | } |