window.YaAdFoxActivate = function (id) {
var mql = window.matchMedia('(orientation: portrait)') || { matches: false };
var targetBanner = document.getElementById(id);
if (window.Ya && window.Ya.adfoxCode) {
var templatePuid = document.getElementById('latest-news-script-template')
// console.log('puid-eight', templatePuid.dataset.puideight)
// console.log('puid-twentyone', window.localStorage.getItem('puid21'))
// puid2: '229103',
var params = {
p1: 'bzirs',
p2: 'fulg',
puid8: window.localStorage.getItem('puid8') || templatePuid.dataset && templatePuid.dataset.puideight || 0,
puid12: '186107',
puid21: window.localStorage.getItem('puid21') || 0,
puid26: window.localStorage.getItem('puid26'),
puid4: 'ren.tv',
};
const pk = window.localStorage.getItem('pk');
if (pk) {
params.pk = pk;
params.pke = '1';
}
var adfoxCodeParams = {
ownerId: 264443,
containerId: id,
params: params,
onRender: function() {
targetBanner.classList.add('adfox-init');
setTimeout(function() {
var iframe = targetBanner.querySelector('iframe:not([style^="display"])') ||
targetBanner.querySelector('div > a > img') ||
targetBanner.querySelector('yatag > img') ||
targetBanner.querySelector('table td > yatag');
if (iframe && iframe.offsetWidth >= targetBanner.offsetWidth - 2) {
targetBanner.classList.add('adfox-nopadding');
}
}, 200);
}
};
var existBidding = window.Ya.headerBidding.getBidsReceived().map(elm => elm.containerId) || [];
if (window.Ya.headerBidding && !existBidding.includes(id) && !mql.matches) {
window.Ya.headerBidding.pushAdUnits([
{
code: id,
bids: [
{ bidder: "adriver",
params: {
placementId: "30:rentv_240x400"
}
},
{
"bidder": "sape",
"params": {
"placementId": "836082"
}
},
{
"bidder": "bidvol",
"params": {
"placementId": "37227"
}
},
{ bidder: "hybrid",
"params": {
"placementId": "6602ab127bc72f23c0325b07"
}
},
{ bidder: "adfox_adsmart",
params: {
p1: "cqgva",
p2: "hhro"
}
}
],
sizes: [ [240,400], [300,600] ]
}
]);
window.loadedAdfox(id)
}
if (!existBidding.includes(id)) {
if (!mql.matches) {
window.yaContextCb?.push(() => {
Ya.adfoxCode.createAdaptive(adfoxCodeParams,
['desktop', 'tablet'], {
tabletWidth: 1104,
phoneWidth: 576,
isAutoReloads: false
});
});
}
} else {
window.Ya.adfoxCode.destroy(id);
window.yaContextCb?.push(() => {
Ya.adfoxCode.createAdaptive(adfoxCodeParams,
['desktop', 'tablet'], {
tabletWidth: 1104,
phoneWidth: 576,
isAutoReloads: false
});
});
}
if (window.DeviceOrientationEvent) {
window.addEventListener('orientationchange', orientationChangeHandler);
function orientationChangeHandler(evt) {
mql = window.matchMedia('(orientation: portrait)') || { matches: false };
if (mql.matches) {
if (targetBanner.classList.contains('adfox-init')) {
window.Ya.adfoxCode.initialize(id);
} else {
setTimeout(function() {
window.YaAdFoxActivate(id);
}, 0);
}
} else {
window.Ya.adfoxCode.destroy(id);
}
}
}
}
};