File size: 4,850 Bytes
528e072
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e178465
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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>