Spaces:
Running
Running
Update index.html
Browse files- index.html +25 -11
index.html
CHANGED
|
@@ -8,17 +8,31 @@
|
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
<div class="card">
|
| 11 |
-
<h1>
|
| 12 |
-
<
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
</body>
|
| 24 |
</html>
|
|
|
|
| 8 |
</head>
|
| 9 |
<body>
|
| 10 |
<div class="card">
|
| 11 |
+
<h1>Space tester</h1>
|
| 12 |
+
<form>
|
| 13 |
+
<fieldset name="urlparams">
|
| 14 |
+
<legend>URL params</legend>
|
| 15 |
+
<div>
|
| 16 |
+
<label>Query params <input name="queryparams" type="text" placeholder="?key=value"></label>
|
| 17 |
+
</div>
|
| 18 |
+
<div>
|
| 19 |
+
<label>Hash <input name="hash" type="text" placeholder="#hash"></label>
|
| 20 |
+
</div>
|
| 21 |
+
<div>
|
| 22 |
+
<button type="button">Update embedder URL</button>
|
| 23 |
+
</div>
|
| 24 |
+
</fieldset>
|
| 25 |
+
</form>
|
| 26 |
</div>
|
| 27 |
+
<script async>
|
| 28 |
+
const urlparams = document.querySelector('[name="urlparams"]');
|
| 29 |
+
urlparams.querySelector('button').addEventListener('click', () => {
|
| 30 |
+
const queryString = urlparams.querySelector('[name="queryparams"]').value;
|
| 31 |
+
const hash = urlparams.querySelector('[name="hash"]').value;
|
| 32 |
+
if(hash || queryString) {
|
| 33 |
+
window.parent.postMessage(JSON.stringify( {hash, queryString }));
|
| 34 |
+
}
|
| 35 |
+
});
|
| 36 |
+
</script>
|
| 37 |
</body>
|
| 38 |
</html>
|