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, initial-scale=1.0">
|
| 6 |
+
<title>Secure Chat | Liquid Login</title>
|
| 7 |
+
|
| 8 |
+
<!-- Tailwind CSS -->
|
| 9 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 10 |
+
|
| 11 |
+
<!-- Phosphor Icons (Modern & Clean) -->
|
| 12 |
+
<script src="https://unpkg.com/@phosphor-icons/web"></script>
|
| 13 |
+
|
| 14 |
+
<!-- Google Fonts: Vazirmatn for Persian Typography -->
|
| 15 |
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
| 16 |
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
| 17 |
+
<link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@100;300;400;500;700&display=swap" rel="stylesheet">
|
| 18 |
+
|
| 19 |
+
<style>
|
| 20 |
+
/*
|
| 21 |
+
* Core Styling & Animations
|
| 22 |
+
*/
|
| 23 |
+
body {
|
| 24 |
+
font-family: 'Vazirmatn', sans-serif;
|
| 25 |
+
background-color: #050505;
|
| 26 |
+
overflow: hidden; /* Prevent scroll on mobile during animations */
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/* Animated Background Mesh */
|
| 30 |
+
.bg-mesh {
|
| 31 |
+
position: fixed;
|
| 32 |
+
top: 0;
|
| 33 |
+
left: 0;
|
| 34 |
+
width: 100vw;
|
| 35 |
+
height: 100vh;
|
| 36 |
+
z-index: -1;
|
| 37 |
+
background: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #000000 100%);
|
| 38 |
+
overflow: hidden;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
.orb {
|
| 42 |
+
position: absolute;
|
| 43 |
+
border-radius: 50%;
|
| 44 |
+
filter: blur(80px);
|
| 45 |
+
opacity: 0.6;
|
| 46 |
+
animation: float 10s infinite ease-in-out alternate;
|
| 47 |
+
}
|
| 48 |
+
|
| 49 |
+
.orb-1 { width: 400px; height: 400px; background: #4f46e5; top: -10%; left: -10%; animation-delay: 0s; }
|
| 50 |
+
.orb-2 { width: 300px; height: 300px; background: #ec4899; bottom: 10%; right: -5%; animation-delay: -2s; }
|
| 51 |
+
.orb-3 { width: 200px; height: 200px; background: #06b6d4; top: 40%; left: 40%; animation-delay: -4s; }
|
| 52 |
+
|
| 53 |
+
@keyframes float {
|
| 54 |
+
0% { transform: translate(0, 0) scale(1); }
|
| 55 |
+
100% { transform: translate(30px, 50px) scale(1.1); }
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/*
|
| 59 |
+
* The "Liquid Glass" Effect
|
| 60 |
+
* Uses backdrop-filter to blur whatever is behind the element.
|
| 61 |
+
*/
|
| 62 |
+
.glass-panel {
|
| 63 |
+
background: rgba(255, 255, 255, 0.03);
|
| 64 |
+
backdrop-filter: blur(20px);
|
| 65 |
+
-webkit-backdrop-filter: blur(20px);
|
| 66 |
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
| 67 |
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
/* Input Styling */
|
| 71 |
+
.input-group input:focus ~ label,
|
| 72 |
+
.input-group input:not(:placeholder-shown) ~ label {
|
| 73 |
+
top: -10px;
|
| 74 |
+
right: 10px;
|
| 75 |
+
font-size: 0.75rem;
|
| 76 |
+
color: #a78bfa;
|
| 77 |
+
background: rgba(0,0,0,0.8);
|
| 78 |
+
padding: 0 5px;
|
| 79 |
+
border-radius: 4px;
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
.custom-input {
|
| 83 |
+
background: rgba(0, 0, 0, 0.2);
|
| 84 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 85 |
+
transition: all 0.3s ease;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
.custom-input:focus {
|
| 89 |
+
border-color: #8b5cf6;
|
| 90 |
+
box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
|
| 91 |
+
outline: none;
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
/* Button Shimmer */
|
| 95 |
+
.btn-primary {
|
| 96 |
+
background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
|
| 97 |
+
position: relative;
|
| 98 |
+
overflow: hidden;
|
| 99 |
+
transition: transform 0.2s;
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
.btn-primary:active {
|
| 103 |
+
transform: scale(0.98);
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
.btn-primary::after {
|
| 107 |
+
content: '';
|
| 108 |
+
position: absolute;
|
| 109 |
+
top: -50%;
|
| 110 |
+
left: -50%;
|
| 111 |
+
width: 200%;
|
| 112 |
+
height: 200%;
|
| 113 |
+
background: linear-gradient(to bottom right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0) 100%);
|
| 114 |
+
transform: rotate(45deg) translateY(-100%);
|
| 115 |
+
transition: transform 0.5s;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
.btn-primary:hover::after {
|
| 119 |
+
transform: rotate(45deg) translateY(100%);
|
| 120 |
+
}
|
| 121 |
+
|
| 122 |
+
/* Transitions */
|
| 123 |
+
.fade-enter { opacity: 0; transform: translateY(20px); }
|
| 124 |
+
.fade-enter-active { opacity: 1; transform: translateY(0); transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1); }
|
| 125 |
+
.fade-exit { opacity: 1; transform: translateY(0); }
|
| 126 |
+
.fade-exit-active { opacity: 0; transform: translateY(-20px); transition: all 0.4s ease-in; }
|
| 127 |
+
|
| 128 |
+
/* Loader */
|
| 129 |
+
.loader {
|
| 130 |
+
border: 3px solid rgba(255,255,255,0.1);
|
| 131 |
+
border-left-color: #fff;
|
| 132 |
+
border-radius: 50%;
|
| 133 |
+
width: 24px;
|
| 134 |
+
height: 24px;
|
| 135 |
+
animation: spin 1s linear infinite;
|
| 136 |
+
}
|
| 137 |
+
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
|
| 138 |
+
|
| 139 |
+
/* Success Checkmark Animation */
|
| 140 |
+
.checkmark__circle { stroke-dasharray: 166; stroke-dashoffset: 166; stroke-width: 2; stroke-miterlimit: 10; stroke: #4bb71b; fill: none; animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards; }
|
| 141 |
+
.checkmark { width: 56px; height: 56px; border-radius: 50%; display: block; stroke-width: 2; stroke: #fff; stroke-miterlimit: 10; margin: 10% auto; box-shadow: inset 0px 0px 0px #4bb71b; animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both; }
|
| 142 |
+
.checkmark__check { transform-origin: 50% 50%; stroke-dasharray: 48; stroke-dashoffset: 48; animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards; }
|
| 143 |
+
@keyframes stroke { 100% { stroke-dashoffset: 0; } }
|
| 144 |
+
@keyframes scale { 0%, 100% { transform: none; } 50% { transform: scale3d(1.1, 1.1, 1); } }
|
| 145 |
+
@keyframes fill { 100% { box-shadow: inset 0px 0px 0px 30px #4bb71b; } }
|
| 146 |
+
|
| 147 |
+
</style>
|
| 148 |
+
</head>
|
| 149 |
+
<body class="text-white flex items-center justify-center min-h-screen p-4">
|
| 150 |
+
|
| 151 |
+
<!-- Dynamic Background -->
|
| 152 |
+
<div class="bg-mesh">
|
| 153 |
+
<div class="orb orb-1"></div>
|
| 154 |
+
<div class="orb orb-2"></div>
|
| 155 |
+
<div class="orb orb-3"></div>
|
| 156 |
+
</div>
|
| 157 |
+
|
| 158 |
+
<!-- Main Container -->
|
| 159 |
+
<main id="app-container" class="glass-panel w-full max-w-md rounded-3xl p-8 relative overflow-hidden min-h-[500px] flex flex-col justify-center">
|
| 160 |
+
|
| 161 |
+
<!-- Header / Logo Area -->
|
| 162 |
+
<div class="text-center mb-8 relative z-10">
|
| 163 |
+
<div class="inline-flex items-center justify-center w-16 h-16 rounded-2xl bg-gradient-to-tr from-indigo-500 to-purple-500 mb-4 shadow-lg shadow-indigo-500/30">
|
| 164 |
+
<i class="ph-fill ph-chat-teardrop-text text-3xl text-white"></i>
|
| 165 |
+
</div>
|
| 166 |
+
<h1 class="text-2xl font-bold tracking-tight">ورود به چت روم</h1>
|
| 167 |
+
<p class="text-gray-400 text-sm mt-2">اتصال امن با پروتکل رمزنگاری شده</p>
|
| 168 |
+
</div>
|
| 169 |
+
|
| 170 |
+
<!-- VIEW 1: Phone Number Input -->
|
| 171 |
+
<div id="view-phone" class="transition-all duration-500">
|
| 172 |
+
<form id="phone-form" onsubmit="handlePhoneSubmit(event)">
|
| 173 |
+
<div class="input-group relative mb-6">
|
| 174 |
+
<input type="tel" id="phone" placeholder=" " class="custom-input w-full px-4 py-4 rounded-xl text-white text-lg tracking-widest text-center" required maxlength="11" pattern="09[0-9]{9}">
|
| 175 |
+
<label for="phone" class="absolute right-4 top-4 text-gray-400 transition-all pointer-events-none">شماره موبایل</label>
|
| 176 |
+
</div>
|
| 177 |
+
|
| 178 |
+
<!-- Captcha Simulation -->
|
| 179 |
+
<div class="mb-6 bg-black/20 rounded-xl p-3 flex items-center justify-between border border-white/5">
|
| 180 |
+
<div class="flex items-center gap-2 select-none">
|
| 181 |
+
<i class="ph-duotone ph-shield-check text-green-400 text-xl"></i>
|
| 182 |
+
<span class="font-mono text-lg tracking-widest line-through decoration-red-500/50 text-gray-300">X8kP9m</span>
|
| 183 |
+
</div>
|
| 184 |
+
<button type="button" onclick="refreshCaptcha()" class="text-gray-400 hover:text-white transition-colors">
|
| 185 |
+
<i class="ph-bold ph-arrows-clockwise"></i>
|
| 186 |
+
</button>
|
| 187 |
+
</div>
|
| 188 |
+
|
| 189 |
+
<button type="submit" class="btn-primary w-full py-4 rounded-xl font-bold text-lg shadow-lg shadow-indigo-500/20 flex items-center justify-center gap-2 group">
|
| 190 |
+
<span>دریافت کد تایید</span>
|
| 191 |
+
<i class="ph-bold ph-arrow-left group-hover:-translate-x-1 transition-transform"></i>
|
| 192 |
+
</button>
|
| 193 |
+
</form>
|
| 194 |
+
</div>
|
| 195 |
+
|
| 196 |
+
<!-- VIEW 2: Verification Code -->
|
| 197 |
+
<div id="view-code" class="hidden opacity-0 transition-all duration-500">
|
| 198 |
+
<div class="text-center mb-6">
|
| 199 |
+
<p class="text-gray-300">کد ۵ رقمی به شماره <span id="display-phone" class="text-white font-bold ltr inline-block"></span> ارسال شد.</p>
|
| 200 |
+
</div>
|
| 201 |
+
|
| 202 |
+
<form id="code-form" onsubmit="handleCodeSubmit(event)">
|
| 203 |
+
<div class="flex justify-center gap-2 mb-6 dir-ltr">
|
| 204 |
+
<!-- OTP Inputs -->
|
| 205 |
+
<input type="text" maxlength="1" class="otp-input custom-input w-12 h-14 rounded-lg text-center text-2xl font-bold focus:bg-white/10" onkeyup="moveToNext(this, 0)" onfocus="this.select()">
|
| 206 |
+
<input type="text" maxlength="1" class="otp-input custom-input w-12 h-14 rounded-lg text-center text-2xl font-bold focus:bg-white/10" onkeyup="moveToNext(this, 1)" onfocus="this.select()">
|
| 207 |
+
<input type="text" maxlength="1" class="otp-input custom-input w-12 h-14 rounded-lg text-center text-2xl font-bold focus:bg-white/10" onkeyup="moveToNext(this, 2)" onfocus="this.select()">
|
| 208 |
+
<input type="text" maxlength="1" class="otp-input custom-input w-12 h-14 rounded-lg text-center text-2xl font-bold focus:bg-white/10" onkeyup="moveToNext(this, 3)" onfocus="this.select()">
|
| 209 |
+
<input type="text" maxlength="1" class="otp-input custom-input w-12 h-14 rounded-lg text-center text-2xl font-bold focus:bg-white/10" onkeyup="moveToNext(this, 4)" onfocus="this.select()">
|
| 210 |
+
</div>
|
| 211 |
+
|
| 212 |
+
<button type="submit" class="btn-primary w-full py-4 rounded-xl font-bold text-lg shadow-lg shadow-indigo-500/20 mb-4">
|
| 213 |
+
تایید و ورود
|
| 214 |
+
</button>
|
| 215 |
+
</form>
|
| 216 |
+
|
| 217 |
+
<div class="text-center">
|
| 218 |
+
<button id="resend-btn" onclick="resendCode()" disabled class="text-sm text-gray-500 disabled:cursor-not-allowed hover:text-indigo-400 transition-colors flex items-center justify-center gap-2 mx-auto">
|
| 219 |
+
<i class="ph-bold ph-clock-counter-clockwise"></i>
|
| 220 |
+
<span id="timer-text">ارسال مجدد کد (02:00)</span>
|
| 221 |
+
</button>
|
| 222 |
+
</div>
|
| 223 |
+
|
| 224 |
+
<button onclick="goBack()" class="mt-6 w-full text-center text-gray-500 text-sm hover:text-white">
|
| 225 |
+
تغییر شماره موبایل
|
| 226 |
+
</button>
|
| 227 |
+
</div>
|
| 228 |
+
|
| 229 |
+
<!-- VIEW 3: Loading State -->
|
| 230 |
+
<div id="view-loading" class="hidden flex-col items-center justify-center absolute inset-0 bg-black/40 backdrop-blur-md z-20 rounded-3xl">
|
| 231 |
+
<div class="loader mb-4"></div>
|
| 232 |
+
<p class="text-indigo-300 animate-pulse">در حال بررسی...</p>
|
| 233 |
+
</div>
|
| 234 |
+
|
| 235 |
+
<!-- VIEW 4: Success State -->
|
| 236 |
+
<div id="view-success" class="hidden flex-col items-center justify-center text-center">
|
| 237 |
+
<div class="checkmark-wrapper mb-4">
|
| 238 |
+
<svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52">
|
| 239 |
+
<circle class="checkmark__circle" cx="26" cy="26" r="25" fill="none"/>
|
| 240 |
+
<path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/>
|
| 241 |
+
</svg>
|
| 242 |
+
</div>
|
| 243 |
+
<h2 class="text-2xl font-bold text-white mb-2">ورود موفق!</h2>
|
| 244 |
+
<p class="text-gray-400 mb-6">در حال انتقال به داشبورد...</p>
|
| 245 |
+
<button class="px-6 py-2 rounded-full border border-white/20 hover:bg-white/10 transition-colors text-sm">
|
| 246 |
+
رفتن به چت روم
|
| 247 |
+
</button>
|
| 248 |
+
</div>
|
| 249 |
+
|
| 250 |
+
</main>
|
| 251 |
+
|
| 252 |
+
<!-- Footer Credit -->
|
| 253 |
+
<div class="fixed bottom-4 text-center w-full pointer-events-none">
|
| 254 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="pointer-events-auto text-xs text-gray-600 hover:text-indigo-400 transition-colors bg-black/50 px-3 py-1 rounded-full backdrop-blur-sm border border-white/5">
|
| 255 |
+
Built with anycoder
|
| 256 |
+
</a>
|
| 257 |
+
</div>
|
| 258 |
+
|
| 259 |
+
<script>
|
| 260 |
+
// --- State Management ---
|
| 261 |
+
let currentPhone = "";
|
| 262 |
+
let countdownInterval;
|
| 263 |
+
let timeLeft = 120; // 2 minutes
|
| 264 |
+
|
| 265 |
+
// --- DOM Elements ---
|
| 266 |
+
const views = {
|
| 267 |
+
phone: document.getElementById('view-phone'),
|
| 268 |
+
code: document.getElementById('view-code'),
|
| 269 |
+
loading: document.getElementById('view-loading'),
|
| 270 |
+
success: document.getElementById('view-success')
|
| 271 |
+
};
|
| 272 |
+
|
| 273 |
+
// --- Functions ---
|
| 274 |
+
|
| 275 |
+
function handlePhoneSubmit(e) {
|
| 276 |
+
e.preventDefault();
|
| 277 |
+
const phoneInput = document.getElementById('phone');
|
| 278 |
+
currentPhone = phoneInput.value;
|
| 279 |
+
|
| 280 |
+
if(currentPhone.length !== 11) {
|
| 281 |
+
shakeElement(phoneInput);
|
| 282 |
+
return;
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
// Simulate API Call
|
| 286 |
+
showLoading(true);
|
| 287 |
+
|
| 288 |
+
setTimeout(() => {
|
| 289 |
+
showLoading(false);
|
| 290 |
+
switchView('code');
|
| 291 |
+
document.getElementById('display-phone').innerText = currentPhone;
|
| 292 |
+
startTimer();
|
| 293 |
+
// Auto focus first OTP input
|
| 294 |
+
document.querySelector('.otp-input').focus();
|
| 295 |
+
}, 1500);
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
function handleCodeSubmit(e) {
|
| 299 |
+
e.preventDefault();
|
| 300 |
+
|
| 301 |
+
// Collect OTP
|
| 302 |
+
const inputs = document.querySelectorAll('.otp-input');
|
| 303 |
+
let code = "";
|
| 304 |
+
inputs.forEach(input => code += input.value);
|
| 305 |
+
|
| 306 |
+
if(code.length < 5) {
|
| 307 |
+
inputs.forEach(i => i.style.borderColor = '#ef4444');
|
| 308 |
+
setTimeout(() => inputs.forEach(i => i.style.borderColor = ''), 1000);
|
| 309 |
+
return;
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
showLoading(true);
|
| 313 |
+
|
| 314 |
+
// Simulate Verification
|
| 315 |
+
setTimeout(() => {
|
| 316 |
+
showLoading(false);
|
| 317 |
+
switchView('success');
|
| 318 |
+
}, 2000);
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
function resendCode() {
|
| 322 |
+
if(timeLeft > 0) return;
|
| 323 |
+
|
| 324 |
+
// Reset Timer Logic
|
| 325 |
+
timeLeft = 120;
|
| 326 |
+
startTimer();
|
| 327 |
+
|
| 328 |
+
// Visual Feedback
|
| 329 |
+
const btn = document.getElementById('resend-btn');
|
| 330 |
+
const originalContent = btn.innerHTML;
|
| 331 |
+
btn.innerHTML = '<i class="ph-bold ph-paper-plane-right text-green-400"></i> <span class="text-green-400">کد ارسال شد</span>';
|
| 332 |
+
|
| 333 |
+
setTimeout(() => {
|
| 334 |
+
btn.innerHTML = originalContent;
|
| 335 |
+
}, 2000);
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
function startTimer() {
|
| 339 |
+
clearInterval(countdownInterval);
|
| 340 |
+
const btn = document.getElementById('resend-btn');
|
| 341 |
+
const text = document.getElementById('timer-text');
|
| 342 |
+
|
| 343 |
+
btn.disabled = true;
|
| 344 |
+
btn.classList.add('opacity-50');
|
| 345 |
+
|
| 346 |
+
updateTimerDisplay();
|
| 347 |
+
|
| 348 |
+
countdownInterval = setInterval(() => {
|
| 349 |
+
timeLeft--;
|
| 350 |
+
updateTimerDisplay();
|
| 351 |
+
|
| 352 |
+
if (timeLeft <= 0) {
|
| 353 |
+
clearInterval(countdownInterval);
|
| 354 |
+
btn.disabled = false;
|
| 355 |
+
btn.classList.remove('opacity-50');
|
| 356 |
+
text.innerText = "ارسال مجدد کد";
|
| 357 |
+
}
|
| 358 |
+
}, 1000);
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
function updateTimerDisplay() {
|
| 362 |
+
const minutes = Math.floor(timeLeft / 60);
|
| 363 |
+
const seconds = timeLeft % 60;
|
| 364 |
+
const formattedTime = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
|
| 365 |
+
document.getElementById('timer-text').innerText = `ارسال مجدد کد (${formattedTime})`;
|
| 366 |
+
}
|
| 367 |
+
|
| 368 |
+
// --- Navigation Helpers ---
|
| 369 |
+
|
| 370 |
+
function switchView(viewName) {
|
| 371 |
+
// Hide all views
|
| 372 |
+
Object.values(views).forEach(el => {
|
| 373 |
+
if(!el.classList.contains('hidden')) {
|
| 374 |
+
el.classList.add('fade-exit-active');
|
| 375 |
+
setTimeout(() => {
|
| 376 |
+
el.classList.add('hidden');
|
| 377 |
+
el.classList.remove('fade-exit-active');
|
| 378 |
+
}, 400);
|
| 379 |
+
}
|
| 380 |
+
});
|
| 381 |
+
|
| 382 |
+
// Show target view
|
| 383 |
+
const target = views[viewName];
|
| 384 |
+
target.classList.remove('hidden');
|
| 385 |
+
target.classList.add('fade-enter');
|
| 386 |
+
|
| 387 |
+
// Trigger reflow
|
| 388 |
+
void target.offsetWidth;
|
| 389 |
+
|
| 390 |
+
target.classList.add('fade-enter-active');
|
| 391 |
+
setTimeout(() => {
|
| 392 |
+
target.classList.remove('fade-enter', 'fade-enter-active');
|
| 393 |
+
}, 500);
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
function goBack() {
|
| 397 |
+
clearInterval(countdownInterval);
|
| 398 |
+
switchView('phone');
|
| 399 |
+
document.getElementById('phone').value = "";
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
function showLoading(show) {
|
| 403 |
+
if(show) {
|
| 404 |
+
views.loading.classList.remove('hidden');
|
| 405 |
+
views.loading.classList.add('flex');
|
| 406 |
+
} else {
|
| 407 |
+
views.loading.classList.add('hidden');
|
| 408 |
+
views.loading.classList.remove('flex');
|
| 409 |
+
}
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
function shakeElement(element) {
|
| 413 |
+
element.animate([
|
| 414 |
+
{ transform: 'translateX(0)' },
|
| 415 |
+
{ transform: 'translateX(-5px)' },
|
| 416 |
+
{ transform: 'translateX(5px)' },
|
| 417 |
+
{ transform: 'translateX(-5px)' },
|
| 418 |
+
{ transform: 'translateX(0)' }
|
| 419 |
+
], {
|
| 420 |
+
duration: 300,
|
| 421 |
+
iterations: 1
|
| 422 |
+
});
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
function refreshCaptcha() {
|
| 426 |
+
const icon = document.querySelector('.ph-arrows-clockwise');
|
| 427 |
+
icon.classList.add('animate-spin');
|
| 428 |
+
setTimeout(() => icon.classList.remove('animate-spin'), 500);
|
| 429 |
+
// In a real app, this would fetch a new captcha image/key
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
// --- OTP Input Logic ---
|
| 433 |
+
function moveToNext(input, index) {
|
| 434 |
+
// Allow only numbers
|
| 435 |
+
input.value = input.value.replace(/[^0-9]/g, '');
|
| 436 |
+
|
| 437 |
+
const inputs = document.querySelectorAll('.otp-input');
|
| 438 |
+
|
| 439 |
+
if (input.value && index < inputs.length - 1) {
|
| 440 |
+
inputs[index + 1].focus();
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
// Handle Backspace
|
| 444 |
+
input.addEventListener('keydown', (e) => {
|
| 445 |
+
if (e.key === 'Backspace' && !input.value && index > 0) {
|
| 446 |
+
inputs[index - 1].focus();
|
| 447 |
+
}
|
| 448 |
+
});
|
| 449 |
+
}
|
| 450 |
+
|
| 451 |
+
// Initialize
|
| 452 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 453 |
+
// Optional: Add parallax effect to orbs on mouse move
|
| 454 |
+
document.addEventListener('mousemove', (e) => {
|
| 455 |
+
const x = e.clientX / window.innerWidth;
|
| 456 |
+
const y = e.clientY / window.innerHeight;
|
| 457 |
+
|
| 458 |
+
document.querySelectorAll('.orb').forEach((orb, index) => {
|
| 459 |
+
const speed = (index + 1) * 20;
|
| 460 |
+
orb.style.transform = `translate(${x * speed}px, ${y * speed}px)`;
|
| 461 |
+
});
|
| 462 |
+
});
|
| 463 |
+
});
|
| 464 |
+
|
| 465 |
+
</script>
|
| 466 |
+
</body>
|
| 467 |
+
</html>
|