kramp HF staff commited on
Commit
644c4fc
1 Parent(s): 1b2afe2

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +25 -11
index.html CHANGED
@@ -8,17 +8,31 @@
8
  </head>
9
  <body>
10
  <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>
13
- You can modify this app directly by editing <i>index.html</i> in the
14
- Files and versions tab.
15
- </p>
16
- <p>
17
- Also don't forget to check the
18
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank"
19
- >Spaces documentation</a
20
- >.
21
- </p>
 
 
 
 
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>