Spaces:
Running
Running
File size: 14,368 Bytes
274138e 46987dc | 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 | <!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>قفل الجوال الذكي</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<script>
tailwind.config = {
darkMode: 'class',
theme: {
extend: {
colors: {
primary: '#4F46E5',
dark: '#1E293B',
darker: '#0F172A'
}
}
}
}
</script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;900&display=swap');
body {
font-family: 'Tajawal', sans-serif;
}
.progress-ring__circle {
transition: stroke-dashoffset 0.5s;
transform: rotate(-90deg);
transform-origin: 50% 50%;
}
.flip-animation {
animation: flip 0.5s ease-out;
}
@keyframes flip {
0% { transform: rotateX(0deg); }
50% { transform: rotateX(90deg); }
100% { transform: rotateX(0deg); }
}
</style>
</head>
<body class="bg-gray-50 dark:bg-darker text-gray-800 dark:text-gray-200 min-h-screen">
<div class="container mx-auto px-4 py-8">
<!-- Header -->
<header class="flex justify-between items-center mb-8">
<h1 class="text-2xl font-bold text-primary">قفل الجوال الذكي</h1>
<button id="themeToggle" class="p-2 rounded-full bg-gray-200 dark:bg-dark">
<i data-feather="moon" class="text-gray-700 dark:text-yellow-300"></i>
</button>
</header>
<!-- Timer Display -->
<div class="bg-white dark:bg-dark rounded-xl shadow-lg p-6 mb-8 text-center">
<div class="relative w-64 h-64 mx-auto mb-6">
<svg class="w-full h-full" viewBox="0 0 100 100">
<circle class="text-gray-200 dark:text-gray-700" stroke-width="8" stroke="currentColor" fill="transparent" r="40" cx="50" cy="50"/>
<circle class="progress-ring__circle text-primary" stroke-width="8" stroke-dasharray="251.2" stroke-dashoffset="0" stroke-linecap="round" stroke="currentColor" fill="transparent" r="40" cx="50" cy="50"/>
</svg>
<div class="absolute inset-0 flex flex-col items-center justify-center">
<div id="timeDisplay" class="text-4xl font-bold">01:00:00</div>
<div id="statusText" class="text-gray-500 dark:text-gray-400">جاهز للبدء</div>
</div>
</div>
<div class="flex justify-center space-x-4 mb-6">
<button id="startBtn" class="bg-primary hover:bg-indigo-700 text-white px-6 py-2 rounded-full font-medium transition">
بدء القفل
</button>
<button id="stopBtn" class="bg-red-500 hover:bg-red-600 text-white px-6 py-2 rounded-full font-medium transition hidden">
إيقاف
</button>
</div>
</div>
<!-- Quick Presets -->
<div class="mb-8">
<h2 class="text-xl font-semibold mb-4">وقت سريع</h2>
<div class="grid grid-cols-3 gap-3">
<button data-minutes="30" class="quick-time bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 py-3 rounded-lg transition">30 دقيقة</button>
<button data-minutes="60" class="quick-time bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 py-3 rounded-lg transition">1 ساعة</button>
<button data-minutes="120" class="quick-time bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 py-3 rounded-lg transition">2 ساعة</button>
</div>
</div>
<!-- Custom Time -->
<div class="mb-8">
<h2 class="text-xl font-semibold mb-4">تخصيص الوقت</h2>
<div class="bg-white dark:bg-dark rounded-xl shadow-lg p-4">
<div class="flex items-center justify-between mb-4">
<span class="font-medium">الساعات:</span>
<div class="flex items-center">
<button id="hourDec" class="px-3 py-1 bg-gray-100 dark:bg-gray-700 rounded-l-lg">-</button>
<span id="hourValue" class="px-4 py-1 bg-gray-50 dark:bg-gray-600">1</span>
<button id="hourInc" class="px-3 py-1 bg-gray-100 dark:bg-gray-700 rounded-r-lg">+</button>
</div>
</div>
<div class="flex items-center justify-between">
<span class="font-medium">الدقائق:</span>
<div class="flex items-center">
<button id="minuteDec" class="px-3 py-1 bg-gray-100 dark:bg-gray-700 rounded-l-lg">-</button>
<span id="minuteValue" class="px-4 py-1 bg-gray-50 dark:bg-gray-600">0</span>
<button id="minuteInc" class="px-3 py-1 bg-gray-100 dark:bg-gray-700 rounded-r-lg">+</button>
</div>
</div>
</div>
</div>
<!-- History -->
<div>
<h2 class="text-xl font-semibold mb-4">سجل الأوقات</h2>
<div class="bg-white dark:bg-dark rounded-xl shadow-lg overflow-hidden">
<div class="divide-y divide-gray-200 dark:divide-gray-700">
<div class="p-4 flex justify-between items-center">
<div>
<div class="font-medium">قفل كامل</div>
<div class="text-sm text-gray-500 dark:text-gray-400">اليوم 10:30 ص</div>
</div>
<div class="text-primary font-bold">45 دقيقة</div>
</div>
<div class="p-4 flex justify-between items-center">
<div>
<div class="font-medium">قفل كامل</div>
<div class="text-sm text-gray-500 dark:text-gray-400">أمس 3:15 م</div>
</div>
<div class="text-primary font-bold">1 ساعة</div>
</div>
</div>
</div>
</div>
</div>
<!-- Lock Screen Modal -->
<div id="lockScreen" class="fixed inset-0 bg-darker text-white z-50 flex flex-col items-center justify-center hidden">
<div class="text-center mb-8">
<i data-feather="lock" class="w-16 h-16 mx-auto mb-4 text-red-500"></i>
<h1 class="text-3xl font-bold mb-2">الجوال مقفل</h1>
<div id="lockTimeDisplay" class="text-5xl font-mono font-bold mb-4">01:00:00</div>
<p class="text-gray-400">سيتم فتح القفل تلقائياً عند انتهاء الوقت</p>
</div>
<button id="emergencyBtn" class="px-6 py-2 bg-red-500 hover:bg-red-600 rounded-full font-medium">
فتح الطوارئ (3 محاولات)
</button>
</div>
<script>
feather.replace();
// Theme Toggle
const themeToggle = document.getElementById('themeToggle');
themeToggle.addEventListener('click', () => {
document.documentElement.classList.toggle('dark');
const icon = themeToggle.querySelector('i');
if (document.documentElement.classList.contains('dark')) {
icon.setAttribute('data-feather', 'sun');
} else {
icon.setAttribute('data-feather', 'moon');
}
feather.replace();
});
// Timer Logic
let timer;
let totalSeconds = 3600; // 1 hour default
let isRunning = false;
const timeDisplay = document.getElementById('timeDisplay');
const lockTimeDisplay = document.getElementById('lockTimeDisplay');
const statusText = document.getElementById('statusText');
const startBtn = document.getElementById('startBtn');
const stopBtn = document.getElementById('stopBtn');
const lockScreen = document.getElementById('lockScreen');
const hourValue = document.getElementById('hourValue');
const minuteValue = document.getElementById('minuteValue');
const circle = document.querySelector('.progress-ring__circle');
const circumference = 2 * Math.PI * 40;
// Set initial progress ring
circle.style.strokeDasharray = circumference;
circle.style.strokeDashoffset = 0;
// Format time
function formatTime(seconds) {
const hrs = Math.floor(seconds / 3600);
const mins = Math.floor((seconds % 3600) / 60);
const secs = seconds % 60;
return `${hrs.toString().padStart(2, '0')}:${mins.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`;
}
// Update timer display
function updateDisplay() {
timeDisplay.textContent = formatTime(totalSeconds);
lockTimeDisplay.textContent = formatTime(totalSeconds);
// Update progress ring
const offset = circumference - (totalSeconds / (totalSeconds + 1)) * circumference;
circle.style.strokeDashoffset = offset;
}
// Start timer
function startTimer() {
if (isRunning) return;
isRunning = true;
startBtn.classList.add('hidden');
stopBtn.classList.remove('hidden');
statusText.textContent = 'جاري التشغيل...';
// Show lock screen (simulating full phone lock)
lockScreen.classList.remove('hidden');
document.body.style.overflow = 'hidden';
timer = setInterval(() => {
if (totalSeconds <= 0) {
clearInterval(timer);
isRunning = false;
statusText.textContent = 'تم الانتهاء!';
lockScreen.classList.add('hidden');
document.body.style.overflow = 'auto';
// Play completion sound (simulated)
const audio = new Audio('https://assets.mixkit.co/sfx/preview/mixkit-alarm-digital-clock-beep-989.mp3');
audio.play();
return;
}
totalSeconds--;
updateDisplay();
// Add animation every minute
if (totalSeconds % 60 === 0) {
timeDisplay.classList.add('flip-animation');
setTimeout(() => {
timeDisplay.classList.remove('flip-animation');
}, 500);
}
}, 1000);
}
// Stop timer
function stopTimer() {
clearInterval(timer);
isRunning = false;
startBtn.classList.remove('hidden');
stopBtn.classList.add('hidden');
statusText.textContent = 'متوقف';
lockScreen.classList.add('hidden');
document.body.style.overflow = 'auto';
}
// Quick time buttons
document.querySelectorAll('.quick-time').forEach(button => {
button.addEventListener('click', () => {
const minutes = parseInt(button.getAttribute('data-minutes'));
totalSeconds = minutes * 60;
hourValue.textContent = Math.floor(minutes / 60);
minuteValue.textContent = minutes % 60;
updateDisplay();
});
});
// Custom time controls
document.getElementById('hourInc').addEventListener('click', () => {
let hours = parseInt(hourValue.textContent);
hours = Math.min(23, hours + 1);
hourValue.textContent = hours;
updateTotalSeconds();
});
document.getElementById('hourDec').addEventListener('click', () => {
let hours = parseInt(hourValue.textContent);
hours = Math.max(0, hours - 1);
hourValue.textContent = hours;
updateTotalSeconds();
});
document.getElementById('minuteInc').addEventListener('click', () => {
let minutes = parseInt(minuteValue.textContent);
minutes = (minutes + 5) % 60;
minuteValue.textContent = minutes;
updateTotalSeconds();
});
document.getElementById('minuteDec').addEventListener('click', () => {
let minutes = parseInt(minuteValue.textContent);
minutes = (minutes - 5 + 60) % 60;
minuteValue.textContent = minutes;
updateTotalSeconds();
});
function updateTotalSeconds() {
const hours = parseInt(hourValue.textContent);
const minutes = parseInt(minuteValue.textContent);
totalSeconds = hours * 3600 + minutes * 60;
updateDisplay();
}
// Button events
startBtn.addEventListener('click', startTimer);
stopBtn.addEventListener('click', stopTimer);
// Emergency button (simulated)
let emergencyAttempts = 3;
document.getElementById('emergencyBtn').addEventListener('click', () => {
emergencyAttempts--;
if (emergencyAttempts <= 0) {
alert('لقد استنفذت جميع محاولات الطوارئ! يرجى الانتظار حتى انتهاء الوقت.');
return;
}
alert(`محاولة طوارئ! لديك ${emergencyAttempts} محاولات متبقية. هذه الميزة ستحتاج إلى كلمة مرور في التطبيق الفعلي.`);
});
// Initialize
updateDisplay();
</script>
</body>
</html>
|