| <!DOCTYPE html> |
| <html lang="fa" dir="rtl"> |
| <head> |
| <meta charset="UTF-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| <title>کنترلگر هوشمند بازی - Tank Stars</title> |
| <script src="https://cdn.tailwindcss.com"></script> |
| <link href="https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css" rel="stylesheet" type="text/css" /> |
| <style> |
| body { |
| font-family: 'Vazirmatn', sans-serif; |
| background-color: #0f172a; |
| color: white; |
| overflow: hidden; |
| } |
| |
| |
| #game-container { |
| position: relative; |
| width: 100vw; |
| height: 100vh; |
| z-index: 1; |
| } |
| |
| iframe { |
| width: 100%; |
| height: 100%; |
| border: none; |
| display: block; |
| } |
| |
| |
| #lock-overlay { |
| position: absolute; |
| top: 0; |
| left: 0; |
| width: 100%; |
| height: 100%; |
| background: rgba(15, 23, 42, 0.95); |
| backdrop-filter: blur(10px); |
| z-index: 9999; |
| display: flex; |
| flex-direction: column; |
| justify-content: center; |
| align-items: center; |
| text-align: center; |
| opacity: 0; |
| pointer-events: none; |
| transition: opacity 0.5s ease; |
| } |
| |
| #lock-overlay.active { |
| opacity: 1; |
| pointer-events: all; |
| } |
| |
| .emoji-large { |
| font-size: 5rem; |
| margin-bottom: 1rem; |
| animation: bounce 2s infinite; |
| } |
| |
| @keyframes bounce { |
| 0%, 20%, 50%, 80%, 100% {transform: translateY(0);} |
| 40% {transform: translateY(-30px);} |
| 60% {transform: translateY(-15px);} |
| } |
| |
| |
| #settings-trigger { |
| position: fixed; |
| bottom: 10px; |
| right: 10px; |
| width: 20px; |
| height: 20px; |
| background: transparent; |
| z-index: 10000; |
| cursor: default; |
| } |
| |
| |
| #settings-panel { |
| position: fixed; |
| bottom: 20px; |
| right: 20px; |
| background: #1e293b; |
| padding: 20px; |
| border-radius: 12px; |
| box-shadow: 0 10px 25px rgba(0,0,0,0.5); |
| z-index: 10001; |
| display: none; |
| border: 1px solid #334155; |
| } |
| |
| .timer-badge { |
| position: fixed; |
| top: 10px; |
| left: 10px; |
| background: rgba(0, 0, 0, 0.7); |
| padding: 5px 15px; |
| border-radius: 20px; |
| font-weight: bold; |
| z-index: 50; |
| border: 1px solid #ef4444; |
| color: #ef4444; |
| pointer-events: none; |
| } |
| </style> |
| </head> |
| <body> |
|
|
| |
| <div id="timer-display" class="timer-badge hidden">00:00:00</div> |
|
|
| |
| <div id="game-container"> |
| <iframe id="game-frame" src="" allowfullscreen></iframe> |
| |
| |
| <div id="lock-overlay"> |
| <div class="emoji-large">😁</div> |
| <h1 class="text-4xl font-bold text-red-500 mb-4">دیگه زمان بازی بسه بچه جون!</h1> |
| <p class="text-xl text-gray-300 mb-8">برو بعداً بیا !!</p> |
| <div class="text-sm text-gray-500 mt-10">سیستم حفاظتی هوشمند فعال است</div> |
| </div> |
| </div> |
|
|
| |
| <div id="settings-trigger"></div> |
|
|
| |
| <div id="settings-panel"> |
| <h3 class="text-lg font-bold mb-4 text-yellow-400">⚙️ تنظیمات ادمین (فوق سری)</h3> |
| <div class="mb-4"> |
| <label class="block text-sm mb-1">مدت زمان مجاز (دقیقه):</label> |
| <input type="number" id="time-input" value="60" class="bg-slate-800 border border-slate-600 rounded p-2 w-full text-white"> |
| </div> |
| <div class="mb-4"> |
| <label class="block text-sm mb-1">رمز عبور:</label> |
| <input type="password" id="admin-pass" placeholder="****" class="bg-slate-800 border border-slate-600 rounded p-2 w-full text-white"> |
| </div> |
| <div class="flex gap-2"> |
| <button onclick="saveSettings()" class="bg-green-600 hover:bg-green-700 px-4 py-2 rounded text-sm flex-1">ذخیره و ریست</button> |
| <button onclick="closeSettings()" class="bg-red-600 hover:bg-red-700 px-4 py-2 rounded text-sm">بستن</button> |
| </div> |
| <p class="text-xs text-gray-500 mt-2 text-center">نسخه الگوریتم: v2.4.0-AI</p> |
| </div> |
|
|
| <script> |
| |
| const GAME_URL = "https://www.crazygames.com/game/tank-stars-online"; |
| const STORAGE_KEY_START = 'tank_stars_session_start'; |
| const STORAGE_KEY_DURATION = 'tank_stars_duration_min'; |
| const ADMIN_PASSWORD = "1234"; |
| |
| let sessionStart = null; |
| let allowedDurationMin = 60; |
| let timerInterval = null; |
| |
| |
| const gameFrame = document.getElementById('game-frame'); |
| const lockOverlay = document.getElementById('lock-overlay'); |
| const timerDisplay = document.getElementById('timer-display'); |
| const settingsPanel = document.getElementById('settings-panel'); |
| const settingsTrigger = document.getElementById('settings-trigger'); |
| |
| |
| |
| function init() { |
| |
| const savedDuration = localStorage.getItem(STORAGE_KEY_DURATION); |
| if (savedDuration) { |
| allowedDurationMin = parseInt(savedDuration); |
| } |
| |
| |
| sessionStart = localStorage.getItem(STORAGE_KEY_START); |
| |
| if (!sessionStart) { |
| |
| sessionStart = new Date().getTime(); |
| localStorage.setItem(STORAGE_KEY_START, sessionStart); |
| } else { |
| sessionStart = parseInt(sessionStart); |
| } |
| |
| |
| loadGame(); |
| |
| |
| startMonitoring(); |
| } |
| |
| function loadGame() { |
| |
| gameFrame.src = GAME_URL; |
| } |
| |
| function startMonitoring() { |
| timerInterval = setInterval(() => { |
| const now = new Date().getTime(); |
| const elapsedMs = now - sessionStart; |
| const allowedMs = allowedDurationMin * 60 * 1000; |
| const remainingMs = allowedMs - elapsedMs; |
| |
| if (remainingMs <= 0) { |
| triggerLockout(); |
| } else { |
| updateTimerUI(remainingMs); |
| } |
| }, 1000); |
| } |
| |
| function updateTimerUI(ms) { |
| const totalSeconds = Math.floor(ms / 1000); |
| const hours = Math.floor(totalSeconds / 3600); |
| const minutes = Math.floor((totalSeconds % 3600) / 60); |
| const seconds = totalSeconds % 60; |
| |
| timerDisplay.innerText = |
| `${String(hours).padStart(2, '0')}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`; |
| |
| |
| if (minutes < 5) { |
| timerDisplay.style.color = '#ff0000'; |
| timerDisplay.style.borderColor = '#ff0000'; |
| } |
| } |
| |
| function triggerLockout() { |
| clearInterval(timerInterval); |
| |
| |
| gameFrame.src = "about:blank"; |
| |
| |
| lockOverlay.classList.add('active'); |
| timerDisplay.classList.add('hidden'); |
| |
| |
| |
| } |
| |
| |
| |
| let clickCount = 0; |
| let clickTimer = null; |
| |
| |
| document.addEventListener('click', (e) => { |
| |
| if (e.clientX > window.innerWidth - 50 && e.clientY > window.innerHeight - 50) { |
| clickCount++; |
| |
| if (clickTimer) clearTimeout(clickTimer); |
| |
| clickTimer = setTimeout(() => { |
| clickCount = 0; |
| }, 1000); |
| |
| if (clickCount === 3) { |
| openSettings(); |
| clickCount = 0; |
| } |
| } |
| }); |
| |
| function openSettings() { |
| settingsPanel.style.display = 'block'; |
| document.getElementById('time-input').value = allowedDurationMin; |
| } |
| |
| function closeSettings() { |
| settingsPanel.style.display = 'none'; |
| document.getElementById('admin-pass').value = ''; |
| } |
| |
| function saveSettings() { |
| const pass = document.getElementById('admin-pass').value; |
| const newTime = document.getElementById('time-input').value; |
| |
| if (pass === ADMIN_PASSWORD) { |
| |
| localStorage.setItem(STORAGE_KEY_DURATION, newTime); |
| |
| localStorage.removeItem(STORAGE_KEY_START); |
| |
| alert('تنظیمات اعمال شد. صفحه ریلود میشود.'); |
| location.reload(); |
| } else { |
| alert('رمز عبور اشتباه است! 🚫'); |
| |
| settingsPanel.style.transform = "translateX(10px)"; |
| setTimeout(() => settingsPanel.style.transform = "translateX(0)", 100); |
| setTimeout(() => settingsPanel.style.transform = "translateX(-10px)", 200); |
| setTimeout(() => settingsPanel.style.transform = "translateX(0)", 300); |
| } |
| } |
| |
| |
| window.onload = init; |
| |
| </script> |
| </body> |
| </html> |
|
|