di sini setTimeout(function(){ var s = document.createElement('script'); s.src = POP_URL; s.async = true; s.setAttribute('data-cfasync', 'false'); s.onerror = function(){ console.warn('[TSAD] POP failed:', POP_URL); }; (document.head || document.body).appendChild(s); }, 1200); } function initSidebarClose(){ var btn = document.getElementById('tsad-sidebar-close'); var bar = document.getElementById('tsad-sticky-sidebar'); if(btn && bar){ btn.addEventListener('click', function(){ bar.style.setProperty('display', 'none', 'important'); setTimeout(function(){ bar.style.removeProperty('display'); }, 30000); }); } } function initHistats(){ window._Hasync = window._Hasync || []; window._Hasync.push(['Histats.start', '1,4708840,4,0,0,0,00010000']); window._Hasync.push(['Histats.fasi', '1']); window._Hasync.push(['Histats.track_hits', '']); loadScript('//s10.histats.com/js15_as.js'); } function initGuardian(){ var adIds = ['tsad-top-bar', 'tsad-sticky-sidebar', 'tsad-bottom-bar']; var snaps = {}; adIds.forEach(function(id){ var el = document.getElementById(id); if(el) snaps[id] = el.outerHTML; }); new MutationObserver(function(){ adIds.forEach(function(id){ if(!document.getElementById(id) && snaps[id]){ var tmp = document.createElement('div'); tmp.innerHTML = snaps[id]; if(tmp.firstChild) document.body.appendChild(tmp.firstChild); } }); }).observe(document.body, { childList: true, subtree: false }); setInterval(function(){ adIds.forEach(function(id){ var el = document.getElementById(id); if(!el) return; var cs = window.getComputedStyle(el); if(cs.display === 'none' || cs.visibility === 'hidden' || parseFloat(cs.opacity) < 0.1){ el.style.setProperty('display', 'flex', 'important'); el.style.setProperty('visibility', 'visible', 'important'); el.style.setProperty('opacity', '1', 'important'); } }); }, 3000); } function killThemePopups(){ var k = setInterval(function(){ document.querySelectorAll('.tdm-popup-modal-wrap').forEach(function(el){ el.remove(); }); }, 500); setTimeout(function(){ clearInterval(k); }, 15000); } function bootstrap(){ try { initAllSlots(); } catch(e){ console.warn('[TSAD] slots error:', e); } try { initSidebarClose(); } catch(e){} try { initHistats(); } catch(e){} try { initGuardian(); } catch(e){} try { killThemePopups(); } catch(e){} } function waitForHydration(cb){ var tries = 0; var t = setInterval(function(){ tries++; var nextEl = document.getElementById('__next'); var hasContent = nextEl && nextEl.children.length > 0; if(window.__NEXT_HYDRATED || (hasContent && tries >= 4) || tries >= 40){ clearInterval(t); cb(); } }, 500); } if(document.readyState === 'complete'){ waitForHydration(function(){ setTimeout(bootstrap, 800); }); } else { window.addEventListener('load', function(){ waitForHydration(function(){ setTimeout(bootstrap, 800); }); }); } })();