Top.Mail.Ru
Топ-100

Записи по тегу

Back to top button
[sape]
[/sape]
if (adType === 'sape') { return; } var adId = '{yandex_ad_id}'; var adfoxOwner = parseInt('{adfox_owner_id}') || 0; var adfoxP1 = '{adfox_p1}'; var adfoxP2 = '{adfox_p2}'; var container = document.getElementById('ad-container-' + adId); if (!container) return; // Загрузчик context.js, если его нет if (typeof Ya === 'undefined' || typeof Ya.Context === 'undefined') { window.yaContextCb = window.yaContextCb || []; var script = document.createElement('script'); script.src = 'https://yandex.ru/ads/system/context.js'; script.async = true; document.head.appendChild(script); } // Функция рендеринга function renderAd() { if (adType === 'rss') { if (window.yaContextCb) { window.yaContextCb.push(function() { Ya.Context.AdvManager.render({ blockId: adId, renderTo: 'ad-container-' + adId, async: true }); }); } } else if (adType === 'adfox') { if (window.yaContextCb && adfoxOwner && adfoxP1 && adfoxP2) { window.yaContextCb.push(function() { Ya.adfoxCode.create({ ownerId: adfoxOwner, containerId: 'ad-container-' + adId, params: { p1: adfoxP1, p2: adfoxP2 } }); }); } else { console.warn('GG AdBlock: не хватает параметров для AdFox (ownerId, p1, p2)'); } } } // Если скрипт уже загружен – рендерим сразу, иначе ждём if (typeof Ya !== 'undefined' && Ya.Context) { renderAd(); } else { var checkLoaded = setInterval(function() { if (typeof Ya !== 'undefined' && Ya.Context) { clearInterval(checkLoaded); renderAd(); } }, 200); setTimeout(function() { clearInterval(checkLoaded); }, 10000); } })();