|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | +<head> |
| 4 | + <meta charset="UTF-8"> |
| 5 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 6 | + <title>Stratum: Inicio de sesión</title> |
| 7 | + <style> |
| 8 | + body { |
| 9 | + font-family: Arial, sans-serif; |
| 10 | + background-color: #f4f4f4; |
| 11 | + display: flex; |
| 12 | + justify-content: center; |
| 13 | + align-items: center; |
| 14 | + height: 100vh; |
| 15 | + margin: 0; |
| 16 | + } |
| 17 | + |
| 18 | + .container { |
| 19 | + background-color: #fff; |
| 20 | + padding: 20px; |
| 21 | + border-radius: 8px; |
| 22 | + box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); |
| 23 | + max-width: 300px; |
| 24 | + width: 100%; |
| 25 | + text-align: center; |
| 26 | + } |
| 27 | + |
| 28 | + h1 { |
| 29 | + color: #333; |
| 30 | + } |
| 31 | + |
| 32 | + input { |
| 33 | + width: 100%; |
| 34 | + padding: 10px; |
| 35 | + margin: 10px 0; |
| 36 | + border: 1px solid #ccc; |
| 37 | + border-radius: 4px; |
| 38 | + box-sizing: border-box; |
| 39 | + } |
| 40 | + |
| 41 | + button { |
| 42 | + width: 100%; |
| 43 | + padding: 10px; |
| 44 | + background-color: #4CAF50; |
| 45 | + color: white; |
| 46 | + border: none; |
| 47 | + border-radius: 4px; |
| 48 | + cursor: pointer; |
| 49 | + } |
| 50 | + |
| 51 | + button:hover { |
| 52 | + background-color: #45a049; |
| 53 | + } |
| 54 | + |
| 55 | + p { |
| 56 | + margin: 0; |
| 57 | + color: #666; |
| 58 | + } |
| 59 | + </style> |
| 60 | +</head> |
| 61 | +<body> |
| 62 | + <div class="container"> |
| 63 | + <h1>Inicio de sesión</h1> |
| 64 | + <p>Introduce tu nombre de usuario:</p> |
| 65 | + <input type="text" id="username" placeholder="Usuario"> |
| 66 | + <p>Introduce tu contraseña:</p> |
| 67 | + <input type="password" id="password" placeholder="Contraseña"> |
| 68 | + <br><br> |
| 69 | + <button id="backToGame">Confirmar y volver al juego</button> |
| 70 | + </div> |
| 71 | + |
| 72 | + <script> |
| 73 | + document.getElementById("backToGame").addEventListener("click", function() { |
| 74 | + var username = document.getElementById("username").value; |
| 75 | + var password = document.getElementById("password").value; |
| 76 | + |
| 77 | + if (username.trim() === "" || password.trim() === "") { |
| 78 | + alert("Por favor, introduce tanto el nombre de usuario como la contraseña."); |
| 79 | + return; |
| 80 | + } |
| 81 | + |
| 82 | + // Enviar el nombre de usuario y contraseña al juego usando postMessage |
| 83 | + if (window.opener) { |
| 84 | + window.opener.postMessage({ username: username, password: password }, "*"); // Enviar a la pestaña original |
| 85 | + window.close(); |
| 86 | + } else { |
| 87 | + alert("No se puede volver a la pestaña del juego."); |
| 88 | + } |
| 89 | + }); |
| 90 | + </script> |
| 91 | +</body> |
| 92 | +</html> |
0 commit comments