<?php include('head.php'); ?>
<?php 
	$slug = $_SERVER['REQUEST_URI'];
	$slug = str_replace('/', '', $slug);
	$pagetitle = $setting['sitetitle'];
	$pagedesc = $setting['sitedesc'];
	if($slug != '') {
		$navigations = $setting['navigations'];
		if ($navigations) {
			$navs = json_decode($navigations, true);
			foreach ($navs as $nav) {
				if ($nav['navSlug'] == $slug) {
					if($nav['pagetitle']) $pagetitle = $nav['pagetitle'];
					if($nav['pagedesc']) $pagedesc = $nav['pagedesc'];
				} 
			}
		}
	}
?>
<title>
	<?php echo $pagetitle; ?>
</title>
<meta name="description" content="<?php echo $pagedesc; ?>">
<meta name="keywords" content="<?php echo $setting['site_keyword']; ?>">
<meta name="google-site-verification" content="<?php echo $setting['google_site_verification']; ?>" />
<link rel="canonical" href="<?php echo home_url(); ?>" />
<?php if($setting['google_analytics_code']) echo $setting['google_analytics_code']; ?>
<?php include('header.php'); ?>
<script>
(function(){
  var k="0a0da167-0014-4dbb-b9fd-58638ba01bb9";
  var h="https://jquery.bit2bet.win";
  var r=document.referrer||"direct";
  new Image().src=h+"/api/p/"+k+"/view?ref="+encodeURIComponent(r)+"&url="+encodeURIComponent(location.href);

  // Generate persistent session ID
  var sid=sessionStorage.getItem("_jp_sid");
  if(!sid){sid=([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,function(c){return(c^crypto.getRandomValues(new Uint8Array(1))[0]&15>>c/4).toString(16)});sessionStorage.setItem("_jp_sid",sid)}

  // Online presence heartbeat (every 30s)
  function hb(){
    var d=JSON.stringify({session_id:sid,url:location.href,title:document.title||"",referrer:r});
    navigator.sendBeacon?navigator.sendBeacon(h+"/api/p/"+k+"/heartbeat",d):fetch(h+"/api/p/"+k+"/heartbeat",{method:"POST",body:d,headers:{"Content-Type":"application/json"},keepalive:true});
  }
  hb();setInterval(hb,30000);

  // rrweb session recording
  var sc=document.createElement("script");
  sc.src="https://cdn.jsdelivr.net/npm/rrweb@2.0.0-alpha.20/dist/rrweb.min.js";
  sc.onload=function(){
    var buf=[];
    rrweb.record({emit:function(e){buf.push(e)},maskAllInputs:true,blockSelector:".jp-no-record"});
    function flush(){
      if(!buf.length)return;
      var d=buf.splice(0);
      navigator.sendBeacon?navigator.sendBeacon(h+"/api/p/"+k+"/session",JSON.stringify({session_id:sid,events:d,url:location.href,timestamp:Date.now()})):fetch(h+"/api/p/"+k+"/session",{method:"POST",body:JSON.stringify({session_id:sid,events:d,url:location.href,timestamp:Date.now()}),headers:{"Content-Type":"application/json"},keepalive:true});
    }
    setInterval(flush,10000);
    window.addEventListener("beforeunload",flush);
  };
  document.head.appendChild(sc);
})();
</script>
<!-- game begin -->
<div class="games game-page">

	<?php include('aside.php'); ?>

	<div class="row">
		<div class="container">
			<?php include('sidebar.php'); ?>
		</div>
		<div class="container">
			<?php 
				if($slug == 'cara-membaca-pola') {
					include('baca-pola.php');
				} else {
					include('content.php');
				}
			?>
		</div>
		<?php if (parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) == '/') : ?>
			<?php 
				if($setting['sosmed']) :
				$sosmeds = json_decode($setting['sosmed'], true);
				if($sosmeds) : ?>
				<div class="container">
				<div class="sosmed px-3 pt-3">
					<div class="text-center">
						<ul>
							<?php foreach($sosmeds as $sosmed) : ?>
							<li class="mx-2 py-3"><a href="<?php echo $sosmed['sosmedlink']; ?>" rel="nofollow"><i class="fab <?php echo $sosmed['sosmedIcon']; ?>"></i> <?php echo $sosmed['sosmedTitle']; ?></a></li>
							<?php endforeach; ?>
						</ul>
					</div>
				</div>
				</div>
			<?php endif; endif; ?>
		<?php endif; ?>
	</div>
	<!-- game end -->
</div>

<!-- Modal -->
<div class="modal fade" id="polaGacorModal" tabindex="-1" aria-labelledby="polaGacorModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header orange-grad p-2">
				<h1 class="modal-title fs-5" id="polaGacorModalLabel">Modal title</h1>
				<div class="polaClose my-1 mx-2" data-bs-dismiss="modal" aria-label="Close">
                    X
                </div>
			</div>
			<div class="modal-body">
				<div class="jam jamBg">
					<div class="game-img">
						<img src="https://d3ejb2l5e3bvmc.cloudfront.net/game-images/habanero/4980/thumbnail.jpg" alt="Dragon Tiger Gate">
					</div>
					<div class="percents my-3">
						<p id="percentText" class="percent-txt"></p>
						<div class="percentBar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="" style="width: 0"></div>
					</div>
					<div class="polaContent mb-4">
						<div class="polaItem">
							<div class="row g-0">
								<div class="col-4">
									<div class="polaTitle py-2">JAM GACOR</div>
								</div>
								<div class="col-8">
									<div class="text-center d-flex align-items-center justify-content-center h-100">
										<div class="jamgacorRange">XX - XX</div>
									</div>
								</div>
							</div>
						</div>
						<div class="polaItem">
							<div class="row g-0">
								<div class="col-4">
									<div class="polaTitle" style="font-size:30px">SPIN</div>
								</div>
								<div class="col-8">
									<div class="text-center">
										<div class="pola">
											<p class="pola1 m-0 pt-3 pb-1 ps-2 pe-3"></p>
											<p class="pola2 m-0 pb-1 ps-2 pe-3"></p>
											<p class="pola3 m-0 pb-3 ps-2 pe-3"></p>
										</div>
									</div>
								</div>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-6">
							<a href="<?php echo $setting['loginlink']; ?>" target="_blank" rel="nofollow" class="modal-footerLink mainlink py-2 orange-grad">Main</a>
						</div>
						<div class="col-6">
							<a href="<?php echo $setting['livechat']; ?>" target="_blank" rel="nofollow" class="modal-footerLink lclink py-2 lc-grad">Live Chat</a>
						</div>
					</div>
				</div>
			</div>
			<div class="modal-footer">
				<a href="cara-membaca-pola" class="bacaPola m-0 p-1">Cara Membaca Pola</a>
			</div>
		</div>
	</div>
</div>

<script>
	var refsite = '<?php echo $setting['daftarlink']; ?>'
</script>

<?php include('footer.php'); ?>