Molbap HF Staff commited on
Commit
043c506
·
verified ·
1 Parent(s): a401539

Upload index.html

Browse files
Files changed (1) hide show
  1. index.html +18 -7
index.html CHANGED
@@ -8248,15 +8248,22 @@
8248
  }, 50);
8249
  }
8250
 
8251
- // --- Event Listeners ---
8252
- visualizeBtn.addEventListener('click', handleVisualize);
8253
-
8254
- // --- Initial Load ---
8255
- window.addEventListener('load', () => {
 
 
 
 
8256
  addTab('Main', exampleCodeMain, true);
8257
- addTab('Deps', exampleCodeDeps);
8258
  handleVisualize();
8259
- });
 
 
 
8260
  window.addEventListener('resize', () => {
8261
  let allCode = '';
8262
  document.querySelectorAll('#code-inputs-container textarea').forEach(area => {
@@ -8267,6 +8274,10 @@
8267
  }
8268
  });
8269
 
 
 
 
 
8270
  </script>
8271
  </body>
8272
  </html>
 
8248
  }, 50);
8249
  }
8250
 
8251
+ // --- Fetch example code before UI setup ---
8252
+ async function loadAndInit() {
8253
+ const res = await fetch("main_code.py");
8254
+ const res2 = await fetch("dependencies.py");
8255
+
8256
+ exampleCodeMain = await res.text();
8257
+ exampleCodeDeps = await res.text();
8258
+
8259
+ // --- Initial Load (must wait for code) ---
8260
  addTab('Main', exampleCodeMain, true);
8261
+ addTab('Deps', exampleCodeDeps, true);
8262
  handleVisualize();
8263
+ }
8264
+
8265
+ // --- Attach UI event listeners immediately ---
8266
+ visualizeBtn.addEventListener('click', handleVisualize);
8267
  window.addEventListener('resize', () => {
8268
  let allCode = '';
8269
  document.querySelectorAll('#code-inputs-container textarea').forEach(area => {
 
8274
  }
8275
  });
8276
 
8277
+ // --- Start initialization once DOM is ready ---
8278
+ window.addEventListener('load', loadAndInit);
8279
+
8280
+
8281
  </script>
8282
  </body>
8283
  </html>