-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
367 lines (323 loc) · 13.4 KB
/
Copy pathindex.html
File metadata and controls
367 lines (323 loc) · 13.4 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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Splash Screen Component Demo</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
line-height: 1.6;
}
.container {
max-width: 800px;
margin: 0 auto;
}
h1 {
color: #333;
}
.demo-section {
margin-bottom: 30px;
padding: 20px;
border: 1px solid #ddd;
border-radius: 5px;
}
button {
background-color: #4CAF50;
color: white;
border: none;
padding: 10px 15px;
border-radius: 4px;
cursor: pointer;
margin-right: 10px;
margin-bottom: 10px;
}
button:hover {
background-color: #45a049;
}
pre {
background-color: #f5f5f5;
padding: 15px;
border-radius: 5px;
overflow-x: auto;
}
code {
font-family: monospace;
}
.color-picker {
display: flex;
align-items: center;
margin-bottom: 10px;
}
.color-picker label {
margin-right: 10px;
min-width: 150px;
}
input[type="color"] {
margin-right: 10px;
}
input[type="number"], input[type="text"] {
padding: 5px;
border: 1px solid #ddd;
border-radius: 4px;
margin-right: 10px;
}
.status-message {
margin-top: 10px;
padding: 10px;
border-radius: 4px;
background-color: #f8f8f8;
display: none;
}
</style>
</head>
<body>
<div class="container">
<h1>Splash Screen Component Demo</h1>
<div class="demo-section">
<h2>Basic Demo</h2>
<p>Click the buttons below to see different splash screen configurations:</p>
<button id="demo-basic">Basic Splash</button>
<button id="demo-logo">Logo Splash</button>
<button id="demo-progress">With Progress Bar</button>
<button id="demo-spinner">With Spinner</button>
<button id="demo-custom">Custom Theme</button>
<div id="status-message" class="status-message"></div>
</div>
<div class="demo-section">
<h2>Customization</h2>
<p>Customize the splash screen and click "Apply" to see the changes:</p>
<div class="color-picker">
<label for="bg-color">Background Color:</label>
<input type="color" id="bg-color" value="#FF5722">
<span id="bg-color-hex">#FF5722</span>
</div>
<div class="color-picker">
<label for="text-color">Text Color:</label>
<input type="color" id="text-color" value="#FFFFFF">
<span id="text-color-hex">#FFFFFF</span>
</div>
<div class="color-picker">
<label for="progress-color">Progress Bar Color:</label>
<input type="color" id="progress-color" value="#FFFFFF">
<span id="progress-color-hex">#FFFFFF</span>
</div>
<div class="color-picker">
<label for="splash-text">Splash Text:</label>
<input type="text" id="splash-text" value="Loading..." style="width: 200px;">
</div>
<div class="color-picker">
<label for="splash-duration">Duration (ms):</label>
<input type="number" id="splash-duration" value="3000" min="500" step="500">
</div>
<div class="color-picker">
<label for="logo-animation">Logo Animation:</label>
<select id="logo-animation">
<option value="pulse">Pulse</option>
<option value="rotate">Rotate</option>
<option value="bounce">Bounce</option>
<option value="none">None</option>
</select>
</div>
<div class="color-picker">
<label>Features:</label>
<input type="checkbox" id="show-progress" checked>
<label for="show-progress">Progress Bar</label>
<input type="checkbox" id="show-spinner">
<label for="show-spinner">Spinner</label>
</div>
<button id="apply-custom">Apply Custom Settings</button>
</div>
<div class="demo-section">
<h2>Integration Guide</h2>
<p>To integrate the splash screen into your project, follow these steps:</p>
<h3>1. Include the script</h3>
<pre><code><script src="splash-screen.js"></script></code></pre>
<h3>2. Initialize the splash screen</h3>
<pre><code>// Basic usage
const splash = new SplashScreen();
// With custom options
const splash = new SplashScreen({
backgroundColor: '#FF5722',
logoSrc: 'path/to/logo.png',
logoWidth: 150,
logoHeight: 150,
text: 'Loading...',
textColor: '#FFFFFF',
duration: 3000,
showProgressBar: true,
progressBarColor: '#FFFFFF',
logoAnimation: 'pulse', // 'pulse', 'rotate', 'bounce', or 'none'
onHide: () => {
console.log('Splash screen hidden');
}
});</code></pre>
<h3>3. Control methods</h3>
<pre><code>// Hide the splash screen manually
splash.hide();
// Show the splash screen again
splash.show();
// Update options
splash.updateOptions({
backgroundColor: '#4CAF50',
text: 'Almost there...'
});</code></pre>
</div>
</div>
<script src="splash-screen.js"></script>
<script>
// Helper function to show status messages
function showStatus(message, isError = false) {
const statusEl = document.getElementById('status-message');
statusEl.textContent = message;
statusEl.style.display = 'block';
statusEl.style.backgroundColor = isError ? '#ffebee' : '#e8f5e9';
statusEl.style.color = isError ? '#c62828' : '#2e7d32';
setTimeout(() => {
statusEl.style.display = 'none';
}, 3000);
}
// Color picker event handlers
document.getElementById('bg-color').addEventListener('input', function() {
document.getElementById('bg-color-hex').textContent = this.value;
});
document.getElementById('text-color').addEventListener('input', function() {
document.getElementById('text-color-hex').textContent = this.value;
});
document.getElementById('progress-color').addEventListener('input', function() {
document.getElementById('progress-color-hex').textContent = this.value;
});
// Demo buttons
document.getElementById('demo-basic').addEventListener('click', function() {
try {
new SplashScreen({
backgroundColor: '#2196F3',
text: 'Basic Splash Screen',
textColor: '#FFFFFF',
duration: 3000,
onHide: () => showStatus('Basic splash screen closed')
});
} catch (error) {
showStatus('Error: ' + error.message, true);
console.error(error);
}
});
document.getElementById('demo-logo').addEventListener('click', function() {
try {
new SplashScreen({
backgroundColor: '#FF5722',
logoSrc: 'https://hebbkx1anhila5yf.public.blob.vercel-storage.com/server-icon2-3wvcH3nMal8KTRJkIJsCPrsTjmxoAP.png',
text: 'Logo Splash Screen',
textColor: '#FFFFFF',
duration: 3000,
onHide: () => showStatus('Logo splash screen closed')
});
} catch (error) {
showStatus('Error: ' + error.message, true);
console.error(error);
}
});
document.getElementById('demo-progress').addEventListener('click', function() {
try {
new SplashScreen({
backgroundColor: '#4CAF50',
logoSrc: 'https://hebbkx1anhila5yf.public.blob.vercel-storage.com/server-icon2-3wvcH3nMal8KTRJkIJsCPrsTjmxoAP.png',
text: 'Loading...',
textColor: '#FFFFFF',
duration: 3000,
showProgressBar: true,
progressBarColor: '#FFFFFF',
onHide: () => showStatus('Progress splash screen closed')
});
} catch (error) {
showStatus('Error: ' + error.message, true);
console.error(error);
}
});
document.getElementById('demo-spinner').addEventListener('click', function() {
try {
new SplashScreen({
backgroundColor: '#9C27B0',
logoSrc: 'https://hebbkx1anhila5yf.public.blob.vercel-storage.com/server-icon2-3wvcH3nMal8KTRJkIJsCPrsTjmxoAP.png',
text: 'Please wait...',
textColor: '#FFFFFF',
duration: 3000,
showSpinner: true,
spinnerColor: '#FFFFFF',
onHide: () => showStatus('Spinner splash screen closed')
});
} catch (error) {
showStatus('Error: ' + error.message, true);
console.error(error);
}
});
document.getElementById('demo-custom').addEventListener('click', function() {
try {
new SplashScreen({
backgroundColor: '#212121',
logoSrc: 'https://hebbkx1anhila5yf.public.blob.vercel-storage.com/server-icon2-3wvcH3nMal8KTRJkIJsCPrsTjmxoAP.png',
text: 'Welcome to our app',
textColor: '#FFFFFF',
duration: 3000,
showProgressBar: true,
progressBarColor: '#FF5722',
showSpinner: true,
spinnerColor: '#FF5722',
logoAnimation: 'rotate',
onHide: () => showStatus('Custom splash screen closed')
});
} catch (error) {
showStatus('Error: ' + error.message, true);
console.error(error);
}
});
document.getElementById('apply-custom').addEventListener('click', function() {
try {
const bgColor = document.getElementById('bg-color').value;
const textColor = document.getElementById('text-color').value;
const progressColor = document.getElementById('progress-color').value;
const splashText = document.getElementById('splash-text').value;
const duration = parseInt(document.getElementById('splash-duration').value);
const logoAnimation = document.getElementById('logo-animation').value;
const showProgress = document.getElementById('show-progress').checked;
const showSpinner = document.getElementById('show-spinner').checked;
new SplashScreen({
backgroundColor: bgColor,
logoSrc: 'https://hebbkx1anhila5yf.public.blob.vercel-storage.com/server-icon2-3wvcH3nMal8KTRJkIJsCPrsTjmxoAP.png',
text: splashText,
textColor: textColor,
duration: duration,
showProgressBar: showProgress,
progressBarColor: progressColor,
showSpinner: showSpinner,
spinnerColor: textColor,
logoAnimation: logoAnimation,
onHide: () => showStatus('Custom splash screen closed')
});
} catch (error) {
showStatus('Error: ' + error.message, true);
console.error(error);
}
});
// Show initial splash on page load
document.addEventListener('DOMContentLoaded', function() {
try {
new SplashScreen({
backgroundColor: '#FF5722',
logoSrc: 'https://hebbkx1anhila5yf.public.blob.vercel-storage.com/server-icon2-3wvcH3nMal8KTRJkIJsCPrsTjmxoAP.png',
text: 'Welcome to Splash Screen Demo',
textColor: '#FFFFFF',
duration: 2000,
showProgressBar: true,
progressBarColor: '#FFFFFF',
onHide: () => console.log('Initial splash screen closed')
});
} catch (error) {
console.error('Failed to show initial splash screen:', error);
}
});
</script>
</body>
</html>