DaniFera commited on
Commit
ecd7cf0
verified
1 Parent(s): 144f41f

Create index.html

Browse files
Files changed (1) hide show
  1. index.html +82 -0
index.html ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="es">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Int茅rprete de C贸digo</title>
6
+ <style>
7
+ body, html { margin: 0; padding: 0; height: 100%; font-family: sans-serif; background-color: #f7f7f7; }
8
+ .header { padding: 10px 20px; background-color: #fff; border-bottom: 1px solid #ddd; }
9
+ .header h1 { margin: 0; font-size: 1.5em; }
10
+ .container { display: flex; height: calc(100vh - 55px); }
11
+ .pane { width: 50%; padding: 10px; box-sizing: border-box; display: flex; flex-direction: column; }
12
+ .pane textarea, .pane iframe {
13
+ width: 100%;
14
+ height: 100%;
15
+ border: 1px solid #ccc;
16
+ border-radius: 4px;
17
+ box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
18
+ }
19
+ #runButton {
20
+ display: block;
21
+ width: 100%;
22
+ padding: 12px;
23
+ margin-top: 10px;
24
+ background-color: #007bff;
25
+ color: white;
26
+ border: none;
27
+ border-radius: 4px;
28
+ font-size: 1em;
29
+ cursor: pointer;
30
+ transition: background-color 0.2s;
31
+ }
32
+ #runButton:hover { background-color: #0056b3; }
33
+ </style>
34
+ </head>
35
+ <body>
36
+ <div class="header">
37
+ <h1>Int茅rprete de C贸digo (Docker/FastAPI)</h1>
38
+ </div>
39
+ <div class="container">
40
+ <div class="pane">
41
+ <textarea id="editor" placeholder="Pega tu c贸digo HTML completo aqu铆..."></textarea>
42
+ <button id="runButton">鈻讹笍 Ejecutar</button>
43
+ </div>
44
+ <div class="pane">
45
+ <iframe id="preview"></iframe>
46
+ </div>
47
+ </div>
48
+ <script>
49
+ const editor = document.getElementById('editor');
50
+ const previewFrame = document.getElementById('preview');
51
+ const runButton = document.getElementById('runButton');
52
+
53
+ function updatePreview() {
54
+ const code = editor.value;
55
+ // Escribimos el contenido directamente en el documento del iframe.
56
+ // Esto es m谩s robusto que usar srcdoc para casos complejos.
57
+ const previewDoc = previewFrame.contentDocument || previewFrame.contentWindow.document;
58
+ previewDoc.open();
59
+ previewDoc.write(code);
60
+ previewDoc.close();
61
+ }
62
+
63
+ runButton.addEventListener('click', updatePreview);
64
+
65
+ // Opcional: Cargar un ejemplo inicial
66
+ editor.value = `<!DOCTYPE html>
67
+ <html lang="es">
68
+ <head>
69
+ <title>Ejemplo</title>
70
+ <style>
71
+ body { font-family: sans-serif; background-color: #e0f7fa; display: grid; place-content: center; height: 100vh; margin: 0; }
72
+ h1 { color: #00796b; }
73
+ </style>
74
+ </head>
75
+ <body>
76
+ <h1>隆Escribe tu c贸digo y pulsa Ejecutar!</h1>
77
+ </body>
78
+ </html>`;
79
+ updatePreview();
80
+ </script>
81
+ </body>
82
+ </html>