Download htmlrunner.html from Cyranicus/games: direct link, hf CLI and curl.
- Browser
- Download file 2.19 kB
-
https://huggingface.co/spaces/Cyranicus/games/resolve/main/htmlrunner.html
- Command line
-
hf download hf://spaces/Cyranicus/games/htmlrunner.html
-
curl -L -o htmlrunner.html https://huggingface.co/spaces/Cyranicus/games/resolve/main/htmlrunner.html
2.19 kB
| <html> | |
| <head> | |
| <title>Just A Test</title> | |
| <style> | |
| body: { | |
| background-color: white; | |
| } | |
| </style> | |
| <script> | |
| function handleFileSelect(event) { | |
| const file = event.target.files[0]; | |
| const reader = new FileReader(); | |
| reader.onload = function(e) { | |
| const htmlContent = e.target.result; | |
| const iframe = document.getElementById('output'); | |
| iframe.srcdoc = htmlContent; | |
| }; | |
| reader.readAsText(file); | |
| } | |
| function toggleFullscreen() { | |
| var iframe = document.getElementById('output'); | |
| if (iframe.requestFullscreen) { | |
| if (document.fullscreenElement) { | |
| document.exitFullscreen(); | |
| } else { | |
| iframe.requestFullscreen(); | |
| } | |
| } else if (iframe.mozRequestFullScreen) { // Firefox | |
| if (document.mozFullScreenElement) { | |
| document.mozCancelFullScreen(); | |
| } else { | |
| iframe.mozRequestFullScreen(); | |
| } | |
| } else if (iframe.webkitRequestFullscreen) { // Chrome, Safari, and Opera | |
| if (document.webkitFullscreenElement) { | |
| document.webkitExitFullscreen(); | |
| } else { | |
| iframe.webkitRequestFullscreen(); | |
| } | |
| } else if (iframe.msRequestFullscreen) { // IE/Edge | |
| if (document.msFullscreenElement) { | |
| document.msExitFullscreen(); | |
| } else { | |
| iframe.msRequestFullscreen(); | |
| } | |
| } | |
| } | |
| </script> | |
| </head> | |
| <body> | |
| <h1>Upload and Run HTML File</h1> | |
| <p> | |
| (If it isn't working press TAB) | |
| </p> | |
| <input type="file" accept=".html" onchange="handleFileSelect(event)"><br><button onclick="toggleFullscreen()">Toggle Fullscreen</button> | |
| <br> | |
| <iframe id="output" width="100%" height="1000px"></iframe> | |
| </body> | |
| <script> | |
| document.querySelector('#fileInput').addEventListener('change', handleFile,false) | |
| function handleFile(e){ | |
| var reader = new FileReader; | |
| var file = e.target.files[0] | |
| reader.onload = function(e){ | |
| var csv = e.target.result | |
| // execute chart code in here with | |
| // "csv":{ | |
| // "data-string": csv, | |
| // ... | |
| // } | |
| } | |
| reader.readAsText(file); | |
| } | |
| </script> | |
| </html> | |