Spaces:
Running
Running
preload
Browse files- index.html +43 -0
index.html
CHANGED
|
@@ -6,8 +6,51 @@
|
|
| 6 |
<title>Reachy Mini - Pollen Robotics</title>
|
| 7 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 8 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
|
|
| 9 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 10 |
<link rel="stylesheet" href="style.css">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
</head>
|
| 12 |
<body>
|
| 13 |
<!-- Login View -->
|
|
|
|
| 6 |
<title>Reachy Mini - Pollen Robotics</title>
|
| 7 |
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 8 |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 9 |
+
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
|
| 10 |
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
| 11 |
<link rel="stylesheet" href="style.css">
|
| 12 |
+
<!-- Kick off both JS modules during HTML parse so they're in flight
|
| 13 |
+
before the bottom-of-body <script> executes. The embed entry
|
| 14 |
+
pulls two hashed chunks of its own which we can't preload
|
| 15 |
+
(the hashes drift across SDK releases), but front-loading the
|
| 16 |
+
two top-level modules still shaves ~hundreds of ms off a cold
|
| 17 |
+
CDN edge. -->
|
| 18 |
+
<link rel="modulepreload" href="https://cdn.jsdelivr.net/gh/pollen-robotics/reachy_mini@v1.7.2/js/reachy-mini.js" crossorigin>
|
| 19 |
+
<link rel="modulepreload" href="https://cdn.jsdelivr.net/npm/@pollen-robotics/reachy-mini-sdk@1.7.3-main.b44388c/host/dist/entry/embed.js" crossorigin>
|
| 20 |
+
<!-- Inline pre-paint script: if we're loaded as an iframe embed,
|
| 21 |
+
flip the DOM directly to the connected-shell view + a
|
| 22 |
+
"Connecting…" status pill BEFORE the JS module starts
|
| 23 |
+
running. Skips the visual flash of the Sign-in button while
|
| 24 |
+
connectToHost is busy doing its OAuth round-trip + WebRTC
|
| 25 |
+
handshake (which can be 3-8 s on a cold network). The script
|
| 26 |
+
runs after </head> only because the elements it touches are
|
| 27 |
+
in <body>; the cost of moving this script to a `defer="false"`
|
| 28 |
+
block at the start of <body> is one DOM-ready paint that we
|
| 29 |
+
already pay for. -->
|
| 30 |
+
<script>
|
| 31 |
+
(function () {
|
| 32 |
+
try {
|
| 33 |
+
const params = new URLSearchParams(window.location.search);
|
| 34 |
+
if (params.get('embedded') !== '1') return;
|
| 35 |
+
// Defer the DOM mutations until after the elements
|
| 36 |
+
// exist (we're parsed before <body>). DOMContentLoaded
|
| 37 |
+
// fires once the body is done parsing — cheap, no UX
|
| 38 |
+
// cost vs. the seconds-long connectToHost.
|
| 39 |
+
document.addEventListener('DOMContentLoaded', function () {
|
| 40 |
+
const login = document.getElementById('loginView');
|
| 41 |
+
const main = document.getElementById('mainApp');
|
| 42 |
+
const statusText = document.getElementById('statusText');
|
| 43 |
+
const statusIndicator = document.getElementById('statusIndicator');
|
| 44 |
+
if (login) login.classList.add('hidden');
|
| 45 |
+
if (main) main.classList.remove('hidden');
|
| 46 |
+
if (statusIndicator) statusIndicator.className = 'status-indicator connecting';
|
| 47 |
+
if (statusText) statusText.textContent = 'Connecting…';
|
| 48 |
+
});
|
| 49 |
+
} catch (e) {
|
| 50 |
+
// Best-effort UX polish — never block boot.
|
| 51 |
+
}
|
| 52 |
+
})();
|
| 53 |
+
</script>
|
| 54 |
</head>
|
| 55 |
<body>
|
| 56 |
<!-- Login View -->
|