File size: 1,792 Bytes
ed2a8a4
789e15e
ed2a8a4
d28728d
789e15e
ed2a8a4
789e15e
d28728d
1392f73
789e15e
 
d28728d
 
 
1392f73
 
 
 
 
 
 
 
 
 
d28728d
1392f73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
789e15e
1392f73
 
789e15e
 
d28728d
789e15e
ed2a8a4
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html>
  <head>
    <title>Noda Auto Import</title>
    <script src="https://cdn.noda.io/noda.js"></script>
  </head>

  <body style="font-family: sans-serif; background: #111; color: white;">
    <h2>Waiting for Noda WebAPI…</h2>

    <script>
      const DATA_URL =
        "https://huggingface.co/spaces/RadRuss/BusinessFlowsVR/resolve/main/noda_export.json";

      // Wait for Noda API to appear
      async function waitForNoda() {
        while (typeof window.noda === "undefined") {
          document.body.innerHTML = "<h2>Waiting for Noda WebAPI…</h2>";
          await new Promise(res => setTimeout(res, 500));
        }
        document.body.innerHTML = "<h2>Importing Graph…</h2>";
        return window.noda;
      }

      async function autoImport() {
        const noda = await waitForNoda();

        const resp = await fetch(DATA_URL);
        const data = await resp.json();

        // Create nodes
        for (const node of data.nodes) {
          await noda.createNode({
            uuid: node.id,
            title: node.text || "Node",
            color: node.color || "#66CCFF",
            size: node.size || 1,
            location: {
              x: node.position.x,
              y: node.position.y,
              z: node.position.z,
              relativeTo: "Origin"
            },
            notes: JSON.stringify(node.data || {})
          });
        }

        // Create links
        for (const link of data.links) {
          await noda.createLink({
            uuid: link.id,
            fromUuid: link.source,
            toUuid: link.target,
            title: link.type || ""
          });
        }

        document.body.innerHTML = "<h2>Import completed!</h2>";
      }

      autoImport();
    </script>
  </body>
</html>