Spaces:
Running
Running
Update login.html
Browse files- login.html +354 -446
login.html
CHANGED
|
@@ -20,32 +20,14 @@
|
|
| 20 |
justify-content: center;
|
| 21 |
position: relative;
|
| 22 |
padding: 20px;
|
| 23 |
-
background: #
|
| 24 |
color: #333;
|
| 25 |
}
|
| 26 |
|
| 27 |
-
.logo-container {
|
| 28 |
-
position: absolute;
|
| 29 |
-
top: 40px;
|
| 30 |
-
left: 50%;
|
| 31 |
-
transform: translateX(-50%);
|
| 32 |
-
width: 160px;
|
| 33 |
-
height: 160px;
|
| 34 |
-
background: #ffffff;
|
| 35 |
-
border-radius: 50%;
|
| 36 |
-
padding: 12px;
|
| 37 |
-
box-shadow: 0 4px 35px rgba(218, 165, 32, 0.35);
|
| 38 |
-
display: flex;
|
| 39 |
-
align-items: center;
|
| 40 |
-
justify-content: center;
|
| 41 |
-
z-index: 2;
|
| 42 |
-
}
|
| 43 |
-
|
| 44 |
.container {
|
| 45 |
position: relative;
|
| 46 |
-
width:
|
| 47 |
-
|
| 48 |
-
z-index: 1;
|
| 49 |
perspective: 1000px;
|
| 50 |
}
|
| 51 |
|
|
@@ -64,30 +46,29 @@
|
|
| 64 |
.form-box {
|
| 65 |
position: absolute;
|
| 66 |
width: 100%;
|
| 67 |
-
|
| 68 |
padding: 40px;
|
|
|
|
| 69 |
border-radius: 24px;
|
| 70 |
-
box-shadow: 0
|
| 71 |
-
border: 1px solid rgba(218, 165, 32, 0.35);
|
| 72 |
backface-visibility: hidden;
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
.login-form {
|
| 76 |
-
transform: rotateY(0deg);
|
| 77 |
}
|
| 78 |
|
| 79 |
.register-form {
|
| 80 |
transform: rotateY(180deg);
|
|
|
|
| 81 |
}
|
| 82 |
|
| 83 |
h2 {
|
| 84 |
text-align: center;
|
| 85 |
-
color: #
|
| 86 |
-
margin-bottom:
|
| 87 |
font-size: 32px;
|
| 88 |
font-weight: 700;
|
| 89 |
position: relative;
|
| 90 |
-
padding-bottom:
|
| 91 |
}
|
| 92 |
|
| 93 |
h2::after {
|
|
@@ -103,40 +84,27 @@
|
|
| 103 |
}
|
| 104 |
|
| 105 |
.input-group {
|
| 106 |
-
margin-bottom:
|
| 107 |
position: relative;
|
| 108 |
}
|
| 109 |
|
| 110 |
-
|
| 111 |
-
display: block;
|
| 112 |
-
margin-bottom: 8px;
|
| 113 |
-
color: #555;
|
| 114 |
-
font-weight: 500;
|
| 115 |
-
}
|
| 116 |
-
|
| 117 |
-
input, select {
|
| 118 |
width: 100%;
|
| 119 |
-
padding:
|
| 120 |
-
border: 2px solid rgba(218, 165, 32, 0.
|
| 121 |
-
border-radius:
|
| 122 |
-
font-size:
|
| 123 |
transition: all 0.3s ease;
|
| 124 |
-
background:
|
| 125 |
color: #333;
|
| 126 |
}
|
| 127 |
|
| 128 |
-
input:focus
|
| 129 |
border-color: #DAA520;
|
| 130 |
-
|
|
|
|
| 131 |
outline: none;
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
select {
|
| 135 |
-
appearance: none;
|
| 136 |
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M8 11.5l-6-6h12z'/%3E%3C/svg%3E");
|
| 137 |
-
background-repeat: no-repeat;
|
| 138 |
-
background-position: left 20px center;
|
| 139 |
-
padding-left: 40px;
|
| 140 |
}
|
| 141 |
|
| 142 |
button {
|
|
@@ -144,470 +112,410 @@
|
|
| 144 |
padding: 16px;
|
| 145 |
background: linear-gradient(135deg, #DAA520 0%, #FFD700 100%);
|
| 146 |
border: none;
|
| 147 |
-
border-radius:
|
| 148 |
color: #000;
|
| 149 |
font-size: 18px;
|
| 150 |
font-weight: 600;
|
| 151 |
cursor: pointer;
|
| 152 |
transition: all 0.3s ease;
|
| 153 |
-
margin-
|
| 154 |
position: relative;
|
|
|
|
| 155 |
}
|
| 156 |
|
| 157 |
-
button:
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
}
|
| 161 |
-
|
| 162 |
-
button:hover:not(:disabled) {
|
| 163 |
-
transform: translateY(-2px);
|
| 164 |
-
box-shadow: 0 8px 25px rgba(218, 165, 32, 0.4);
|
| 165 |
}
|
| 166 |
|
| 167 |
.toggle-btn {
|
| 168 |
background: transparent;
|
| 169 |
color: #DAA520;
|
| 170 |
border: 2px solid #DAA520;
|
| 171 |
-
|
| 172 |
}
|
| 173 |
|
| 174 |
.toggle-btn:hover {
|
| 175 |
-
background:
|
| 176 |
-
color:
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
.form-footer {
|
| 180 |
-
text-align: center;
|
| 181 |
-
margin-top: 25px;
|
| 182 |
-
padding-top: 20px;
|
| 183 |
-
border-top: 1px solid rgba(218, 165, 32, 0.25);
|
| 184 |
-
color: #666;
|
| 185 |
}
|
| 186 |
|
| 187 |
.message {
|
| 188 |
-
padding: 12px;
|
| 189 |
margin-top: 15px;
|
| 190 |
-
border-radius: 8px;
|
| 191 |
text-align: center;
|
| 192 |
-
|
|
|
|
| 193 |
font-size: 14px;
|
| 194 |
-
|
|
|
|
| 195 |
}
|
| 196 |
|
| 197 |
.message.show {
|
| 198 |
-
|
| 199 |
-
animation: fadeIn 0.3s ease-in;
|
| 200 |
}
|
| 201 |
|
| 202 |
-
.
|
| 203 |
-
|
| 204 |
-
color:
|
| 205 |
-
border: 1px solid #
|
| 206 |
}
|
| 207 |
|
| 208 |
-
.
|
| 209 |
-
|
| 210 |
-
color:
|
| 211 |
-
border: 1px solid #
|
| 212 |
}
|
| 213 |
|
| 214 |
-
.
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
border-top-color: #000;
|
| 221 |
-
animation: spin 1s ease-in-out infinite;
|
| 222 |
-
position: absolute;
|
| 223 |
-
right: 20px;
|
| 224 |
-
top: 50%;
|
| 225 |
-
transform: translateY(-50%);
|
| 226 |
}
|
| 227 |
|
| 228 |
-
|
| 229 |
-
|
|
|
|
|
|
|
|
|
|
| 230 |
}
|
| 231 |
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
to { opacity: 1; transform: translateY(0); }
|
| 235 |
}
|
| 236 |
|
| 237 |
-
@media (max-width:
|
| 238 |
.container {
|
| 239 |
width: 100%;
|
| 240 |
-
|
| 241 |
}
|
| 242 |
-
|
| 243 |
.form-box {
|
| 244 |
-
padding: 30px
|
| 245 |
}
|
| 246 |
|
| 247 |
h2 {
|
| 248 |
-
font-size:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 249 |
}
|
| 250 |
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
top: 20px;
|
| 255 |
}
|
| 256 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 257 |
</style>
|
| 258 |
</head>
|
| 259 |
<body>
|
| 260 |
-
<div class="logo-container">
|
| 261 |
-
<img src="https://ufastpro.com/wp-content/uploads/2024/11/تصميم-بدون-عنوان-3.png" alt="Logo" style="width: 100%; height: 100%; object-fit: contain; border-radius: 50%;">
|
| 262 |
-
</div>
|
| 263 |
-
|
| 264 |
<div class="container">
|
| 265 |
<div class="forms-container">
|
| 266 |
-
<!-- نموذج تسجيل الدخول -->
|
| 267 |
<div class="form-box login-form">
|
| 268 |
-
<h2
|
| 269 |
-
<
|
| 270 |
-
<
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
<button type="submit">
|
| 281 |
-
تسجيل الدخول
|
| 282 |
-
<span class="loading-spinner"></span>
|
| 283 |
-
</button>
|
| 284 |
-
<div id="loginMessage" class="message"></div>
|
| 285 |
-
</form>
|
| 286 |
-
|
| 287 |
-
<button class="toggle-btn" onclick="toggleForm()">إنشاء حساب جديد</button>
|
| 288 |
-
|
| 289 |
-
<div class="form-footer">
|
| 290 |
-
منصة ذكاء اصطناعي قانوني موثوقة ومرخصة
|
| 291 |
</div>
|
| 292 |
</div>
|
| 293 |
|
| 294 |
-
<!-- نموذج إنشاء حساب -->
|
| 295 |
<div class="form-box register-form">
|
| 296 |
-
<h2
|
| 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 |
-
<div class="input-group">
|
| 324 |
-
<label>كلمة المرور</label>
|
| 325 |
-
<input type="password" id="registerPassword" required placeholder="8 أحرف على الأقل" minlength="8">
|
| 326 |
-
</div>
|
| 327 |
-
|
| 328 |
-
<button type="submit">
|
| 329 |
-
إنشاء الحساب
|
| 330 |
-
<span class="loading-spinner"></span>
|
| 331 |
-
</button>
|
| 332 |
-
<div id="registerMessage" class="message"></div>
|
| 333 |
-
</form>
|
| 334 |
-
|
| 335 |
-
<button class="toggle-btn" onclick="toggleForm()">العودة لتسجيل الدخول</button>
|
| 336 |
-
|
| 337 |
-
<div class="form-footer">
|
| 338 |
-
بالتسجيل، أنت توافق على <a href="https://ufastpro.com/%d8%b3%d9%8a%d8%a7%d8%b3%d8%a9-%d8%a7%d9%84%d8%ae%d8%b5%d9%88%d8%b5%d9%8a%d8%a9/" style="color: #DAA520; text-decoration: none;">سياسة الخصوصية</a>
|
| 339 |
</div>
|
| 340 |
</div>
|
| 341 |
</div>
|
| 342 |
</div>
|
| 343 |
|
| 344 |
<script>
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
},
|
| 352 |
-
password: {
|
| 353 |
-
minLength: 8,
|
| 354 |
-
maxLength: 50
|
| 355 |
-
},
|
| 356 |
-
phone: {
|
| 357 |
-
pattern: /^(\+201|01)[0-2|5][0-9]{8}$/,
|
| 358 |
-
message: 'الرجاء إدخال رقم هاتف مصري صحيح'
|
| 359 |
-
},
|
| 360 |
-
email: {
|
| 361 |
-
pattern: /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
|
| 362 |
-
message: 'الرجاء إدخال بريد إلكتروني صحيح'
|
| 363 |
-
}
|
| 364 |
-
};
|
| 365 |
-
|
| 366 |
-
// وظائف المساعدة
|
| 367 |
-
function validateInput(value, rules) {
|
| 368 |
-
if (!value || typeof value !== 'string') {
|
| 369 |
-
return 'هذا الحقل مطلوب';
|
| 370 |
-
}
|
| 371 |
-
|
| 372 |
-
value = value.trim();
|
| 373 |
-
|
| 374 |
-
if (rules.minLength && value.length < rules.minLength) {
|
| 375 |
-
return `يجب أن يكون الحقل ${rules.minLength} أحرف على الأقل`;
|
| 376 |
-
}
|
| 377 |
-
|
| 378 |
-
if (rules.maxLength && value.length > rules.maxLength) {
|
| 379 |
-
return `يجب أن لا يتجاوز الحقل ${rules.maxLength} حرف`;
|
| 380 |
-
}
|
| 381 |
-
|
| 382 |
-
if (rules.pattern && !rules.pattern.test(value)) {
|
| 383 |
-
return rules.message;
|
| 384 |
-
}
|
| 385 |
-
|
| 386 |
-
return null;
|
| 387 |
-
}
|
| 388 |
-
|
| 389 |
-
function formatPhoneNumber(phone) {
|
| 390 |
-
// تنسيق رقم الهاتف بشكل موحد
|
| 391 |
-
phone = phone.trim().replace(/\s+/g, '');
|
| 392 |
-
if (phone.startsWith('01')) {
|
| 393 |
-
return phone;
|
| 394 |
-
}
|
| 395 |
-
if (phone.startsWith('+201')) {
|
| 396 |
-
return '0' + phone.slice(3);
|
| 397 |
-
}
|
| 398 |
-
return phone;
|
| 399 |
-
}
|
| 400 |
-
|
| 401 |
-
function showMessage(elementId, message, isError = false) {
|
| 402 |
-
const element = document.getElementById(elementId);
|
| 403 |
-
if (!element) return;
|
| 404 |
-
|
| 405 |
-
element.textContent = message;
|
| 406 |
-
element.className = `message ${isError ? 'error' : 'success'} ${message ? 'show' : ''}`;
|
| 407 |
-
}
|
| 408 |
-
|
| 409 |
-
function toggleLoadingState(formId, isLoading) {
|
| 410 |
-
const form = document.getElementById(formId);
|
| 411 |
-
if (!form) return;
|
| 412 |
-
|
| 413 |
-
const button = form.querySelector('button[type="submit"]');
|
| 414 |
-
const spinner = button?.querySelector('.loading-spinner');
|
| 415 |
-
const inputs = form.querySelectorAll('input, select');
|
| 416 |
-
|
| 417 |
-
if (button) button.disabled = isLoading;
|
| 418 |
-
if (spinner) spinner.style.display = isLoading ? 'block' : 'none';
|
| 419 |
-
inputs.forEach(input => input.disabled = isLoading);
|
| 420 |
-
}
|
| 421 |
-
|
| 422 |
-
// التحقق من صحة نموذج التسجيل
|
| 423 |
-
function validateRegistrationForm(formData) {
|
| 424 |
-
const errors = [];
|
| 425 |
-
|
| 426 |
-
// التحقق من اسم المكتب
|
| 427 |
-
const officeNameError = validateInput(formData.officeName, VALIDATION_RULES.officeName);
|
| 428 |
-
if (officeNameError) errors.push(officeNameError);
|
| 429 |
-
|
| 430 |
-
// التحقق من الدور
|
| 431 |
-
if (!formData.userRole) {
|
| 432 |
-
errors.push('الرجاء اختيار صفة المسجل');
|
| 433 |
-
}
|
| 434 |
-
|
| 435 |
-
// التحقق من رقم الهاتف
|
| 436 |
-
const phoneError = validateInput(formData.phone, VALIDATION_RULES.phone);
|
| 437 |
-
if (phoneError) errors.push(phoneError);
|
| 438 |
-
|
| 439 |
-
// التحقق من البريد الإلكتروني
|
| 440 |
-
const emailError = validateInput(formData.email, VALIDATION_RULES.email);
|
| 441 |
-
if (emailError) errors.push(emailError);
|
| 442 |
-
|
| 443 |
-
// التحقق من كلمة المرور
|
| 444 |
-
const passwordError = validateInput(formData.password, VALIDATION_RULES.password);
|
| 445 |
-
if (passwordError) errors.push(passwordError);
|
| 446 |
-
|
| 447 |
-
return errors.length ? errors.join('\n') : null;
|
| 448 |
-
}
|
| 449 |
-
|
| 450 |
-
// معالجة التسجيل
|
| 451 |
-
async function handleRegister(event) {
|
| 452 |
-
event.preventDefault();
|
| 453 |
-
|
| 454 |
-
// جمع البيانات من النموذج
|
| 455 |
-
const formData = {
|
| 456 |
-
officeName: document.getElementById('officeName').value,
|
| 457 |
-
userRole: document.getElementById('userRole').value,
|
| 458 |
-
phone: document.getElementById('phone').value,
|
| 459 |
-
email: document.getElementById('registerEmail').value,
|
| 460 |
-
password: document.getElementById('registerPassword').value
|
| 461 |
-
};
|
| 462 |
-
|
| 463 |
-
// التحقق من صحة البيانات
|
| 464 |
-
const validationError = validateRegistrationForm(formData);
|
| 465 |
-
if (validationError) {
|
| 466 |
-
showMessage('registerMessage', validationError, true);
|
| 467 |
-
return false;
|
| 468 |
-
}
|
| 469 |
-
|
| 470 |
-
try {
|
| 471 |
-
toggleLoadingState('registerForm', true);
|
| 472 |
-
showMessage('registerMessage', 'جاري إنشاء الحساب...', false);
|
| 473 |
-
|
| 474 |
-
const response = await fetch(`${API_URL}/register`, {
|
| 475 |
-
method: 'POST',
|
| 476 |
-
headers: {
|
| 477 |
-
'Content-Type': 'application/json',
|
| 478 |
-
'Accept': 'application/json'
|
| 479 |
-
},
|
| 480 |
-
body: JSON.stringify({
|
| 481 |
-
officeName: formData.officeName.trim(),
|
| 482 |
-
userRole: formData.userRole,
|
| 483 |
-
phone: formatPhoneNumber(formData.phone),
|
| 484 |
-
email: formData.email.toLowerCase().trim(),
|
| 485 |
-
password: formData.password
|
| 486 |
-
})
|
| 487 |
-
});
|
| 488 |
|
| 489 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 490 |
|
| 491 |
-
|
| 492 |
-
|
| 493 |
-
|
| 494 |
-
|
| 495 |
setTimeout(() => {
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
const
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
| 507 |
-
|
| 508 |
-
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
}
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
|
| 545 |
-
|
| 546 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 547 |
});
|
| 548 |
|
| 549 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 550 |
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
|
| 555 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 556 |
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
if (loginForm) loginForm.addEventListener('submit', handleLogin);
|
| 586 |
-
if (registerForm) registerForm.addEventListener('submit', handleRegister);
|
| 587 |
-
});
|
| 588 |
-
|
| 589 |
-
// معالجة الأخطاء العامة
|
| 590 |
-
window.onerror = function(msg, url, lineNo, columnNo, error) {
|
| 591 |
-
console.error('Error:', {
|
| 592 |
-
message: msg,
|
| 593 |
-
url: url,
|
| 594 |
-
line: lineNo,
|
| 595 |
-
column: columnNo,
|
| 596 |
-
error: error
|
| 597 |
-
});
|
| 598 |
-
return false;
|
| 599 |
-
};
|
| 600 |
-
|
| 601 |
-
// معالجة حالة الاتصال بالإنترنت
|
| 602 |
-
window.addEventListener('offline', function() {
|
| 603 |
-
showMessage('loginMessage', 'لا يوجد اتصال بالإنترنت', true);
|
| 604 |
-
showMessage('registerMessage', 'لا يوجد اتصال بالإنترنت', true);
|
| 605 |
-
});
|
| 606 |
-
|
| 607 |
-
window.addEventListener('online', function() {
|
| 608 |
-
showMessage('loginMessage', '');
|
| 609 |
-
showMessage('registerMessage', '');
|
| 610 |
-
});
|
| 611 |
</script>
|
| 612 |
</body>
|
| 613 |
</html>
|
|
|
|
| 20 |
justify-content: center;
|
| 21 |
position: relative;
|
| 22 |
padding: 20px;
|
| 23 |
+
background: linear-gradient(135deg, #f6f8fc 0%, #e9ecef 100%);
|
| 24 |
color: #333;
|
| 25 |
}
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
.container {
|
| 28 |
position: relative;
|
| 29 |
+
width: 420px;
|
| 30 |
+
min-height: 480px;
|
|
|
|
| 31 |
perspective: 1000px;
|
| 32 |
}
|
| 33 |
|
|
|
|
| 46 |
.form-box {
|
| 47 |
position: absolute;
|
| 48 |
width: 100%;
|
| 49 |
+
height: 100%;
|
| 50 |
padding: 40px;
|
| 51 |
+
background: rgba(255, 255, 255, 0.98);
|
| 52 |
border-radius: 24px;
|
| 53 |
+
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
|
|
|
|
| 54 |
backface-visibility: hidden;
|
| 55 |
+
border: 1px solid rgba(200, 200, 200, 0.3);
|
| 56 |
+
backdrop-filter: blur(10px);
|
|
|
|
|
|
|
| 57 |
}
|
| 58 |
|
| 59 |
.register-form {
|
| 60 |
transform: rotateY(180deg);
|
| 61 |
+
height: auto;
|
| 62 |
}
|
| 63 |
|
| 64 |
h2 {
|
| 65 |
text-align: center;
|
| 66 |
+
color: #1a1a1a;
|
| 67 |
+
margin-bottom: 35px;
|
| 68 |
font-size: 32px;
|
| 69 |
font-weight: 700;
|
| 70 |
position: relative;
|
| 71 |
+
padding-bottom: 18px;
|
| 72 |
}
|
| 73 |
|
| 74 |
h2::after {
|
|
|
|
| 84 |
}
|
| 85 |
|
| 86 |
.input-group {
|
| 87 |
+
margin-bottom: 24px;
|
| 88 |
position: relative;
|
| 89 |
}
|
| 90 |
|
| 91 |
+
input {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
width: 100%;
|
| 93 |
+
padding: 16px 22px;
|
| 94 |
+
border: 2px solid rgba(218, 165, 32, 0.25);
|
| 95 |
+
border-radius: 16px;
|
| 96 |
+
font-size: 16px;
|
| 97 |
transition: all 0.3s ease;
|
| 98 |
+
background: rgba(255, 255, 255, 0.9);
|
| 99 |
color: #333;
|
| 100 |
}
|
| 101 |
|
| 102 |
+
input:focus {
|
| 103 |
border-color: #DAA520;
|
| 104 |
+
background: white;
|
| 105 |
+
box-shadow: 0 0 25px rgba(218, 165, 32, 0.2);
|
| 106 |
outline: none;
|
| 107 |
+
transform: translateY(-2px);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
}
|
| 109 |
|
| 110 |
button {
|
|
|
|
| 112 |
padding: 16px;
|
| 113 |
background: linear-gradient(135deg, #DAA520 0%, #FFD700 100%);
|
| 114 |
border: none;
|
| 115 |
+
border-radius: 16px;
|
| 116 |
color: #000;
|
| 117 |
font-size: 18px;
|
| 118 |
font-weight: 600;
|
| 119 |
cursor: pointer;
|
| 120 |
transition: all 0.3s ease;
|
| 121 |
+
margin-bottom: 22px;
|
| 122 |
position: relative;
|
| 123 |
+
overflow: hidden;
|
| 124 |
}
|
| 125 |
|
| 126 |
+
button:hover {
|
| 127 |
+
transform: translateY(-3px);
|
| 128 |
+
box-shadow: 0 8px 25px rgba(218, 165, 32, 0.3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
}
|
| 130 |
|
| 131 |
.toggle-btn {
|
| 132 |
background: transparent;
|
| 133 |
color: #DAA520;
|
| 134 |
border: 2px solid #DAA520;
|
| 135 |
+
font-weight: 500;
|
| 136 |
}
|
| 137 |
|
| 138 |
.toggle-btn:hover {
|
| 139 |
+
background: rgba(218, 165, 32, 0.1);
|
| 140 |
+
color: #DAA520;
|
| 141 |
+
transform: translateY(-2px);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
}
|
| 143 |
|
| 144 |
.message {
|
|
|
|
| 145 |
margin-top: 15px;
|
|
|
|
| 146 |
text-align: center;
|
| 147 |
+
padding: 14px;
|
| 148 |
+
border-radius: 14px;
|
| 149 |
font-size: 14px;
|
| 150 |
+
opacity: 0;
|
| 151 |
+
transition: opacity 0.3s ease;
|
| 152 |
}
|
| 153 |
|
| 154 |
.message.show {
|
| 155 |
+
opacity: 1;
|
|
|
|
| 156 |
}
|
| 157 |
|
| 158 |
+
.error {
|
| 159 |
+
color: #D32F2F;
|
| 160 |
+
background-color: rgba(255, 235, 238, 0.95);
|
| 161 |
+
border: 1px solid #FFCDD2;
|
| 162 |
}
|
| 163 |
|
| 164 |
+
.success {
|
| 165 |
+
color: #388E3C;
|
| 166 |
+
background-color: rgba(232, 245, 233, 0.95);
|
| 167 |
+
border: 1px solid #C8E6C9;
|
| 168 |
}
|
| 169 |
|
| 170 |
+
.terms {
|
| 171 |
+
text-align: center;
|
| 172 |
+
font-size: 14px;
|
| 173 |
+
margin-top: 20px;
|
| 174 |
+
color: #666;
|
| 175 |
+
line-height: 1.6;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
}
|
| 177 |
|
| 178 |
+
.terms a {
|
| 179 |
+
color: #DAA520;
|
| 180 |
+
text-decoration: none;
|
| 181 |
+
font-weight: 500;
|
| 182 |
+
transition: color 0.3s ease;
|
| 183 |
}
|
| 184 |
|
| 185 |
+
.terms a:hover {
|
| 186 |
+
color: #FFD700;
|
|
|
|
| 187 |
}
|
| 188 |
|
| 189 |
+
@media (max-width: 480px) {
|
| 190 |
.container {
|
| 191 |
width: 100%;
|
| 192 |
+
max-width: 380px;
|
| 193 |
}
|
| 194 |
+
|
| 195 |
.form-box {
|
| 196 |
+
padding: 30px 25px;
|
| 197 |
}
|
| 198 |
|
| 199 |
h2 {
|
| 200 |
+
font-size: 28px;
|
| 201 |
+
margin-bottom: 25px;
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
input {
|
| 205 |
+
padding: 14px 20px;
|
| 206 |
+
font-size: 15px;
|
| 207 |
}
|
| 208 |
|
| 209 |
+
button {
|
| 210 |
+
padding: 14px;
|
| 211 |
+
font-size: 16px;
|
|
|
|
| 212 |
}
|
| 213 |
}
|
| 214 |
+
|
| 215 |
+
/* إضافة تأثيرات حركية */
|
| 216 |
+
@keyframes fadeIn {
|
| 217 |
+
from { opacity: 0; transform: translateY(20px); }
|
| 218 |
+
to { opacity: 1; transform: translateY(0); }
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
.form-box {
|
| 222 |
+
animation: fadeIn 0.6s ease-out;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
input::placeholder {
|
| 226 |
+
color: #999;
|
| 227 |
+
transition: color 0.3s ease;
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
input:focus::placeholder {
|
| 231 |
+
color: #DAA520;
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
/* تحسين تأثيرات التحميل */
|
| 235 |
+
button.loading {
|
| 236 |
+
position: relative;
|
| 237 |
+
pointer-events: none;
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
button.loading::after {
|
| 241 |
+
content: '';
|
| 242 |
+
position: absolute;
|
| 243 |
+
width: 20px;
|
| 244 |
+
height: 20px;
|
| 245 |
+
top: 50%;
|
| 246 |
+
left: 50%;
|
| 247 |
+
margin: -10px 0 0 -10px;
|
| 248 |
+
border: 2px solid rgba(0, 0, 0, 0.1);
|
| 249 |
+
border-left-color: #000;
|
| 250 |
+
border-radius: 50%;
|
| 251 |
+
animation: spin 1s linear infinite;
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
@keyframes spin {
|
| 255 |
+
to { transform: rotate(360deg); }
|
| 256 |
+
}
|
| 257 |
</style>
|
| 258 |
</head>
|
| 259 |
<body>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
<div class="container">
|
| 261 |
<div class="forms-container">
|
|
|
|
| 262 |
<div class="form-box login-form">
|
| 263 |
+
<h2>مرحباً بعودتك</h2>
|
| 264 |
+
<div class="input-group">
|
| 265 |
+
<input type="text" id="loginUsername" placeholder="البريد الإلكتروني">
|
| 266 |
+
</div>
|
| 267 |
+
<div class="input-group">
|
| 268 |
+
<input type="password" id="loginPassword" placeholder="كلمة المرور">
|
| 269 |
+
</div>
|
| 270 |
+
<button onclick="login()">تسجيل الدخول</button>
|
| 271 |
+
<div id="loginMessage" class="message"></div>
|
| 272 |
+
<div class="toggle-form">
|
| 273 |
+
<button class="toggle-btn" onclick="toggleForm()">إنشاء حساب جديد</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
</div>
|
| 275 |
</div>
|
| 276 |
|
|
|
|
| 277 |
<div class="form-box register-form">
|
| 278 |
+
<h2>حساب جديد</h2>
|
| 279 |
+
<div class="input-group">
|
| 280 |
+
<input type="text" id="registerLawFirm" placeholder="اسم المكتب">
|
| 281 |
+
</div>
|
| 282 |
+
<div class="input-group">
|
| 283 |
+
<input type="text" id="registerLawyerName" placeholder="اسم المحامي">
|
| 284 |
+
</div>
|
| 285 |
+
<div class="input-group">
|
| 286 |
+
<input type="text" id="registerPosition" placeholder="المرتبة في المكتب">
|
| 287 |
+
</div>
|
| 288 |
+
<div class="input-group">
|
| 289 |
+
<input type="tel" id="registerPhone" placeholder="رقم الهاتف">
|
| 290 |
+
</div>
|
| 291 |
+
<div class="input-group">
|
| 292 |
+
<input type="text" id="registerUsername" placeholder="البريد الإلكتروني">
|
| 293 |
+
</div>
|
| 294 |
+
<div class="input-group">
|
| 295 |
+
<input type="password" id="registerPassword" placeholder="كلمة المرور">
|
| 296 |
+
</div>
|
| 297 |
+
<button onclick="register()">إنشاء الحساب</button>
|
| 298 |
+
<div id="registerMessage" class="message"></div>
|
| 299 |
+
<div class="toggle-form">
|
| 300 |
+
<button class="toggle-btn" onclick="toggleForm()">العودة لتسجيل الدخول</button>
|
| 301 |
+
</div>
|
| 302 |
+
<div class="terms">
|
| 303 |
+
بالتسجيل، أنت توافق على <a href="https://ufastpro.com/%d8%b3%d9%8a%d8%a7%d8%b3%d8%a9-%d8%a7%d9%84%d8%a7%d8%b3%d8%aa%d8%ae%d8%af%d8%a7%d9%85/" target="_blank">سياسة الاستخدام</a> و<a href="https://ufastpro.com/%d8%b3%d9%8a%d8%a7%d8%b3%d8%a9-%d8%a7%d9%84%d8%ae%d8%b5%d9%88%d8%b5%d9%8a%d8%a9/" target="_blank">سياسة الخصوصية</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 304 |
</div>
|
| 305 |
</div>
|
| 306 |
</div>
|
| 307 |
</div>
|
| 308 |
|
| 309 |
<script>
|
| 310 |
+
const API_URL = 'https://j8fp9mu44k547j-7777.proxy.runpod.net/proxy/6500/api';
|
| 311 |
+
|
| 312 |
+
function toggleForm() {
|
| 313 |
+
document.querySelector('.forms-container').classList.toggle('flipped');
|
| 314 |
+
clearMessages();
|
| 315 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 316 |
|
| 317 |
+
function clearMessages() {
|
| 318 |
+
document.querySelectorAll('.message').forEach(msg => {
|
| 319 |
+
msg.className = 'message';
|
| 320 |
+
});
|
| 321 |
+
}
|
| 322 |
|
| 323 |
+
function showMessage(elementId, message, isError = false) {
|
| 324 |
+
const element = document.getElementById(elementId);
|
| 325 |
+
element.textContent = message;
|
| 326 |
+
element.className = `message ${isError ? 'error' : 'success'} show`;
|
| 327 |
setTimeout(() => {
|
| 328 |
+
element.className = 'message';
|
| 329 |
+
}, 3000);
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
async function login() {
|
| 333 |
+
const username = document.getElementById('loginUsername').value;
|
| 334 |
+
const password = document.getElementById('loginPassword').value;
|
| 335 |
+
|
| 336 |
+
if (!username || !password) {
|
| 337 |
+
showMessage('loginMessage', 'الرجاء إدخال جميع البيانات المطلوبة', true);
|
| 338 |
+
return;
|
| 339 |
+
}
|
| 340 |
+
|
| 341 |
+
if (!isValidEmail(username)) {
|
| 342 |
+
showMessage('loginMessage', 'الرجاء إدخال بريد إلكتروني صحيح', true);
|
| 343 |
+
return;
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
try {
|
| 347 |
+
const response = await fetch(`${API_URL}/login`, {
|
| 348 |
+
method: 'POST',
|
| 349 |
+
headers: {
|
| 350 |
+
'Content-Type': 'application/json'
|
| 351 |
+
},
|
| 352 |
+
body: JSON.stringify({ username, password })
|
| 353 |
+
});
|
| 354 |
+
|
| 355 |
+
const data = await response.json();
|
| 356 |
+
|
| 357 |
+
if (response.ok) {
|
| 358 |
+
showMessage('loginMessage', 'تم تسجيل الدخول بنجاح');
|
| 359 |
+
setTimeout(() => {
|
| 360 |
+
window.location.href = data.redirect_url;
|
| 361 |
+
}, 1000);
|
| 362 |
+
} else {
|
| 363 |
+
showMessage('loginMessage', data.detail, true);
|
| 364 |
+
}
|
| 365 |
+
} catch (error) {
|
| 366 |
+
showMessage('loginMessage', 'حدث خطأ في الاتصال', true);
|
| 367 |
+
}
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
async function register() {
|
| 371 |
+
const lawFirm = document.getElementById('registerLawFirm').value;
|
| 372 |
+
const lawyerName = document.getElementById('registerLawyerName').value;
|
| 373 |
+
const position = document.getElementById('registerPosition').value;
|
| 374 |
+
const phone = document.getElementById('registerPhone').value;
|
| 375 |
+
const username = document.getElementById('registerUsername').value;
|
| 376 |
+
const password = document.getElementById('registerPassword').value;
|
| 377 |
+
|
| 378 |
+
if (!lawFirm || !lawyerName || !position || !phone || !username || !password) {
|
| 379 |
+
showMessage('registerMessage', 'الرجاء إدخال جميع البيانات المطلوبة', true);
|
| 380 |
+
return;
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
if (!isValidEmail(username)) {
|
| 384 |
+
showMessage('registerMessage', 'الرجاء إدخال بريد إلكتروني صحيح', true);
|
| 385 |
+
return;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
if (!isValidPhone(phone)) {
|
| 389 |
+
showMessage('registerMessage', 'الرجاء إدخال رقم هاتف صحيح', true);
|
| 390 |
+
return;
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
if (password.length < 8) {
|
| 394 |
+
showMessage('registerMessage', 'كلمة المرور يجب أن تكون 8 أحرف على الأقل', true);
|
| 395 |
+
return;
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
try {
|
| 399 |
+
const response = await fetch(`${API_URL}/register`, {
|
| 400 |
+
method: 'POST',
|
| 401 |
+
headers: {
|
| 402 |
+
'Content-Type': 'application/json'
|
| 403 |
+
},
|
| 404 |
+
body: JSON.stringify({
|
| 405 |
+
username,
|
| 406 |
+
password,
|
| 407 |
+
law_firm: lawFirm,
|
| 408 |
+
lawyer_name: lawyerName,
|
| 409 |
+
position: position,
|
| 410 |
+
phone: phone
|
| 411 |
+
})
|
| 412 |
+
});
|
| 413 |
+
|
| 414 |
+
const data = await response.json();
|
| 415 |
+
|
| 416 |
+
if (response.ok) {
|
| 417 |
+
showMessage('registerMessage', 'تم إنشاء الحساب بنجاح');
|
| 418 |
+
document.getElementById('registerLawFirm').value = '';
|
| 419 |
+
document.getElementById('registerLawyerName').value = '';
|
| 420 |
+
document.getElementById('registerPosition').value = '';
|
| 421 |
+
document.getElementById('registerPhone').value = '';
|
| 422 |
+
document.getElementById('registerUsername').value = '';
|
| 423 |
+
document.getElementById('registerPassword').value = '';
|
| 424 |
+
setTimeout(() => {
|
| 425 |
+
toggleForm();
|
| 426 |
+
}, 1500);
|
| 427 |
+
} else {
|
| 428 |
+
showMessage('registerMessage', data.detail, true);
|
| 429 |
+
}
|
| 430 |
+
} catch (error) {
|
| 431 |
+
showMessage('registerMessage', 'حدث خطأ في الاتصال', true);
|
| 432 |
+
}
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
function isValidEmail(email) {
|
| 436 |
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
| 437 |
+
}
|
| 438 |
+
|
| 439 |
+
function isValidPhone(phone) {
|
| 440 |
+
return /^(\+966|05)\d{8,9}$/.test(phone);
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
// تحسين تجربة المستخدم مع استجابة زر Enter
|
| 444 |
+
document.querySelectorAll('input').forEach(input => {
|
| 445 |
+
input.addEventListener('keypress', (e) => {
|
| 446 |
+
if (e.key === 'Enter') {
|
| 447 |
+
const form = input.closest('.form-box');
|
| 448 |
+
if (form.classList.contains('login-form')) {
|
| 449 |
+
login();
|
| 450 |
+
} else {
|
| 451 |
+
register();
|
| 452 |
+
}
|
| 453 |
+
}
|
| 454 |
+
});
|
| 455 |
});
|
| 456 |
|
| 457 |
+
// تأثيرات تحميل الأزرار
|
| 458 |
+
document.querySelectorAll('button:not(.toggle-btn)').forEach(button => {
|
| 459 |
+
button.addEventListener('click', function() {
|
| 460 |
+
if (this.classList.contains('loading')) return;
|
| 461 |
+
|
| 462 |
+
this.classList.add('loading');
|
| 463 |
+
const originalText = this.textContent;
|
| 464 |
+
this.textContent = '...جاري التنفيذ';
|
| 465 |
+
|
| 466 |
+
setTimeout(() => {
|
| 467 |
+
this.textContent = originalText;
|
| 468 |
+
this.classList.remove('loading');
|
| 469 |
+
}, 2000);
|
| 470 |
+
});
|
| 471 |
+
});
|
| 472 |
+
|
| 473 |
+
// التحقق من صحة رقم الهاتف المصري
|
| 474 |
+
function isValidPhone(phone) {
|
| 475 |
+
const egyptianPattern = /^(010|011|012|015)\d{8}$/;
|
| 476 |
+
return egyptianPattern.test(phone);
|
| 477 |
+
}
|
| 478 |
|
| 479 |
+
// تنسيق رقم الهاتف تلقائيًا
|
| 480 |
+
document.getElementById('registerPhone').addEventListener('input', function (e) {
|
| 481 |
+
let value = e.target.value.replace(/\D/g, ''); // إزالة أي أحرف غير رقمية
|
| 482 |
|
| 483 |
+
if (value.startsWith('20')) {
|
| 484 |
+
// إذا بدأ بـ 20، نضيف +20
|
| 485 |
+
value = '+' + value;
|
| 486 |
+
} else if (value.startsWith('1')) {
|
| 487 |
+
// إذا بدأ بـ 1، نضيف 0
|
| 488 |
+
value = '0' + value;
|
| 489 |
+
}
|
| 490 |
|
| 491 |
+
e.target.value = value;
|
| 492 |
+
});
|
| 493 |
+
|
| 494 |
+
// تفعيل تأثيرات الظهور التدريجي
|
| 495 |
+
document.addEventListener('DOMContentLoaded', function () {
|
| 496 |
+
document.body.style.opacity = '0';
|
| 497 |
+
requestAnimationFrame(() => {
|
| 498 |
+
document.body.style.opacity = '1';
|
| 499 |
+
});
|
| 500 |
+
});
|
| 501 |
+
|
| 502 |
+
// تحسين تجربة المستخدم في حقول الإدخال
|
| 503 |
+
document.querySelectorAll('input').forEach(input => {
|
| 504 |
+
input.addEventListener('focus', () => {
|
| 505 |
+
input.parentElement.classList.add('focused'); // إضافة تأثير عند التركيز
|
| 506 |
+
});
|
| 507 |
+
|
| 508 |
+
input.addEventListener('blur', () => {
|
| 509 |
+
if (!input.value) {
|
| 510 |
+
input.parentElement.classList.remove('focused'); // إزالة التأثير إذا كان الحقل فارغًا
|
| 511 |
+
}
|
| 512 |
+
});
|
| 513 |
+
});
|
| 514 |
+
|
| 515 |
+
// منع الأحداث الافتراضية غير المرغوب فيها على الأزرار
|
| 516 |
+
document.querySelectorAll('button').forEach(button => {
|
| 517 |
+
button.addEventListener('mousedown', (e) => e.preventDefault());
|
| 518 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 519 |
</script>
|
| 520 |
</body>
|
| 521 |
</html>
|