File size: 2,189 Bytes
2e30701
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d7b5124
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2e30701
 
 
 
 
 
 
d7b5124
 
2e30701
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d7b5124
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
 <!DOCTYPE html>
<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>