Aplood / k.html
Hosdroid's picture
Update k.html
e178465 verified
Raw
History Blame Contribute Delete
4.85 kB
html
<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>🎮 بازی تانک</title>
<style>
* { margin:0; padding:0; box-sizing:border-box; }
html, body { width:100%; height:100%; overflow:hidden; background:#0f172a; font-family:Tahoma,'Segoe UI',sans-serif; }
#gameFrame { width:100%; height:100%; border:0; display:block; }
#loader { position:fixed; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; background:#0f172a; color:#38bdf8; z-index:10; gap:16px; font-size:18px; }
.spinner { width:48px; height:48px; border:4px solid rgba(56,189,248,.2); border-top-color:#38bdf8; border-radius:50%; animation:spin 1s linear infinite; }
keyframes spin { to { transform:rotate(360deg); } }
#timeoutScreen { position:fixed; inset:0; display:none; align-items:center; justify-content:center; background:linear-gradient(135deg,#1e293b,#0f172a); z-index:20; text-align:center; color:#fff; }
#timeoutScreen.show { display:flex; }
.tm-card { background:rgba(255,255,255,.05); padding:40px 32px; border-radius:24px; border:1px solid rgba(255,255,255,.1); max-width:340px; width:90%; }
.tm-emoji { font-size:64px; display:block; margin-bottom:16px; }
.tm-title { font-size:24px; font-weight:bold; margin-bottom:8px; color:#fbbf24; }
.tm-sub { color:#94a3b8; font-size:14px; line-height:1.8; }
#countdown { position:fixed; top:12px; left:12px; background:rgba(0,0,0,.6); color:#4ade80; padding:6px 14px; border-radius:20px; font-size:13px; z-index:5; font-family:monospace; display:none; }
#fsBtn { position:fixed; top:12px; right:12px; background:rgba(0,0,0,.6); color:#fff; border:1px solid rgba(255,255,255,.2); width:38px; height:38px; border-radius:10px; font-size:18px; cursor:pointer; z-index:5; }
</style>
</head>
<body>
⏳ ۱۰:۰۰
<button id="fsBtn" title="تمامصفحه"></button>
<iframe id="gameFrame" allow="autoplay; fullscreen; gamepad; xr-spatial-tracking" allowfullscreen></iframe>
در حال بارگذاری بازی…
😴
بازی بسه، برو فردا بیا!
وقت بازی تموم شد. برو یه کم استراحت کن — فردا برمیگردیم 🎮
<script>
(function(){
var DURATION = 10601000;
var KEY = 'tank_game_end';
var now = Date.now();
var todayStart = new Date(); todayStart.setHours(0,0,0,0);
var end = localStorage.getItem(KEY);
if (!end || +end < todayStart.getTime()) {
end = now + DURATION;
localStorage.setItem(KEY, end);
} else if (+end <= now) {
showTimeout();
return;
}
startGame();
startCountdown(+end - now);
setTimeout(showTimeout, +end - now);
window.addEventListener('beforeunload', function(e){
var left = +end - Date.now();
if (left > 0 && left < DURATION + 60000) {
e.preventDefault();
e.returnValue = '';
}
});
function startGame(){
var frame = document.getElementById('gameFrame');
var loader = document.getElementById('loader');
var sources = [
'https://www.crazygames.com/embed/tank-stars-online',
'https://embed.crazygames.com/embed/tank-stars-online',
'https://www.crazygames.com/game/tank-stars-online'
];
var i = 0;
function tryNext(){
if (i >= sources.length) { loader.style.display = 'none'; return; }
frame.src = sources[i++];
}
frame.onload = function(){
setTimeout(function(){ loader.style.display = 'none'; }, 800);
};
frame.onerror = tryNext;
setTimeout(function(){
try {
var doc = frame.contentDocument || frame.contentWindow.document;
if (!doc !doc.body doc.body.innerHTML.length < 10) tryNext();
} catch(e) {
loader.style.display = 'none';
}
}, 6000);
tryNext();
}
function startCountdown(ms){
var el = document.getElementById('countdown');
el.style.display = 'block';
var total = Math.ceil(ms/1000);
el.textContent = '⏳ ' + fmt(total);
var t = setInterval(function(){
total--;
if (total <= 0) { clearInterval(t); el.style.display = 'none'; }
else el.textContent = '⏳ ' + fmt(total);
}, 1000);
}
function fmt(s){
var m = Math.floor(s/60), ss = s%60;
return (m<10?'0':'')+m+':'+(ss<10?'0':'')+ss;
}
function showTimeout(){
document.getElementById('gameFrame').src = 'about:blank';
document.getElementById('countdown').style.display = 'none';
document.getElementById('loader').style.display = 'none';
document.getElementById('timeoutScreen').classList.add('show');
}
document.getElementById('fsBtn').onclick = function(){
if (document.fullscreenElement) document.exitFullscreen();
else document.documentElement.requestFullscreen();
};
})();
</script>
</body>
</html>