create-template-html-css 1.6.4 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +152 -0
- package/COMPONENTS-GALLERY.html +660 -0
- package/PUBLISH-GUIDE.md +112 -0
- package/README.md +253 -14
- package/bin/cli.js +296 -5
- package/create-template-html-css-1.8.0.tgz +0 -0
- package/package.json +3 -2
- package/src/generator.js +512 -3
- package/src/inserter.js +7 -1
- package/templates/login/index.html +58 -0
- package/templates/login/script.js +83 -0
- package/templates/login/style.css +232 -0
- package/templates/navigation/index.html +51 -0
- package/templates/navigation/script.js +109 -3
- package/templates/navigation/style.css +269 -0
- package/templates/register/index.html +85 -0
- package/templates/register/script.js +205 -0
- package/templates/register/style.css +298 -0
- package/templates/skeleton/index.html +115 -0
- package/templates/skeleton/script.js +28 -0
- package/templates/skeleton/style.css +409 -0
- package/demo/css/accordion-component.css +0 -135
- package/demo/css/button-component.css +0 -110
- package/demo/css/card-component.css +0 -381
- package/demo/index.html +0 -169
- package/demo/js/accordion-component.js +0 -31
- package/demo/js/button-component.js +0 -17
- package/demo/js/card-component.js +0 -124
|
@@ -111,6 +111,256 @@ body {
|
|
|
111
111
|
color: #666;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
/* Modal Styles */
|
|
115
|
+
.modal {
|
|
116
|
+
display: none;
|
|
117
|
+
position: fixed;
|
|
118
|
+
top: 0;
|
|
119
|
+
left: 0;
|
|
120
|
+
right: 0;
|
|
121
|
+
bottom: 0;
|
|
122
|
+
z-index: 2000;
|
|
123
|
+
align-items: center;
|
|
124
|
+
justify-content: center;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.modal.active {
|
|
128
|
+
display: flex;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.modal-overlay {
|
|
132
|
+
position: absolute;
|
|
133
|
+
top: 0;
|
|
134
|
+
left: 0;
|
|
135
|
+
right: 0;
|
|
136
|
+
bottom: 0;
|
|
137
|
+
background: rgba(0, 0, 0, 0.7);
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
animation: fadeIn 0.3s ease;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.modal-content {
|
|
143
|
+
position: relative;
|
|
144
|
+
z-index: 2001;
|
|
145
|
+
max-width: 450px;
|
|
146
|
+
width: 90%;
|
|
147
|
+
max-height: 90vh;
|
|
148
|
+
overflow-y: auto;
|
|
149
|
+
animation: slideUp 0.3s ease;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@keyframes fadeIn {
|
|
153
|
+
from {
|
|
154
|
+
opacity: 0;
|
|
155
|
+
}
|
|
156
|
+
to {
|
|
157
|
+
opacity: 1;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@keyframes slideUp {
|
|
162
|
+
from {
|
|
163
|
+
opacity: 0;
|
|
164
|
+
transform: translateY(30px);
|
|
165
|
+
}
|
|
166
|
+
to {
|
|
167
|
+
opacity: 1;
|
|
168
|
+
transform: translateY(0);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.modal-close {
|
|
173
|
+
position: absolute;
|
|
174
|
+
top: 15px;
|
|
175
|
+
right: 15px;
|
|
176
|
+
background: #f5f5f5;
|
|
177
|
+
border: none;
|
|
178
|
+
font-size: 28px;
|
|
179
|
+
cursor: pointer;
|
|
180
|
+
width: 40px;
|
|
181
|
+
height: 40px;
|
|
182
|
+
border-radius: 50%;
|
|
183
|
+
display: flex;
|
|
184
|
+
align-items: center;
|
|
185
|
+
justify-content: center;
|
|
186
|
+
z-index: 2002;
|
|
187
|
+
transition: all 0.3s ease;
|
|
188
|
+
color: #333;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.modal-close:hover {
|
|
192
|
+
background: #e0e0e0;
|
|
193
|
+
transform: rotate(90deg);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Login Card in Modal */
|
|
197
|
+
.login-card {
|
|
198
|
+
background: white;
|
|
199
|
+
padding: 50px 40px;
|
|
200
|
+
border-radius: 20px;
|
|
201
|
+
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.login-title {
|
|
205
|
+
color: #333;
|
|
206
|
+
font-size: 2rem;
|
|
207
|
+
margin-bottom: 10px;
|
|
208
|
+
text-align: center;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.login-subtitle {
|
|
212
|
+
color: #666;
|
|
213
|
+
text-align: center;
|
|
214
|
+
margin-bottom: 35px;
|
|
215
|
+
font-size: 0.95rem;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.login-form {
|
|
219
|
+
margin-bottom: 30px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.form-group {
|
|
223
|
+
margin-bottom: 25px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.form-group label {
|
|
227
|
+
display: block;
|
|
228
|
+
color: #333;
|
|
229
|
+
font-weight: 600;
|
|
230
|
+
margin-bottom: 8px;
|
|
231
|
+
font-size: 0.95rem;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.form-group input[type="email"],
|
|
235
|
+
.form-group input[type="password"] {
|
|
236
|
+
width: 100%;
|
|
237
|
+
padding: 12px 15px;
|
|
238
|
+
border: 2px solid #e0e0e0;
|
|
239
|
+
border-radius: 10px;
|
|
240
|
+
font-size: 0.95rem;
|
|
241
|
+
transition: all 0.3s ease;
|
|
242
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.form-group input[type="email"]:focus,
|
|
246
|
+
.form-group input[type="password"]:focus {
|
|
247
|
+
outline: none;
|
|
248
|
+
border-color: #667eea;
|
|
249
|
+
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.remember-forgot {
|
|
253
|
+
display: flex;
|
|
254
|
+
justify-content: space-between;
|
|
255
|
+
align-items: center;
|
|
256
|
+
margin-bottom: 30px;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.checkbox-wrapper {
|
|
260
|
+
display: flex;
|
|
261
|
+
align-items: center;
|
|
262
|
+
gap: 8px;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.checkbox-wrapper input[type="checkbox"] {
|
|
266
|
+
width: 18px;
|
|
267
|
+
height: 18px;
|
|
268
|
+
cursor: pointer;
|
|
269
|
+
accent-color: #667eea;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.checkbox-wrapper label {
|
|
273
|
+
margin: 0;
|
|
274
|
+
font-weight: 500;
|
|
275
|
+
cursor: pointer;
|
|
276
|
+
color: #666;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.forgot-link {
|
|
280
|
+
color: #667eea;
|
|
281
|
+
text-decoration: none;
|
|
282
|
+
font-weight: 600;
|
|
283
|
+
transition: color 0.3s ease;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.forgot-link:hover {
|
|
287
|
+
color: #764ba2;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.login-btn {
|
|
291
|
+
width: 100%;
|
|
292
|
+
padding: 14px;
|
|
293
|
+
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
294
|
+
color: white;
|
|
295
|
+
border: none;
|
|
296
|
+
border-radius: 10px;
|
|
297
|
+
font-size: 1rem;
|
|
298
|
+
font-weight: 600;
|
|
299
|
+
cursor: pointer;
|
|
300
|
+
transition: all 0.3s ease;
|
|
301
|
+
box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.login-btn:hover {
|
|
305
|
+
transform: translateY(-2px);
|
|
306
|
+
box-shadow: 0 15px 35px rgba(102, 126, 234, 0.5);
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.login-btn:active {
|
|
310
|
+
transform: translateY(0);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.form-divider {
|
|
314
|
+
display: flex;
|
|
315
|
+
align-items: center;
|
|
316
|
+
margin: 30px 0;
|
|
317
|
+
color: #999;
|
|
318
|
+
font-size: 0.85rem;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.form-divider::before,
|
|
322
|
+
.form-divider::after {
|
|
323
|
+
content: '';
|
|
324
|
+
flex: 1;
|
|
325
|
+
height: 1px;
|
|
326
|
+
background: #e0e0e0;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.form-divider span {
|
|
330
|
+
padding: 0 15px;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.social-buttons {
|
|
334
|
+
display: grid;
|
|
335
|
+
grid-template-columns: 1fr 1fr;
|
|
336
|
+
gap: 15px;
|
|
337
|
+
margin-bottom: 0;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.social-btn {
|
|
341
|
+
padding: 12px;
|
|
342
|
+
border: 2px solid #e0e0e0;
|
|
343
|
+
background: white;
|
|
344
|
+
border-radius: 10px;
|
|
345
|
+
font-weight: 600;
|
|
346
|
+
cursor: pointer;
|
|
347
|
+
transition: all 0.3s ease;
|
|
348
|
+
display: flex;
|
|
349
|
+
align-items: center;
|
|
350
|
+
justify-content: center;
|
|
351
|
+
gap: 8px;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.social-btn:hover {
|
|
355
|
+
border-color: #667eea;
|
|
356
|
+
background: #f9f9f9;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.social-btn span {
|
|
360
|
+
color: #333;
|
|
361
|
+
font-size: 0.9rem;
|
|
362
|
+
}
|
|
363
|
+
|
|
114
364
|
/* Mobile Responsive */
|
|
115
365
|
@media (max-width: 768px) {
|
|
116
366
|
.nav-toggle {
|
|
@@ -158,4 +408,23 @@ body {
|
|
|
158
408
|
.section p {
|
|
159
409
|
font-size: 1rem;
|
|
160
410
|
}
|
|
411
|
+
|
|
412
|
+
.modal-content {
|
|
413
|
+
width: 95%;
|
|
414
|
+
padding: 0;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.login-card {
|
|
418
|
+
padding: 30px 25px;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.login-title {
|
|
422
|
+
font-size: 1.5rem;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.remember-forgot {
|
|
426
|
+
flex-direction: column;
|
|
427
|
+
align-items: flex-start;
|
|
428
|
+
gap: 15px;
|
|
429
|
+
}
|
|
161
430
|
}
|
|
@@ -0,0 +1,85 @@
|
|
|
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>{{name}} - Register</title>
|
|
7
|
+
<link rel="stylesheet" href="style.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div class="container">
|
|
11
|
+
<div class="register-card">
|
|
12
|
+
<h1 class="register-title">Create Account</h1>
|
|
13
|
+
<p class="register-subtitle">Join us today and get started</p>
|
|
14
|
+
|
|
15
|
+
<form class="register-form" id="registerForm">
|
|
16
|
+
<div class="form-group">
|
|
17
|
+
<label for="fullName">Full Name</label>
|
|
18
|
+
<input type="text" id="fullName" name="fullName" placeholder="John Doe" required>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div class="form-group">
|
|
22
|
+
<label for="email">Email Address</label>
|
|
23
|
+
<input type="email" id="email" name="email" placeholder="you@example.com" required>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div class="form-group">
|
|
27
|
+
<label for="password">Password</label>
|
|
28
|
+
<input type="password" id="password" name="password" placeholder="Enter your password" required>
|
|
29
|
+
<div class="password-requirements">
|
|
30
|
+
<p>Password must contain:</p>
|
|
31
|
+
<ul>
|
|
32
|
+
<li id="req-length">At least 8 characters</li>
|
|
33
|
+
<li id="req-uppercase">One uppercase letter</li>
|
|
34
|
+
<li id="req-number">One number</li>
|
|
35
|
+
<li id="req-special">One special character (@, #, $, %)</li>
|
|
36
|
+
</ul>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<div class="form-group">
|
|
41
|
+
<label for="confirmPassword">Confirm Password</label>
|
|
42
|
+
<input type="password" id="confirmPassword" name="confirmPassword" placeholder="Confirm your password" required>
|
|
43
|
+
<span class="password-match-message" id="matchMessage"></span>
|
|
44
|
+
</div>
|
|
45
|
+
|
|
46
|
+
<div class="form-group">
|
|
47
|
+
<label for="username">Username</label>
|
|
48
|
+
<input type="text" id="username" name="username" placeholder="Choose a username" required>
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<div class="form-group checkbox-group">
|
|
52
|
+
<input type="checkbox" id="terms" name="terms" required>
|
|
53
|
+
<label for="terms">I agree to the <a href="#" class="terms-link">Terms of Service</a> and <a href="#" class="terms-link">Privacy Policy</a></label>
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div class="form-group checkbox-group">
|
|
57
|
+
<input type="checkbox" id="newsletter" name="newsletter">
|
|
58
|
+
<label for="newsletter">Subscribe to our newsletter for updates</label>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<button type="submit" class="register-btn" id="submitBtn">Create Account</button>
|
|
62
|
+
</form>
|
|
63
|
+
|
|
64
|
+
<div class="form-divider">
|
|
65
|
+
<span>Or sign up with</span>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div class="social-buttons">
|
|
69
|
+
<button class="social-btn google-btn">
|
|
70
|
+
<span>Google</span>
|
|
71
|
+
</button>
|
|
72
|
+
<button class="social-btn github-btn">
|
|
73
|
+
<span>GitHub</span>
|
|
74
|
+
</button>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<p class="login-link">
|
|
78
|
+
Already have an account? <a href="#">Login here</a>
|
|
79
|
+
</p>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
|
|
83
|
+
<script src="script.js"></script>
|
|
84
|
+
</body>
|
|
85
|
+
</html>
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// Register Form Handler
|
|
2
|
+
const registerForm = document.getElementById('registerForm');
|
|
3
|
+
const passwordInput = document.getElementById('password');
|
|
4
|
+
const confirmPasswordInput = document.getElementById('confirmPassword');
|
|
5
|
+
const matchMessage = document.getElementById('matchMessage');
|
|
6
|
+
const passwordRequirements = document.querySelector('.password-requirements');
|
|
7
|
+
const submitBtn = document.getElementById('submitBtn');
|
|
8
|
+
|
|
9
|
+
// Password validation requirements
|
|
10
|
+
const passwordRequirements_obj = {
|
|
11
|
+
length: /^.{8,}$/,
|
|
12
|
+
uppercase: /[A-Z]/,
|
|
13
|
+
number: /\d/,
|
|
14
|
+
special: /[@#$%]/
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Password input event listener
|
|
18
|
+
if (passwordInput) {
|
|
19
|
+
passwordInput.addEventListener('input', function() {
|
|
20
|
+
const password = this.value;
|
|
21
|
+
|
|
22
|
+
// Show requirements
|
|
23
|
+
if (password.length > 0) {
|
|
24
|
+
passwordRequirements.classList.add('show');
|
|
25
|
+
} else {
|
|
26
|
+
passwordRequirements.classList.remove('show');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Check each requirement
|
|
30
|
+
updateRequirement('length', passwordRequirements_obj.length.test(password));
|
|
31
|
+
updateRequirement('uppercase', passwordRequirements_obj.uppercase.test(password));
|
|
32
|
+
updateRequirement('number', passwordRequirements_obj.number.test(password));
|
|
33
|
+
updateRequirement('special', passwordRequirements_obj.special.test(password));
|
|
34
|
+
|
|
35
|
+
// Check if passwords match
|
|
36
|
+
if (confirmPasswordInput.value) {
|
|
37
|
+
checkPasswordMatch();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
updateSubmitButton();
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Confirm password input event listener
|
|
45
|
+
if (confirmPasswordInput) {
|
|
46
|
+
confirmPasswordInput.addEventListener('input', checkPasswordMatch);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Update requirement UI
|
|
50
|
+
function updateRequirement(reqName, isValid) {
|
|
51
|
+
const reqElement = document.getElementById(`req-${reqName}`);
|
|
52
|
+
if (reqElement) {
|
|
53
|
+
if (isValid) {
|
|
54
|
+
reqElement.classList.add('valid');
|
|
55
|
+
} else {
|
|
56
|
+
reqElement.classList.remove('valid');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Check password match
|
|
62
|
+
function checkPasswordMatch() {
|
|
63
|
+
const password = passwordInput.value;
|
|
64
|
+
const confirmPassword = confirmPasswordInput.value;
|
|
65
|
+
|
|
66
|
+
if (!confirmPassword) {
|
|
67
|
+
matchMessage.textContent = '';
|
|
68
|
+
matchMessage.className = 'password-match-message';
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (password === confirmPassword) {
|
|
73
|
+
matchMessage.textContent = '✓ Passwords match';
|
|
74
|
+
matchMessage.className = 'password-match-message success';
|
|
75
|
+
return true;
|
|
76
|
+
} else {
|
|
77
|
+
matchMessage.textContent = '✗ Passwords do not match';
|
|
78
|
+
matchMessage.className = 'password-match-message error';
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Validate all requirements met
|
|
84
|
+
function isPasswordValid(password) {
|
|
85
|
+
return (
|
|
86
|
+
passwordRequirements_obj.length.test(password) &&
|
|
87
|
+
passwordRequirements_obj.uppercase.test(password) &&
|
|
88
|
+
passwordRequirements_obj.number.test(password) &&
|
|
89
|
+
passwordRequirements_obj.special.test(password)
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Update submit button state
|
|
94
|
+
function updateSubmitButton() {
|
|
95
|
+
const fullName = document.getElementById('fullName').value;
|
|
96
|
+
const email = document.getElementById('email').value;
|
|
97
|
+
const password = passwordInput.value;
|
|
98
|
+
const confirmPassword = confirmPasswordInput.value;
|
|
99
|
+
const username = document.getElementById('username').value;
|
|
100
|
+
const termsChecked = document.getElementById('terms').checked;
|
|
101
|
+
|
|
102
|
+
const isFormValid = (
|
|
103
|
+
fullName &&
|
|
104
|
+
email &&
|
|
105
|
+
isPasswordValid(password) &&
|
|
106
|
+
password === confirmPassword &&
|
|
107
|
+
username &&
|
|
108
|
+
termsChecked
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
submitBtn.disabled = !isFormValid;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Register form submit
|
|
115
|
+
if (registerForm) {
|
|
116
|
+
registerForm.addEventListener('submit', function(e) {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
|
|
119
|
+
const fullName = document.getElementById('fullName').value;
|
|
120
|
+
const email = document.getElementById('email').value;
|
|
121
|
+
const password = document.getElementById('password').value;
|
|
122
|
+
const confirmPassword = document.getElementById('confirmPassword').value;
|
|
123
|
+
const username = document.getElementById('username').value;
|
|
124
|
+
const newsletter = document.getElementById('newsletter').checked;
|
|
125
|
+
|
|
126
|
+
// Validate all inputs
|
|
127
|
+
if (!fullName || !email || !password || !confirmPassword || !username) {
|
|
128
|
+
alert('Please fill in all required fields');
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Email validation
|
|
133
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
134
|
+
if (!emailRegex.test(email)) {
|
|
135
|
+
alert('Please enter a valid email address');
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Check passwords match
|
|
140
|
+
if (password !== confirmPassword) {
|
|
141
|
+
alert('Passwords do not match');
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Check password validity
|
|
146
|
+
if (!isPasswordValid(password)) {
|
|
147
|
+
alert('Password does not meet all requirements');
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// Username validation (alphanumeric and underscore only, 3-20 characters)
|
|
152
|
+
const usernameRegex = /^[a-zA-Z0-9_]{3,20}$/;
|
|
153
|
+
if (!usernameRegex.test(username)) {
|
|
154
|
+
alert('Username must be 3-20 characters and contain only letters, numbers, and underscores');
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
console.log('Registration attempt:', {
|
|
159
|
+
fullName: fullName,
|
|
160
|
+
email: email,
|
|
161
|
+
username: username,
|
|
162
|
+
newsletter: newsletter,
|
|
163
|
+
password: '***'
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// Here you would send the registration request to your backend
|
|
167
|
+
alert('Account created successfully! (This is a demo)');
|
|
168
|
+
|
|
169
|
+
// Reset form
|
|
170
|
+
registerForm.reset();
|
|
171
|
+
passwordRequirements.classList.remove('show');
|
|
172
|
+
matchMessage.textContent = '';
|
|
173
|
+
submitBtn.disabled = true;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Social button handlers
|
|
178
|
+
const socialButtons = document.querySelectorAll('.social-btn');
|
|
179
|
+
socialButtons.forEach(button => {
|
|
180
|
+
button.addEventListener('click', function(e) {
|
|
181
|
+
e.preventDefault();
|
|
182
|
+
const provider = this.classList.contains('google-btn') ? 'Google' : 'GitHub';
|
|
183
|
+
console.log(`Register with ${provider}`);
|
|
184
|
+
alert(`${provider} registration initiated (This is a demo)`);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// Terms link handlers
|
|
189
|
+
const termsLinks = document.querySelectorAll('.terms-link');
|
|
190
|
+
termsLinks.forEach(link => {
|
|
191
|
+
link.addEventListener('click', function(e) {
|
|
192
|
+
e.preventDefault();
|
|
193
|
+
const type = this.textContent.includes('Terms') ? 'Terms of Service' : 'Privacy Policy';
|
|
194
|
+
alert(`${type} - Full content would be shown here`);
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// Enable/disable submit button on form change
|
|
199
|
+
const formInputs = registerForm.querySelectorAll('input');
|
|
200
|
+
formInputs.forEach(input => {
|
|
201
|
+
input.addEventListener('change', updateSubmitButton);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
// Initialize submit button state
|
|
205
|
+
updateSubmitButton();
|