-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.html
More file actions
233 lines (202 loc) · 7.58 KB
/
install.html
File metadata and controls
233 lines (202 loc) · 7.58 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Instalador de WhyStore</title>
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#121212">
<link rel="apple-touch-icon" href="images/icons/icon-192x192.png">
<style>
/* --- VARIABLES DE COLOR Y FUENTES --- */
:root {
--bg-color: #121212;
--surface-color: rgba(30, 30, 30, 0.7);
--primary-color: #0d6efd;
--primary-hover: #0b5ed7;
--text-color: #e0e0e0;
--text-secondary: #a0a0a0;
--font-stack: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}
/* --- ESTILOS BASE --- */
body, html {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
font-family: var(--font-stack);
background-color: var(--bg-color);
background-image: radial-gradient(circle at 10% 20%, rgba(100, 100, 255, 0.1), transparent 30%),
radial-gradient(circle at 80% 90%, rgba(255, 100, 100, 0.1), transparent 30%);
color: var(--text-color);
}
/* --- LAYOUT PRINCIPAL (TARJETA) --- */
.card-container {
display: flex;
justify-content: center;
align-items: center;
height: 100%;
padding: 20px;
box-sizing: border-box;
}
.install-card {
background: var(--surface-color);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 20px;
padding: 40px;
text-align: center;
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
max-width: 400px;
animation: fadeIn 0.8s ease-in-out;
}
.app-icon {
width: 100px;
height: 100px;
border-radius: 24px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}
h1 {
font-size: 2.2rem;
margin: 20px 0 5px 0;
}
#status-text {
font-size: 1.2rem;
color: var(--text-secondary);
font-weight: 300;
height: 25px; /* Altura fija para evitar saltos de layout */
display: flex;
align-items: center;
justify-content: center;
gap: 10px;
}
.instructions {
color: var(--text-secondary);
margin-top: 20px;
line-height: 1.6;
}
/* --- AVISO DE INSTALACIÓN (POP-UP) --- */
#install-prompt {
display: none;
position: fixed;
top: 15px;
right: 80px;
background-color: #282828;
color: white;
padding: 15px 20px;
border-radius: 12px;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
z-index: 1000;
align-items: center;
gap: 15px;
animation: fadeInDown 0.5s;
}
#install-prompt::after {
content: '';
position: absolute;
top: -10px;
right: 25px;
border-left: 10px solid transparent;
border-right: 10px solid transparent;
border-bottom: 10px solid #282828;
}
#install-button {
background-color: var(--primary-color);
color: white;
border: none;
padding: 8px 15px;
border-radius: 8px;
cursor: pointer;
font-weight: bold;
font-size: 14px;
transition: background-color 0.2s;
}
#install-button:hover {
background-color: var(--primary-hover);
}
/* --- SPINNER DE CARGA --- */
.loader {
border: 4px solid rgba(255, 255, 255, 0.2);
border-radius: 50%;
border-top: 4px solid #fff;
width: 20px;
height: 20px;
animation: spin 1s linear infinite;
}
/* --- ANIMACIONES --- */
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@keyframes fadeIn {
from { opacity: 0; transform: scale(0.95); }
to { opacity: 1; transform: scale(1); }
}
@keyframes fadeInDown {
from { opacity: 0; transform: translateY(-20px); }
to { opacity: 1; transform: translateY(0); }
}
</style>
</head>
<body>
<div id="install-prompt">
<span>Instala la aplicación para un acceso rápido</span>
<button id="install-button">Instalar</button>
</div>
<main class="card-container">
<div class="install-card">
<img src="images/icons/icon192.png" alt="Logo de PhotoPea" class="app-icon">
<h1>Digital Piano</h1>
<h2 id="status-text">
<span>Listo para instalar</span>
</h2>
<p class="instructions">
Haz clic en el botón <strong>Instalar</strong> que aparece en la notificación superior para añadir la aplicación a tu dispositivo.
</p>
</div>
</main>
<script>
// --- REFERENCIAS A ELEMENTOS DEL DOM ---
const installPromptDiv = document.getElementById('install-prompt');
const installButton = document.getElementById('install-button');
const statusText = document.getElementById('status-text');
const instructions = document.querySelector('.instructions');
let deferredPrompt;
// --- LÓGICA DE INSTALACIÓN PWA ---
window.addEventListener('beforeinstallprompt', (e) => {
e.preventDefault();
deferredPrompt = e;
// Muestra el aviso personalizado
installPromptDiv.style.display = 'flex';
});
installButton.addEventListener('click', async () => {
if (!deferredPrompt) return;
// Oculta el aviso y actualiza la UI al estado de "instalando"
installPromptDiv.style.display = 'none';
statusText.innerHTML = `<div class="loader"></div><span>Instalando...</span>`;
instructions.style.display = 'none';
// Muestra el diálogo de instalación del navegador
deferredPrompt.prompt();
// Espera la decisión del usuario
const { outcome } = await deferredPrompt.userChoice;
if (outcome === 'dismissed') {
// Si el usuario cancela, restaura la UI
console.log('El usuario canceló la instalación');
statusText.innerHTML = '<span>Listo para instalar</span>';
instructions.style.display = 'block';
}
deferredPrompt = null;
});
window.addEventListener('appinstalled', () => {
console.log('PWA fue instalada con éxito');
statusText.innerHTML = '<span>¡Instalación completa!</span>';
// Redirige al usuario a la aplicación después de 2 segundos
setTimeout(() => {
// IMPORTANTE: Cambia 'app.html' por la página que contiene el iframe de Photopea
window.location.href = 'index.html';
}, 2000);
});
</script>
</body>
</html>