Update static/asic-design-code-generator.html
Browse files
static/asic-design-code-generator.html
CHANGED
|
@@ -215,7 +215,7 @@
|
|
| 215 |
</div>
|
| 216 |
</body>
|
| 217 |
<script>
|
| 218 |
-
|
| 219 |
const descriptionInput = document.getElementById("description");
|
| 220 |
const languageSelect = document.getElementById("target-language");
|
| 221 |
const generateButton = document.querySelector(".btn-primary");
|
|
@@ -225,7 +225,8 @@
|
|
| 225 |
let websocket;
|
| 226 |
|
| 227 |
function connectWebSocket(endpoint) {
|
| 228 |
-
|
|
|
|
| 229 |
websocket.onmessage = (event) => {
|
| 230 |
generatedCodeOutput.textContent = event.data;
|
| 231 |
};
|
|
@@ -253,5 +254,6 @@
|
|
| 253 |
});
|
| 254 |
});
|
| 255 |
|
|
|
|
| 256 |
</script>
|
| 257 |
</html>
|
|
|
|
| 215 |
</div>
|
| 216 |
</body>
|
| 217 |
<script>
|
| 218 |
+
document.addEventListener("DOMContentLoaded", () => {
|
| 219 |
const descriptionInput = document.getElementById("description");
|
| 220 |
const languageSelect = document.getElementById("target-language");
|
| 221 |
const generateButton = document.querySelector(".btn-primary");
|
|
|
|
| 225 |
let websocket;
|
| 226 |
|
| 227 |
function connectWebSocket(endpoint) {
|
| 228 |
+
const protocol = window.location.protocol === "https:" ? "wss://" : "ws://";
|
| 229 |
+
websocket = new WebSocket(`${protocol}${window.location.host}${endpoint}`);
|
| 230 |
websocket.onmessage = (event) => {
|
| 231 |
generatedCodeOutput.textContent = event.data;
|
| 232 |
};
|
|
|
|
| 254 |
});
|
| 255 |
});
|
| 256 |
|
| 257 |
+
|
| 258 |
</script>
|
| 259 |
</html>
|