function tcfApiFrameLocator(){ try{ return !!window.top.__tcfapiLocator; }catch(e){ return false; } } function hbCheckAccessToTop(){ logDebug('hbCheckAccessToTop'); var access = 1; if(window.top != window.self){ try{ window.top.document.body.appendChild(window.top.document.createElement('div')); }catch(e){ access = 0; } }else{ access = 2; } logDebug('hbCheckAccessToTop res2',access); return access; } if(true){ var bscr = document.createElement('script'); bscr.innerHTML = "var isMobile = {};try{ isMobile = { Android: function() { return navigator.userAgent.match(/Android/i); }, BlackBerry: function() { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function() { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function() { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function() { return navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/WPDesktop/i); }, any: function() { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } }; }catch(e){ console.log(e); }try{ initialLog('82176'); logDebug('version',3,'82176'); var visiblePart = 10; var ourips = '0'; var justEtarget = parseInt('0'); var customWidth = 0; var autoClose = parseInt('0'); var hbparent = (''.length>0 ? document.getElementById('') : _et_findmyself()); var refcode = 'etarget-id-82176'; var refrand = parseInt(Math.random()*1000); if(typeof(window.globalfallback)=='undefined'){ window.globalfallback = []; } if(typeof(window.globalfallbackType)=='undefined'){ window.globalfallbackType = []; } if(typeof(window.globalFallbackRate)=='undefined'){ window.globalFallbackRate = []; } if(typeof(window.globalFallbackPrice)=='undefined'){ window.globalFallbackPrice = []; } if(typeof(window.globalNoFallback)=='undefined'){ window.globalNoFallback = []; } if(typeof(window.globalFallbackSlotID)=='undefined'){ window.globalFallbackSlotID = []; } if(typeof(window.globalFallbackPubID)=='undefined'){ window.globalFallbackPubID = []; } if(typeof(window.globalFallbackPrcEtarget)=='undefined'){ window.globalFallbackPrcEtarget = []; } if(typeof(window.globalFallbackPrcAdsense)=='undefined'){ window.globalFallbackPrcAdsense = []; } if(typeof(window.globalFlags)=='undefined'){ window.globalFlags = []; } if(typeof(window.globalFlags['82176'])=='undefined'){ window.globalFlags['82176'] = {}; } if(typeof(window.hbgoogle)=='undefined'){ window.hbgoogle = []; } if(typeof(window.etParentWrap)=='undefined'){ window.etParentWrap = []; } if(typeof(window.etParentWrap['82176'])=='undefined'){ window.etParentWrap['82176'] = false; } if(typeof(window.hbgoogle['82176'])=='undefined'){ window.hbgoogle['82176'] = []; } if(typeof(window.winnerint)=='undefined'){ window.winnerint = []; } if(typeof(window.winnerShow)=='undefined'){ window.winnerShow = []; } if(typeof(window.winnerShow['82176'])=='undefined'){ window.winnerShow['82176'] = []; } if(typeof(window.winnerLog)=='undefined'){ window.winnerLog = []; } window.globalfallback['82176'] = ''; window.globalfallbackType['82176'] = ''; window.globalFallbackPubID['82176'] = '-1'; window.globalFallbackSlotID['82176'] = ''; window.globalFallbackRate['82176'] = parseFloat('0'); window.globalFallbackPrice['82176'] = parseFloat('0.1'); window.globalFallbackPrcEtarget['82176'] = '0'; window.globalFallbackPrcAdsense['82176'] = '0'; window.globalNoFallback['82176'] = ('nofallback'.length>0 ? true : false); window.globalFlags['82176'].ppc = parseInt('0'); window.globalFlags['82176'].etr = parseInt('0'); window.globalFlags['82176'].apn = parseInt('0'); window.globalFlags['82176'].rub = parseInt('0'); window.globalFlags['82176'].pls = parseInt('0'); window.globalFlags['82176'].tds = parseInt('0'); window.winnerint['82176'] = false; window.hbFindCookieIfLoadedTCFCNT = 0; if(typeof(window.self.initialLoad)=='undefined'){ window.self.initialLoad = 0; } logDebug('fallback',window.globalfallback); window.self.initialLoad += 1; var native = '76940,78646'; native = native.split(','); if(typeof(window.styling)=='undefined'){ window.styling = {}; } var refstyling = {}; refstyling.font = ''.length>0 ? '' : 'arial'; refstyling.fsi = '14'.length>0 ? '14px' : '18px'; refstyling.bg = ''.length>0 ? (''=='transparent' ? 'transparent' : '#') : 'transparent'; refstyling.title = { color:'000000'.length>0 ? '#000000' : 'black', hcolor:'000000'.length>0 ? '#000000' : 'black' }; refstyling.text = { color:''.length>0 ? '#' : 'black', hcolor:''.length>0 ? '#' : 'black' }; refstyling.link = { color:''.length>0 ? '#' : 'black', hcolor:''.length>0 ? '#' : 'black', underline:parseInt('0')>0 ? 1 : 0 }; window.styling['82176'] = refstyling; if(typeof(dataParsed)=='undefined'){ var dataParsed = false; } if(typeof(iframeAdded)=='undefined'){ var iframeAdded = []; } if('0'=='1'){ customWidth = hbparent.clientWidth; logDebug('EHB:(82176) flexi width',customWidth,hbparent); } var wh = _et_checkWidthHeightDocument('640','120'); var width = wh[0]; var height = wh[1]; addSuperOptions(hbparent); setGlobalVals(refcode,'hbparent',hbparent); setGlobalVals(refcode,'refrand',refrand);var datas = [];var bidders = []; var addit_sizes = ''; if(addit_sizes.length>5){ addit_sizes = addit_sizes.split(','); } var logos = []; logos.etarget = ''; logos.pulsepoint = 1; logos.rubicon = 2; logos.appnexus = 3; logos.google = 4; logos.etargetppc = 5; var isVisible = visibleArea(hbparent); logDebug('EHB version',3); logDebug('EHB sizex','640120'); if('640120'!='1010' && window.globalFlags['82176'].etr===0){ /*new HB*/ var etargetbids = {bidder:'etarget',params:{refid:82176,country:6}}; if(isVisible===1){ etargetbids.params.position = 'atf'; } bidders.push(etargetbids); } if(!justEtarget){ logDebug('teads','',''); if(''.length>0 && ''.length>0 && window.globalFlags['82176'].tds===0){ var teadsbids = {bidder:'teads',params:{pageId:'',placementId:''}}; bidders.push(teadsbids); } if('15739846'.length>0 && window.globalFlags['82176'].apn===0){ var appnbids = {bidder:'appnexus',params:{placementId:'15739846',video:{skippable:true,playback_method:['auto_play_sound_off']}}}; if(isVisible===1){ appnbids.params.position = 'atf'; } bidders.push(appnbids); } if(''.length>0){ var adfnbids = {bidder:'adform',params:{mid:''}}; if(isVisible===1){ adfnbids.params.position = 'atf'; } bidders.push(adfnbids); } if(''.length>0 && window.globalFlags['82176'].pls===0){ var pulsbids = {bidder:'pulsepoint',params:{cf:'',cp:'',ct:''}}; if(isVisible===1){ pulsbids.params.position = 'atf'; } bidders.push(pulsbids); } if('11352'.length>0 && window.globalFlags['82176'].rub===0){ var rubibids = {bidder:'rubicon',params:{accountId:'11352',siteId:'190390',zoneId:'1749770'}}; if('1,109,85,65,198,156,173,124'.length>0){ rubibids.params.sizes = [1,109,85,65,198,156,173,124]; } if(isVisible===1){ rubibids.params.position = 'atf'; } bidders.push(rubibids); } }try{ window.addEventListener('message', receiveMessage, false); parent.addEventListener('message', receiveMessage, false);top.addEventListener('message', receiveMessage, false);}catch(e){logDebug('message',e);} window.addEventListener('scroll', checkAfterScroll, false);if(typeof(top.postMessage)!='function'){logDebug('EHB:(82176) !!! NEVIEME SA DOSTAT DO postMessage !!!');window.globalNoFallback[82176] = true;} logDebug('EHB:(82176) slotID:');logDebug('EHB:(82176) bidders',bidders,'asd',window.globalFlags['82176']);var codeID = 'code_'+'82176'+'_'+'640x120'+'_'+parseInt(Math.random()*1000);var PREBID_TIMEOUT = 700; var sizes = []; if(addit_sizes.length>0){ for(var k in addit_sizes){ if(typeof(addit_sizes[k])=='string'){ var sa = addit_sizes[k].split('x'); var sw = sa[0]; var sh = sa[1]; if(sw && sh){ var ho = [parseInt(sw),parseInt(sh)]; if(sizes.indexOf(ho)==-1){ sizes.push(ho); } } } } }else{ sizes.push([parseInt(width),parseInt(height)]); } logDebug('EHB:(82176) sizes',addit_sizes,sizes); var mediatypes = {'banner':{'sizes':sizes}}; if(native.indexOf('82176')>=0 || true){ mediatypes.native = { title: { required: true, sendId: true }, body: { required: true, sendId: true }, clickUrl: { sendId: true } }; try{ if(false){ ajaxcallX('https://bg.search.etargetnet.com/ajax/partner_counter.php?type=request&category=native&ref=82176'); } }catch(e){ console.log(e); } } if((typeof(teadsbids)!='undefined' || '82176'=='48800') && false){ mediatypes.video = { context: 'outstream', playerSize: [[parseInt(width),parseInt(height)]] } } if('82176'=='48800' && false){ mediatypesnew = {}; mediatypesnew.video = mediatypes.video; mediatypes = mediatypesnew; } logDebug('EHB: mediatypes',mediatypes); var bidobj = { code: codeID, sizes: sizes, bids: bidders, mediaTypes: mediatypes }; if(false){ var floor = { currency: 'USD', modelVersion: 'EFPv1', schema: { fields: ['mediaType'] }, values: { 'banner': 0, 'video': 0 } }; bidobj.floors = floor; console.log('floor',floor,bidobj); } if(typeof(window.self.adUnits)=='object'){ window.self.adUnits.push(bidobj); logDebug('EHB:(82176) updateUnit',bidobj); }else{ window.self.adUnits = [bidobj]; logDebug('EHB:(82176) insertUnit',bidobj); } if(window.self.initialLoad<2){ window.self.pbjs = window.self.pbjs || {}; window.self.pbjs.que = window.self.pbjs.que || []; window.self.pbjs.logging = true; window.self.googletag = window.self.googletag || {}; window.self.googletag.cmd = window.self.googletag.cmd || []; window.self.googletag.cmd.push(function() { window.self.googletag.pubads().disableInitialLoad(); }); } if(window.self.loadInt){ clearTimeout(window.self.loadInt); window.self.loadInt = false; }; logDebug('EHB:(82176) tryTimeout start'); window.self.loadInt = setTimeout(function(){ logDebug('EHB:(82176) tryTimeout inside'); executeHBJS(); },1000);}catch(e){console.error(e);}function initialLog(refid){ var data = '[]'; var pos = 'btf'; var winner = 'init'; var url = 'https://bg.search.etargetnet.com/generic/header_bidding_log.php?ref='+refid+'&position='+pos+'&data='+data+'&referer='+refid+'&winner='+winner; ajaxcallX(url,function(e){logDebug('EHB:('+refid+') success',url);},true);}function setGlobalVals(refcode,name,val){ if(typeof(window.__ethbGlobalVals)=='undefined'){ window.__ethbGlobalVals = []; } if(typeof(window.__ethbGlobalVals[refcode])=='undefined'){ window.__ethbGlobalVals[refcode] = []; } window.__ethbGlobalVals[refcode][name] = val;}function getGlobalVals(refcode,name){ if(typeof(window.__ethbGlobalVals)!='object'){ return false; } if(typeof(window.__ethbGlobalVals[refcode])!='object'){ return false; } return window.__ethbGlobalVals[refcode][name];}if(typeof(window.__et__tcfapiLoaded)=='undefined'){ window.__et__tcfapiLoaded = 0;}function executeHBJS(){ logDebug('EHB:(82176) before dataParsed',dataParsed); if(!dataParsed){ dataParsed = true; logDebug('EHB:(82176) after dataParsed',typeof(__tcfapi)); if(typeof(__tcfapi)=='function'){ __tcfapi('addEventListener',2,function(a,b){ var status = a.eventStatus; if(status=='tcloaded' || status=='useractioncomplete'){ if (typeof(a.listenerId) != 'undefined') { __tcfapi('removeEventListener', 2, function() { if(false){ console.log('%c __tcfapi %c event %c remove ','background:gray;color:white','background:#4e0060;color:white','background:#fffa0c;color:black'); } }, a.listenerId); } logDebug('EHB:(82176) TCF after event',a,b); logDebug('EHB:(82176) TCF after timeout'); pbjs.que.push(function() { pbjs.setConfig({ consentManagement: { gdpr: { cmpApi: 'iab', timeout: 2000 }, usp: { cmpApi: 'iab', timeout: 1000 } } }); pbjs.addAdUnits(adUnits); pbjs.requestBids({ timeout: 1500, bidsBackHandler: function(e,n){ parseDataAndReturnNew(e,n); parseDataAndReturnX(e,n); } }); }); } }); }else{ var tafl = tcfApiFrameLocator();/*can access TCF iframe, STUB will handle it*/ logDebug('EHB:(82176) TCF no event',tafl); if(tafl){ if(!window.self.__et__tcfapiLoaded){ var ts = parseInt(Math.random()*1000000); var date = new Date(); ts = date.getYear()+''+date.getMonth()+''+date.getDate(); var scrpt = document.createElement('script'); scrpt.src = 'https://etarget.mgr.consensu.org/gdpr/tcfv2/stub-babel.js?t='+ts; scrpt.async = true; window.self.document.body.appendChild(scrpt); } window.self.__et__tcfapiLoaded = 1; hbFindCookieIfLoadedTCF(1); }else{ if(hbCheckAccessToTop()){ if(!window.self.__et__tcfapiLoaded){ var ts = parseInt(Math.random()*1000000); var date = new Date(); ts = date.getYear()+''+date.getMonth()+''+date.getDate(); var scrpt = document.createElement('script'); scrpt.src = 'https://etarget.mgr.consensu.org/gdpr/gdpr.js.php?ecmp=3&apionly=1&t='+ts; scrpt.async = true; window.self.document.body.appendChild(scrpt); } window.self.__et__tcfapiLoaded = 1; hbFindCookieIfLoadedTCF(2); }else{ var consent = hbFindCookie(true); logDebug('EHB:(82176) TCF after timeout 2'); pbjs.que.push(function() { pbjs.setConfig({ consentManagement: { gdpr: { cmpApi: 'static', consentData: { getTCData: { tcString: ''+consent+'', timeout: 2000, gdprApplies: true } } }, usp: { cmpApi: 'iab', timeout: 1000 } } }); pbjs.addAdUnits(adUnits); pbjs.requestBids({ timeout: 1500, bidsBackHandler: function(e,n){ parseDataAndReturnNew(e,n); parseDataAndReturnX(e,n); } }); }); } } } }}function hbFindCookieIfLoadedTCF(num){ logDebug('EHB:(82176) hbFindCookieIfLoadedTCF '+num,window.hbFindCookieIfLoadedTCFCNT); window.hbFindCookieIfLoadedTCFCNT++; try{ if(num==2){/*num==1 is just STUB*/ __tcfapi('addEventListener',2,function(a,b){ console.log('try pass __tcfapi'); }); } hbFindCookie(); }catch(e){ if(window.hbFindCookieIfLoadedTCFCNT<20){ setTimeout(function(){ hbFindCookieIfLoadedTCF(num); },10); }else{ hbFindCookie(); } }}function hbGetCookie(name) { var match = false; if(hbCheckAccessToTop()){ logDebug('match TOP'); match = window.top.document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)')); } if(!match){ logDebug('match SELF'); match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)')); } logDebug('match RES',match); if (match) return match[2];}var hbFindCookieInit = false;function hbFindCookie(justret){ var consent = hbGetCookie('euconsent-v2'); logDebug('EHB:(82176) hbFindCookie',consent); if(consent){ if(justret){ return consent; } _et_addConsentToHB(); }else{ var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState === 4){ if(typeof(xhr.responseText)=='string'){ if(xhr.responseText.length>10 && !hbFindCookieInit){ hbFindCookieInit = true; var d = new Date(); d.setTime(d.getTime() + (365*24*60*60*1000)); var expires = 'expires='+ d.toUTCString(); document.cookie = 'euconsent-v2='+xhr.responseText+'; '+expires+'; path=/'; if(hbCheckAccessToTop()){ window.top.document.cookie = 'euconsent-v2='+xhr.responseText+'; '+expires+'; path=/'; } if(justret){ return xhr.responseText; } _et_addConsentToHB(); } } } }; xhr.open('GET', 'https://etarget.mgr.consensu.org/consent.php?findCookie=1&cookieName=euconsent-v2'); xhr.withCredentials = true; xhr.send(); setTimeout(function(){ if(!hbFindCookieInit){ if(typeof(xhr)!='undefined'){ xhr.abort(); } hbFindCookieInit = true; _et_addConsentToHB(); } },500); }}function _et_addConsentToHB(){ logDebug('_et_addConsentToHB'); window.adUnitsAdded = setTimeout(function(){ pbjs.que.push(function() { pbjs.setConfig({ consentManagement: { gdpr: { cmpApi: 'iab', timeout: 2000 }, usp: { cmpApi: 'iab', timeout: 1000 } } }); pbjs.addAdUnits(adUnits); pbjs.requestBids({ timeout: 1500, bidsBackHandler: function(e,n){ parseDataAndReturnNew(e,n); parseDataAndReturnX(e,n); } }); }); },1000);}function _et_findmyself(){ var parent = document.getElementById('etarget-id-82176') || document.querySelectorAll('[data-etarget-id=etarget-id-82176]')[0]; if(typeof(parent)=='undefined'){ var url = 'https://bg.search.etargetnet.com/generic/uni.php?g=ref:82176,area:640x120'; var scripts = document.getElementsByTagName('script'); for(var k in scripts){ var script = scripts[k]; if(typeof(script)=='object'){ if(typeof(script.src)!='undefined'){ var src = script.src; if(src==url){ var div = document.createElement('div'); div.id = 'etarget-id-82176'; script.parentNode.insertBefore(div,script); parent = div; break; } } } } } return parent;} function _et_checkWidthHeightDocument(width,height){ var mobile_size = ''; if(mobile_size.indexOf('x')>1){ var mobile_sizes = mobile_size.split('x'); var dw = window.innerWidth; if(dw && dw<=480){ width = mobile_sizes[0]; height = mobile_sizes[1]; } }else if(''=='fixed'){ var dw = window.innerWidth; if(dw && dw<=480){ width = '320'; height = '50'; } } return [width,height]; }function addSuperOptions(parent){ var close = ''; var fixed_position = ''; var fixed_top = ''; var fixed_right = ''; var fixed_bottom = ''; var fixed_left = ''; if(fixed_position!='fixed' && fixed_position.length>0){ setTimeout(function(){ parent.parentNode.style.position = 'fixed'; var closediv = document.getElementsByClassName('close_hb'); if(typeof(closediv)=='object' && closediv!==null && closediv.length>0){ closediv[0].style.display = 'block'; } },5000); } logDebug('EHB:(82176) ','addSuperOptions', parent, fixed_position, fixed_top, fixed_right, fixed_bottom, fixed_left); var closablecss = ''; var leftclose = ''; var topclose = ''; if(fixed_position.length>0){ parent.parentNode.style.position = fixed_position; parent.parentNode.style.zIndex = 9999999; parent.parentNode.style.backgroundColor = 'white'; if(fixed_top.length>0){ parent.parentNode.style.top = fixed_top; closablecss += 'bottom:-10px;'; topclose = 'top'; } if(fixed_right.length>0){ parent.parentNode.style.right = fixed_right; closablecss += 'left:-10px;'; leftclose = 'right'; } if(fixed_bottom.length>0){ parent.parentNode.style.bottom = fixed_bottom; closablecss += 'top:-10px;'; topclose = 'bottom'; } if(fixed_left.length>0){ parent.parentNode.style.left = fixed_left; closablecss += 'right:-10px;'; leftclose = 'left'; } } var arrow = 'arrow-'+topclose+'-'+leftclose; if(close.length>0){ if(!closablecss){ closablecss = 'top:-10px;right:-10px;'; } var closediv = document.createElement('div'); closediv.className = 'close_hb'; var origcss = 'cursor:pointer;background-image:url(//sk.search.etargetnet.com/img/close_icon.png);background-position:center;background-size:cover;width:20px;height:20px;position:absolute;z-index:9999999;'+closablecss; var additcss = ''; if(fixed_position!='fixed'){ additcss = ';display:none;'; } closediv.style.cssText = origcss+additcss; parent.parentNode.appendChild(closediv); parent.style.overflow = 'hidden'; closediv.addEventListener('click',function(){ if(this.parentNode.clientWidth==0){ parent.style.maxWidth = '100%'; parent.style.maxHeight = '100%'; closediv.style.cssText = origcss; }else{ parent.style.maxWidth = '0px'; parent.style.maxHeight = '0px'; var newcss = origcss.replace('close_icon',arrow).replace(/-10/g,'-20'); closediv.style.cssText = newcss; } }); }} var receivedMessages = [];function receiveMessage(event,m){ try{ if(event){ if(typeof(event.data)=='string'){ if(event.data.indexOf('pouzi_winbid')>=0){ var hash = btoa(event.data); if(receivedMessages.indexOf(hash)==-1){ var refid = (event.data.split('_'))[2]; logDebug('EHB:(82176) winbid_message',event); winbid_show(1,refid); receivedMessages.push(hash); return true; } return false; } } if(typeof(event.data)!='undefined'){ var json = event.data; if(typeof(json)=='string' && json.indexOf('__tcfapiReturn')>0){ json = JSON.parse(event.data); } if(typeof(json)=='object' && typeof(json.__tcfapiReturn)=='object'){ var payload = json.__tcfapiReturn; } } } }catch(e){ console.log(e); }}function parseDataAndReturnNew(e,n){ logDebug('EHB:(uni) parseDataAndReturnNew:',pbjs,e,n); var byMaxCmp = pbjs.getHighestCpmBids(); var allWinningBids = pbjs.getAllPrebidWinningBids(); logDebug('byMaxCmp',byMaxCmp,allWinningBids,e); if(typeof(window.hb)=='undefined'){ window.hb = []; } if(byMaxCmp.length===0){ var ecnt = 0; var units = pbjs.adUnits; for(var y in units){ var unit = units[y]; var k = unit.code; var refid = k.split('_')[1]; if(!refid) continue; var refsize = k.split('_')[2].split('x'); var refcode = 'etarget-id-'+refid; var hbparent = getParentFromRef(refcode,hbparent); var objs = content_div(refid,refsize[0],refsize[1],refcode,hbparent); var div = objs[0]; var iframe = objs[1]; var newhb = []; newhb.data = false; newhb.raw = false; newhb.id = refid; newhb.refid = refcode; newhb.iframe = iframe; newhb.div = div; newhb.fallback = ''; if(window.globalfallback[refid].length>0){ newhb.fallback = window.globalfallback[refid]; } newhb.size = [refsize[0],refsize[1]]; logDebug('EHB:(uni) setData:',k,newhb,refsize); setData(refid,newhb); before_win(refid,false,refsize[0],refsize[1],iframe,div); ecnt+=1; } logDebug('ecnt2',ecnt); if(ecnt===0 && false){ logDebug('nodata','82176','640x120'); var refid = '82176'; var refcode = 'etarget-id-'+refid; var hbparent = getParentFromRef(refcode,hbparent); var refsize = '640x120'.split('x'); logDebug('nodata parent',refid,hbparent); var objs = content_div(refid,10,10,refcode,hbparent); var div = objs[0]; var iframe = objs[1]; var cena = 0; var newhb = []; newhb.data = false; newhb.raw = false; newhb.id = refid; newhb.refid = refcode; newhb.iframe = iframe; newhb.div = div; newhb.fallback = ''; if(window.globalfallback[refid].length>0){ newhb.fallback = window.globalfallback[refid]; } newhb.size = [refsize[0],refsize[1]]; logDebug('nodata objs',objs,newhb); if(!window.globalNoFallback[refid]){ window.globalNoFallback[refid] = true; if(newhb.fallback.length>0 || window.globalfallbackType[refid]=='adsense'){ window.globalNoFallback[refid] = false; adxcpm = 0; if(window.globalFallbackPrice[refid]){ adxcpm = window.globalFallbackPrice[refid]; } window.hbgoogle[refid].push({'code':'adx_'+refid, 'cpm':adxcpm}); } logDebug('adxPRC1.1',parseInt(window.globalFallbackPrcEtarget[refid]),parseInt(window.globalFallbackPrcAdsense[refid])); logDebug('vchadzam dnu ak mame etarget ppc fallback + mame nastavene percenta pre E+G'); if(!window.globalNoFallback[refid] && typeof(window.globalFallbackPrcEtarget[refid])!='undefined' && typeof(window.globalFallbackPrcAdsense[refid])!='undefined'){ var sum = parseInt(window.globalFallbackPrcEtarget[refid])+parseInt(window.globalFallbackPrcAdsense[refid]); logDebug('adxPRC2.1',sum); if(sum>0){ var rand = Math.random()*sum; window.globalNoFallback[refid] = false; if(Math.ceil(rand)<=parseInt(globalFallbackPrcEtarget[refid])){ window.globalNoFallback[refid] = true; window.globalfallbackType[refid] = 'etarget'; } logDebug('adxPRC3.1',rand,Math.ceil(rand),window.globalfallbackType[refid]); } } } setData(refid,newhb); before_win(refid,false,10,10,iframe,div); } }else{ var forcnt = 0; logDebug('forcecnt start',forcnt,byMaxCmp); var parsedIDs = []; for(var k in byMaxCmp){ if(byMaxCmp[k]){ var bid = byMaxCmp[k]; if(typeof(bid.adId)=='undefined'){ continue; } if(typeof(window.hbCreated)=='undefined'){ window.hbCreated = []; } if(!window.hbCreated[bid.adId]){ window.hbCreated[bid.adId] = 1; }else{ return; } var refid = bid.adUnitCode.split('_')[1]; var refsize = bid.adUnitCode.split('_')[2]; var refcode = 'etarget-id-'+refid; var hbparent = getParentFromRef(refcode,hbparent); parsedIDs.push(refid); logDebug('render?',refid,refsize,refcode,hbparent); if(bid.width===0){ var refsizes = refsize.split('x'); bid.width = refsizes[0]; bid.height = refsizes[1]; } logDebug(hbparent); var code = bid.bidder; var url = bid.adUrl; var vastUrl = bid.vastUrl; var ad = bid.ad; var adx = url ? url : ad; var reason = ''; if(typeof(bid.reason)=='string'){ reason = bid.reason; } var cena = parseFloat(bid.cpm).toFixed(2); if(typeof(bid.netRevenue)!='undefined'){ netto = bid.netRevenue; } if(!netto){ cena = cena*0.75; } var data = {'bid':cena,'url':url,'ad':ad,'vastUrl':vastUrl,'system':code,'netto':netto,'reason':reason}; logDebug('EHB:('+refid+') Objx:',data,bid); var divw = bid.width; if(customWidth>0 && customWidth>divw){ divw = customWidth; } var objs = content_div(refid,divw,bid.height,refcode,hbparent,bid.adUnitCode); var div = objs[0]; var iframe = objs[1]; var newhb = []; newhb.data = data; newhb.raw = bid; newhb.id = refid; newhb.refid = refcode; newhb.iframe = iframe; newhb.div = div; newhb.fallback = ''; if(window.globalfallback[refid].length>0){ newhb.fallback = window.globalfallback[refid]; } newhb.size = [bid.width,bid.height]; logDebug('EHB:(uni) setData: before',newhb); if(typeof(window.hb)=='undefined'){ window.hb = []; } logDebug('EHB:(uni) HBData:',window.hb); logDebug('EHB:(uni) global:',window.globalFallbackPrice[refid], newhb.fallback, window.globalNoFallback[refid], window.globalFallbackRate[refid]); if(!window.globalNoFallback[refid]){ window.globalNoFallback[refid] = true; if(newhb.fallback.length>0 || window.globalfallbackType[refid]=='adsense'){ adxcpm = 0; if(window.globalFallbackPrice[refid]){ adxcpm = window.globalFallbackPrice[refid]; } window.hbgoogle[refid].push({'code':'adx_'+refid, 'cpm':adxcpm}); logDebug('EHB:(uni) global2:',cena,window.globalFallbackPrice); if(cena0){ var rand = Math.random()*sum; window.globalNoFallback[refid] = false; if(Math.ceil(rand)<=parseInt(globalFallbackPrcEtarget[refid])){ window.globalfallbackType[refid] = 'etarget'; if(reason=='last chance' && window.globalFlags[refid].ppc===0){ window.globalNoFallback[refid] = true; } } logDebug('adxPRC3.2',rand,Math.ceil(rand),window.globalfallbackType[refid]); } } } logDebug('EHB:(uni) setData: agfter',newhb,window.globalNoFallback[refid]); setData(refid,newhb); before_win(refid,data,bid.width,bid.height,iframe); forcnt++; } } logDebug('EHB:(uni):','parsedIDs',parsedIDs.length,pbjs.adUnits.length,parsedIDs); if(parsedIDs.length0){ newhb.fallback = window.globalfallback[refid]; } newhb.size = [refsize[0],refsize[1]]; if(typeof(window.hb)=='undefined'){ window.hb = []; } logDebug('EHB:(uni) parseNotByMaxCpm:4',refid,window.globalFallbackPrice[refid], newhb.fallback, window.globalNoFallback[refid], window.globalFallbackRate[refid]); if(!window.globalNoFallback[refid]){ window.globalNoFallback[refid] = true; if(newhb.fallback.length>0 || window.globalfallbackType[refid]=='adsense'){ adxcpm = 0; if(window.globalFallbackPrice[refid]){ adxcpm = window.globalFallbackPrice[refid]; } window.hbgoogle[refid].push({'code':'adx_'+refid, 'cpm':adxcpm}); logDebug('EHB:('+refid+') global2:',0,window.globalFallbackPrice,window.hbgoogle[refid]); } window.globalNoFallback[refid] = false; logDebug('adxPRC1.3',parseInt(window.globalFallbackPrcEtarget[refid]),parseInt(window.globalFallbackPrcAdsense[refid])); logDebug('vchadzam dnu ak mame etarget ppc fallback + mame nastavene percenta pre E+G',refid); if(!window.globalNoFallback[refid] && typeof(window.globalFallbackPrcEtarget[refid])!='undefined' && typeof(window.globalFallbackPrcAdsense[refid])!='undefined'){ var sum = parseInt(window.globalFallbackPrcEtarget[refid])+parseInt(window.globalFallbackPrcAdsense[refid]); logDebug('adxPRC2.3',sum); if(sum>0){ var rand = Math.random()*sum; window.globalNoFallback[refid] = false; if(Math.ceil(rand)<=parseInt(globalFallbackPrcEtarget[refid])){ window.globalfallbackType[refid] = 'etarget'; if(window.globalFlags[refid].ppc===0){ window.globalNoFallback[refid] = true; } } logDebug('adxPRC3.3',rand,Math.ceil(rand),window.globalfallbackType[refid]); } } } logDebug('EHB:('+refid+') setData: agfter',newhb,window.globalNoFallback[refid]); setData(refid,newhb); before_win(refid,false,refsize[0],refsize[1],iframe,div);}function content_div(refid,divw,divh,refcode,hbparent,id){ if(divw+'x'+divh=='10x10'){ divw = 'auto'; divh = 'auto'; }else{ divw = divw+'px'; divh = divh+'px'; } var div = document.createElement('div'); var rand = parseInt(Math.random()*10000); div.className = '_et_hb_cont contdiv _et_rand'+rand; if(id){ div.id = id; } div.style = 'width:'+divw+';height:'+divh+';border:none;position:relative;text-align:center;margin:0px auto;'; var footer = document.createElement('div'); footer.style = 'position:absolute;bottom:0px;right:0px;height:20px;'; footer.className = 'footer_wrap'; footer.innerHTML = '
'.replace('#REFID#',refcode); footer.setAttribute('data-ref-id',refid); div.appendChild(footer); var iframe = document.createElement('iframe'); iframe.style = 'width:'+divw+'px;height:'+divh+'px;border:none;margin:0px;'; iframe.id = 'etarget_hb_'+refid; iframe.name = 'etarget_hb_'+refid; iframe.scrolling = 'no'; div.appendChild(iframe); hbparent.appendChild(div); return [div,iframe]; }function before_win(refid,data,width,height,iframe,div){ logDebug('EHB:('+refid+') noadx2', width, height, window.globalfallbackType[refid], window.globalNoFallback[refid], !window.globalNoFallback[refid],2,window.hbresponse,window.hbgoogle,iframe); var pwrap = document.getElementById('etarget-id-'+refid); logDebug('EHB:('+refid+') pwrap0',pwrap,data); if(pwrap){ pwrap = pwrap.parentNode; logDebug('EHB:('+refid+') pwrap1',pwrap); if(pwrap){ pwrap = pwrap.parentNode; logDebug('EHB:('+refid+') pwrap2',pwrap); } } window.etParentWrap[refid] = pwrap; logDebug('EHB:('+refid+') pwrap3',window.etParentWrap[refid]); if(!window.globalNoFallback[refid]){ logDebug('EHB:('+refid+') adx_string2',window.globalfallbackType[refid]); switch(window.globalfallbackType[refid]){ case 'adsense':{ try{ showADXFromScript(refid,div,width,height); winnerPost('google',refid); }catch(e){ console.log('err',refid,e); } }; break; case 'google': case 'etarget': case 'script':{ goToEtarget(iframe,refid); }; break; } }else{ logDebug('EHB:('+refid+') winbid_show 3',data,window.globalFallbackPrice[refid]); winbid_show(3,refid); }}function showADXFromScript(refid,div,width,height){ logDebug(refid,'showADXFromScript',width,height,!!document.getElementById('google_ads_iframe_/77283581/Large_Leaderboard_0')); (function() { if(!!document.getElementById('google_ads_iframe_/77283581/Large_Leaderboard_0')){ var myself = getGlobalVals('etarget-id-'+refid,'hbparent'); const eleReplace = myself; eleReplace.parentNode.removeChild(eleReplace); }else{ var pubID = window.globalFallbackPubID[refid]; if(pubID.indexOf('ca-pub')===-1){ pubID = 'ca-pub-'+pubID; } var slotID = window.globalFallbackSlotID[refid]; logDebug('EHB:('+refid+')','showAdxFromScript2',pubID,slotID); var myself = getGlobalVals('etarget-id-'+refid,'hbparent'); logDebug('EHB:('+refid+')','myself',myself); const gFallback = document.createElement('div'); gFallback.className = 'container ads'; const first = document.createElement('script'); first.async = true; first.src = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'; gFallback.appendChild(first); const ins = document.createElement('ins'); ins.className = 'adsbygoogle'; ins.style.cssText = 'display:block;margin-bottom:12px;'; if(width>0 && height>0){ ins.style.width = width+'px'; ins.style.height = height+'px'; } ins.setAttribute('data-ad-name', 'adx'); ins.setAttribute('data-ad-client', pubID); ins.setAttribute('data-ad-slot', slotID); /* ins.setAttribute('data-ad-format', 'auto'); ins.setAttribute('data-full-width-responsive', 'true'); */ gFallback.appendChild(ins); const second = document.createElement('script'); const secondCode = '(adsbygoogle = window.adsbygoogle || []).push({});'; second.appendChild(document.createTextNode(secondCode)); gFallback.appendChild(second); const eleReplace = myself; eleReplace.parentNode.insertBefore(gFallback, eleReplace.nextSibling); eleReplace.parentNode.removeChild(eleReplace); } })();}function parseDataAndReturnX(e,n){ if(typeof(window.ehb_parsing)=='undefined'){ window.ehb_parsing = true; }else{ return true; } logDebug('EHB:(uni) parseDataAndReturnX:',pbjs,e,n); if(typeof(window.hbresponse) == 'undefined'){ window.hbresponse = []; } window.hbresponse.push(pbjs); window.hbresponse.push(e); var adResUnits = pbjs.adUnits; for(var i=0; i1){ var refid = splits[1]; var splitsize = splits[2]; logDebug(refid,splitsize); var refwidth = (splitsize.split('x'))[0]; var refheight = (splitsize.split('x'))[1]; var data = false; var maxbid = parseFloat(0.00); for(var k in e){ var obj = e[k]; var objname = k; var objref = objname.split('_')[1]; if(typeof(obj.bids)=='object' && objref==refid){ logDebug('EHB:(uni) Objref:',objref,obj); var bids = obj.bids; for(var kk in bids){ var bid = bids[kk]; if(typeof(bid.native)=='object'){ try{ if(false){ ajaxcallX('https://bg.search.etargetnet.com/ajax/partner_counter.php?type=response&category=native&ref='+objref); } }catch(e){ console.log(e); } } } } } } } }if(typeof(hbparent_counter)=='undefined'){ var hbparent_counter = [];}function getParentFromRef(refcode){ if(typeof(hbparent_counter[refcode])=='undefined'){ hbparent_counter[refcode] = 0; }else{ if(hbparent_counter[refcode]>10){ return false; } } logDebug('EHB:('+refcode+') hladam parenta'); var hbparent = document.getElementById(refcode) || document.querySelectorAll('[data-etarget-id='+refcode+']')[0]; var hbparentFromGlobals = getGlobalVals(refcode,'hbparent'); if(typeof(hbparentFromGlobals)=='object' && !!hbparentFromGlobals){ hbparentFromGlobals.innerHTML = ''; hbparent = hbparentFromGlobals; } if(typeof(hbparent)=='undefined'){ setTimeout(function(){ hbparent_counter[refcode]++; hbparent = getParentFromRef(refcode); },1000); } return hbparent;}function writeDatas(name,price){ var datas_len = datas.length; if(datas_len>0){ for(var k in datas){ if(datas[k]){ if(datas[k].name==name){ return 0; } } } }datas[datas_len] = {};datas[datas_len].name = name;datas[datas_len].price = price;}function winbid_show(from,refid){logDebug('EHB:('+refid+') winbid_show',from);var hb = getData(refid); var orefid = refid; logDebug('EHB:('+refid+') hb:',hb); winnerPost(null,refid); var data = false; var gotoetarget = true; if(typeof(hb)!='object' || hb==null){ /**/ }else{ data = hb.data; var raw = hb.raw; var id = hb.id; var refidx = hb.refid; var iframe = hb.iframe; var div = hb.div; var size = hb.size; winnerPost(null,refid); logDebug('EHB:('+refid+') data:',hb,iframe); if(typeof(data)=='object' && data){ if(iframe){ if(id){ if(data.url){ logDebug('EHB:('+refid+') dtype:url'); var src = data.url; var html = ajaxcallX(src,function(e){insertHTML(iframe,e,false,hb)}); }else if(data.ad){ logDebug('EHB:('+refid+') dtype:ad'); insertHTML(iframe,data.ad,false,hb); }else if(data.vastUrl){ logDebug('EHB:('+refid+') dtype:vastUrl'); if(data.vastUrl.indexOf('etargetnet')>=0){ var parts = data.vastUrl.replace('hd=','v=').split('?'); var loadurl = 'https://sk.search.etargetnet.com/embed/player/load.php?'+parts[1]; }else{ var loadurl = 'https://sk.search.etargetnet.com/embed/player/load.php?ref='+orefid+'&defvast='+btoa(encodeURIComponent(data.vastUrl)); } logDebug('vast',loadurl); loadurl += '&x='+size[0]; loadurl += '&y='+size[1]; logDebug('vast',loadurl); insertHTML(iframe,null,loadurl,hb); }else{ insertHTML(iframe,false,false,hb); } } } if(data.system=='etarget' && data.reason=='last chance'){ winnerPost('etargetppc',refid); }else{ winnerPost(data.system,refid); } gotoetarget = false; } } if(gotoetarget){ logDebug('EHB:('+refid+') before goToEtarget from winbid_show'); goToEtarget(iframe,refid); } if(data){ if(data.system=='etarget'){ div.getElementsByClassName('footer')[0].style.cssText = 'display:none'; } } }window.winbid_showx = function(a,b){ winbid_show(a,b); };function setData(refid, data){ logDebug('EHB:('+refid+') setData:',window.hb,refid,data); var index = -1; try{ var retval = null; if(!refid || !data){ logDebug('EHB:('+refid+') no refid or data:',data); retval = windows.hb; }else{ for(var i in window.hb){ var val = window.hb[i]; if(val){ logDebug('EHB:('+refid+') setDataSearch:',val.id,refid); if(parseInt(val.id)==parseInt(refid)){ index = i; break; } } } } if(index>-1){ window.hb[index] = data }else{ window.hb.push(data); } }catch(e){ console.error(e); window.hb.push(data); } }function getData(refid){ logDebug('EHB:('+refid+') getData:',window.hb); try{ var retval = null; if(!refid){ retval = windows.hb; }else{ for(var i in window.hb){ var val = window.hb[i]; if(val){ logDebug('EHB:('+refid+') getDataSearch:',val.id,refid); if(parseInt(val.id)==parseInt(refid)){ logDebug('EHB:('+refid+') return',val); retval = val; return val; } } } } logDebug('EHB:('+refid+') vraciam:',retval); return retval; }catch(e){ console.error(e); } return null;}function goToEtarget(iframe,refid){ logDebug('EHB('+refid+'): goToEtarget',refid,iframe); var winner = 'etargetfallback'; var hb = getData(refid); if(!iframe && typeof(hb)=='object' && hb!=null){ iframe = hb.iframe; } logDebug('EHB('+refid+'): draw-fallback','hasData',hb); var fallbackalowed = ((window.location.href.indexOf('fallbackalowed')>0) || true); logDebug('EHB('+refid+'): draw-fallback','goToEtarget',typeof(hb.fallback),fallbackalowed); if(typeof(hb)=='object' && hb && fallbackalowed && window.globalfallbackType[refid]!='etarget'){ if(typeof(hb.fallback)=='string'){ logDebug('EHB('+refid+'): draw-fallback','string',hb.fallback); if(hb.fallback.length>10){ logDebug('EHB('+refid+'): fallback',hb.fallback,hb); try{ logDebug('EHB('+refid+'): draw-fallback','script'); if(hb.fallback.indexOf('scrip')===1){ var doc = iframe.contentWindow.document; doc.open(); doc.write(''+hb.fallback+''); doc.close(); }else{ var div = hb.div; var ifrm = document.getElementById('etarget_hb_'+refid); if(hb.fallback.indexOf('http')===0 && ifrm){ ifrm.src = hb.fallback; logDebug('hb redraw',ifrm); }else{ var scrpt = document.createElement('script'); scrpt.id = 'etarget_hb_script_'+refid; scrpt.innerHTML = hb.fallback; window.winnerShow[refid] = ['appendChild',div,scrpt]; iframe.style.height = '0px'; if(typeof(hb.div)=='object'){ hb.div.style.height = 'auto'; hb.div.querySelector('.footer').style.display='none'; } logDebug('hb inserted',div); } } if(hb.fallback.indexOf('googletag')>-1 || hb.fallback.indexOf('div-gpt')>-1){ winner = 'google'; window.hbgoogle[refid].push({'code':'gof_'+refid, 'cpm':window.globalFallbackPrice[refid]}); } logDebug('EHB('+refid+'): log-fallback',hb.fallback.indexOf('google'),window.hbgoogle); }catch(e){ console.error(e) } winnerPost(winner,refid,true); checkWinnerFallbackShow(refid); return true; } } } if(autoClose){ tryToCloseIframe(iframe); return; } if(iframe && window.globalFlags[refid].ppc===0){ var sf = specFormat(refid,hb.size[0]+'x'+hb.size[1]); var loc = document.location.href; var src = 'https://bg.search.etargetnet.com/generic/iframe.php?ref='+refid+'&fromhb=1&area='+hb.size[0]+'x'+hb.size[1]+'&referer='+loc+'&sppos=3&replaceTo=uni&tabl=4&no_pixel=1'+sf; iframe.src = src; iframe.width = hb.size[0]; iframe.height = hb.size[1]; winnerPost('etargetppc',refid,true); }}function checkWinnerFallbackShow(refid){ logDebug('EHB:('+refid+')','checkWinnerFallbackShow',window.winnerShow[refid]); if(typeof(window.winnerShow[refid])=='object'){ switch(window.winnerShow[refid][0]){ case 'appendChild':{ window.winnerShow[refid][1].appendChild(window.winnerShow[refid][2]); }; break; } }}function tryToCloseIframe(iframe){ if(true){ if(typeof(iframe)=='object' && iframe!=null){ iframe.style.width = '0px'; iframe.style.height = '0px'; iframe.style.display = 'none'; if(typeof(iframe.parentNode)=='object'){ var pid = iframe.parentNode.className; if(pid.indexOf('_et_hb_cont')>=0){ iframe.parentNode.style.width = '0px'; iframe.parentNode.style.height = '0px'; iframe.parentNode.style.display = 'none'; } } } }}function specFormat(refid,size){ var sf = {}; sf['300x250'] = '300x250HD'; logDebug('EHB('+refid+'): sfSize:',size,sf[size]); return sf[size] ? '&s_output_type='+sf[size] : ''; }if(typeof(hb_vis_queue)=='undefined'){ var hb_vis_queue = []; }function insertHTML(iframe,e,src,hb){ logDebug('IFRAME:',iframe,e,src); var html = ''; try{ new Image().src = 'https://bg.search.etargetnet.com/event.php?h=z3TkYDM1ExMkF2YwQmfkRGNJNmN3gDT1IGN9NGT0UGNJfxTkoJM0o0c7ICL0FGLkoDN6M3TwoJY7Ikc95mbhjmI6YJT013TWoOL7IyLu9GbzNXdpjkT4o0c7qOM6E2TkEmI6EJT0tDN2IDN2YDMyYOM6i2TkQnI6EJT0tJI2cOMygJI6UJT0tJImVmcko0M6M3TWoOL7ISfyNmI6MJT0tOM6i2TkAXbJjkT0o0c7EJTqtJI0V3Yko0M6M3TkIGLyV3bkoON6M3TkUGc5RnI6QJT0tnT5oOY&tg=1620664264&t=[TIMESTAMP]&insider=0&timecap=[CONTENTPLAYHEADSEC]&rue=${REFERER_URL_ENC}&ga=${GENDER}&ag=${AGE}&acrid=${CREATIVE_ID}&label=ourhb'; }catch(e){ console.log(e); } if(src){ if(src.length>10 && e==null){ iframe.src = src; return true; } } if(e && false){ html = e; if(typeof(html)=='object'){ if(typeof(html.responseText)=='string'){ html = html.responseText; } } } var script = ''; if(customWidth>0 && hb.data.system=='etarget'){ script = ' '; } logDebug('script customWidth',customWidth,hb.data.system,script); var hasHead1 = html.indexOf(''); var hasHead2 = html.indexOf(''); var hasHead = parseInt(hasHead2-hasHead1); if(hasHead>10){ html = html.replace('',''); html = html.replace('',script+''); }else{ html = ''+html+script+''; } logDebug('IFRAME:',html,iframe); var refid = hb.refid.split('-')[2]; var doc = iframe.contentWindow.document; doc.open(); doc.write(html); logDebug('hb.data.adId',hb.raw); if(typeof(hb.raw.native)=='object'){ renderNativeAd(doc,hb,iframe); }else{ if(hb.raw.bidder=='teads' && typeof(hb.div)=='object' && hb.raw.mediaType=='video'){ doc.close(); iframe.style.display = 'none'; hb.div.style.width = '100%'; hb.div.style.height = 'auto'; pbjs.renderAd(hb.div, hb.raw.adId); }else{ pbjs.renderAd(doc, hb.raw.adId); doc.close(); } logDebug('isv',hb.raw.mediaType=='video',hb.raw.mediaType,hb.refid,hb.raw.bidder); } }function renderNativeAd(doc, hb, iframe){ logDebug('EHB: (uni)','renderNativeAd'); var nObj = hb.raw.native; var clickUrl = nObj.clickUrl; var imgSrc = nObj.image && nObj.image.url; var wrap = document.createElement('div'); wrap.className = 'wrap'; var title = document.createElement('header'); title.className = 'title'; var body = document.createElement('div'); body.className = 'body'; var image = document.createElement('img'); var sponsored = false; title.innerHTML = nObj.title; body.innerHTML = nObj.body; if(typeof(nObj.sponsoredBy)=='string'){ sponsored = document.createElement('div'); sponsored.innerHTML = nObj.sponsoredBy; sponsored.className = 'sponsored'; } var style = document.createElement('style'); if(typeof(window.styling)=='object'){ if(typeof(window.styling[hb.id])=='object'){ style.innerHTML = style.innerHTML + 'body{cursor:pointer;font-family:'+window.styling[hb.id].font+'; font-size:'+window.styling[hb.id].fsi+'; background-color:'+window.styling[hb.id].bg+'}'; style.innerHTML = style.innerHTML + '.title{color:'+window.styling[hb.id].title.color+'}'; style.innerHTML = style.innerHTML + '.title:hover{color:'+window.styling[hb.id].title.hcolor+'}'; style.innerHTML = style.innerHTML + '.body{color:'+window.styling[hb.id].text.color+'}'; style.innerHTML = style.innerHTML + '.body:hover{color:'+window.styling[hb.id].text.hcolor+'}'; } } wrap.setAttribute('onclick','window.open(\"'+clickUrl+'\")'); wrap.style.cssText = 'display:block;width:100%;height:100%;text-decoration:none;'; title.style.cssText = 'font-size:120%;font-weight:bold;padding:4px 2px;'; body.style.cssText = 'padding:4px 2px;'; if(imgSrc){ image.src = imgSrc; wrap.appendChild(image); }else{ try{ var cont = document.getElementsByClassName('_et_hb_cont'); if(cont.length>0){ var foot = cont[0].getElementsByClassName('footer'); if(foot.length>0){ foot[0].style.display = 'none'; } } }catch(e){ console.log(e); } } wrap.appendChild(style); wrap.appendChild(title); wrap.appendChild(body); if(sponsored){ wrap.appendChild(sponsored); } doc.write(wrap.outerHTML); var wrapsize = doc.getElementsByClassName('wrap')[0].clientHeight; if(wrapsize>0){ iframe.height = wrapsize; iframe.style.cssText = 'height:'+wrapsize+'px !important; border:none; width:100%;'; iframe.parentNode.style.height = wrapsize+'px'; } var impTrackers = nObj.impressionTrackers || []; var jsTrackers = parseJsTrackers(nObj.javascriptTrackers) || []; var clickTrackers = nObj.clickTrackers; for(var i = 0; i < impTrackers.length; i++) { fireRequest(impTrackers[i]); } for(var i = 0; i < jsTrackers.length; i++) { if(true) { var scr = doc.createElement('script'), tar = doc.getElementsByTagName('head')[0]; scr.type = 'text/javascript'; scr.async = true; scr.src = jsTrackers[i]; tar.insertBefore(scr, tar.firstChild); } } var clickable = Array.prototype.slice.apply(doc.getElementsByTagName('body')); for(var i = 0; i < clickable.length; i++) { clickable[i].addEventListener('click', function() { for(var j = 0; j < clickTrackers.length; j++) { fireRequest(clickTrackers[j]); } }); }; try{ if(false){ ajaxcallX('https://bg.search.etargetnet.com/ajax/partner_counter.php?type=render&category=native&ref='+hb.id); } }catch(e){ console.log(e); }}function fireRequest(url) { var request = new XMLHttpRequest(); request.open('GET', url); request.send();};function parseJsTrackers(str) { str = str.replace(/\"/ig,'°'); var urls = [], regex = new RegExp('(?:data-)?src=°([^°]*)°','g'), result; var i = 0; try{ while((result = regex.exec(str)) !== null) { urls.push(result[1]); i++; if(i>20){ break; } } }catch(e){ console.log(e); } return urls;}function visibleArea(obj){ try{ var wtop = top; if(typeof(top)=='object'){ if(top.length!=1 || !top.length || typeof(top.length)=='undefined'){ wtop = window; } } var ww = wtop.innerWidth; var wh = wtop.innerHeight; var dw = wtop.document.body.clientWidth; var dh = wtop.document.body.clientHeight; var vw = wtop.innerWidth; var vh = wtop.innerHeight; vw = obj.clientWidth; vh = obj.clientHeight; var vr = vw*vh; var vpl = findLeft(obj); var vpt = findTop(obj); var viewabilityState = 0; if(vpl && vpt && ww>0){ var vpw = findLeft(obj); var vph = findTop(obj); var dst = top.scrollY; var dsl = top.scrollX; var difw = vpw-dsl; var difh = vph-dst; var difw2 = ww+dsl-vpw-vw; var difh2 = wh+dst-vph-vh; var resw = vw; var resh = vh; if(difw<0){ resw = resw+difw; } if(difw2<0){ resw = resw+difw2; } if(difh<0){ resh = resh+difh; } if(difh2<0){ resh = resh+difh2; } var vnr = resw*resh; var prc = parseInt(vnr/vr*100); if(prc>=visiblePart){ viewabilityState = 1; } }else{ viewabilityState = 2; } return viewabilityState; }catch(e){ return 0; }}function findTop(obj) { if(!obj) return 0; return obj.offsetTop + findTop(obj.offsetParent);}function findLeft(obj) { if(!obj) return 0; return obj.offsetLeft + findLeft(obj.offsetParent);}function checkAfterScroll(e){ var allHBFrames = document.getElementsByTagName('iframe'); for(var k in allHBFrames){ var HBFrame = allHBFrames[k]; if(typeof(HBFrame)=='object'){ if(typeof(HBFrame.getAttribute)=='function'){ var id = HBFrame.getAttribute('id'); if(id){ if(id.indexOf('etarget_hb')>=0){ var refid = (id.split('_'))[2]; if(visibleArea(HBFrame)){ var fromqueue = hb_vis_queue[refid]; if(typeof(fromqueue)=='object'){ if(typeof(fromqueue.google)=='object'){ var iframe = fromqueue.google.iframe.contentWindow.document; var adx_string = fromqueue.google.e; logDebug('EHB:('+refid+') after scroll',adx_string); iframe.open('text/html', 'replace'); iframe.write(adx_string); iframe.close(); winnerPost('google',refid); }else{ winbid_show(4,refid); } delete hb_vis_queue[refid]; } } } } } } }}function insertIntoQueue(iframe,e,src,hb,customWidth){ logDebug('EHB:queue',hb); if(!hb) return false; var refid = hb.id; var system = hb.data.system; if(src=='google'){ system = 'google'; } if(typeof(hb_vis_queue[refid])=='undefined'){ hb_vis_queue[refid] = []; } if(typeof(hb_vis_queue[refid][system])=='undefined'){ hb_vis_queue[refid][system] = {}; } hb_vis_queue[refid][system].iframe = iframe; hb_vis_queue[refid][system].e = e; hb_vis_queue[refid][system].src = src; hb_vis_queue[refid][system].hb = hb; hb_vis_queue[refid][system].customWidth = customWidth;}function ajaxcallX(src,callback,noperm){ var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(){ if (xhr.readyState == 4 && xhr.status == 200){ if(typeof(callback)!='undefined'){ callback(xhr); } } }; xhr.open('GET', src, true); if(!noperm){ xhr.withCredentials = true; } xhr.send(null); return true; }function winnerPost(winner,refid,now){if(window.winnerint[refid]){clearInterval(window.winnerint[refid]);window.winnerint[refid] = false;} logDebug('EHB:('+refid+') Vyhral-start:',winner,refid); var intmt = 3000; if(now){ intmt = 100; } if(typeof(winner)=='string'){ if(winner.length>0 && parseInt(refid)>0){ window.winnerint[refid] = setTimeout(function(){ logDebug('EHB:('+refid+') Vyhral-send:',winner); logWinner(winner,refid); if(winner!='etarget'){ try{ var viewscrpt = document.createElement('script'); viewscrpt.src = '//bg.search.etargetnet.com/generic/viewable.php?h=ltOM6i2TzoOL7EJTqtOM6i2TWoOL7AJTqtJIGjOjnjma4VGbuc3d3fiM9YiM9EzM9MHczRHLlz2byfmjko0M0o0c7IkbqdxLylmI6YJT0tnTzoOY&imidiate=now&ref='+refid; var el = document.getElementById('etarget-id-'+refid); logDebug('EHB:('+refid+') viewable:',el,window.etParentWrap[refid]); if(!el && window.etParentWrap[refid]){ window.etParentWrap[refid].appendChild(viewscrpt); }else{ if(el){ el.appendChild(viewscrpt); } } }catch(e){ logDebug('error',e); } } },intmt); } }}function createJsonFromData(winner, refid){ var data = window.hbresponse; if(!data){ return; } var request = data[0]; var response = data[1]; var goog = window.hbgoogle[refid]; logDebug('EHB('+refid+'): JSON START',data,goog,winner); var ret = {}; ret['etargetppc'] = 0; if(!!request){ if(typeof(request.adUnits)!='undefined'){ logDebug('EHB('+refid+'): JSON IN',request.adUnits); for(var k in request.adUnits){ var adunit = request.adUnits[k]; var aducode = adunit.code; if(aducode.indexOf(refid)>0){ var adubids = adunit.bids; for(var l in adubids){ ret[adubids[l].bidder] = 0; } } } } } if(!!response){ logDebug('EHB('+refid+'): JSON IN2',response); for(var k in response){ if(k.indexOf(refid)>0){ var bids = response[k].bids; for(var l in bids){ logDebug('EHB('+refid+'): JSON BIDS',bids[l]); var reason = ''; if(typeof(bids[l].reason)=='string'){ reason = bids[l].reason; } if(bids[l].bidder=='etarget' && reason=='last chance'){ ret['etargetppc'] = parseFloat(bids[l].cpm); }else{ ret[bids[l].bidder] = parseFloat(bids[l].cpm); } } } } } if(!!goog){ logDebug('EHB('+refid+'): JSON IN3',goog); for(var k in goog){ if(goog[k].code.indexOf(refid)>0){ ret['google'] = parseFloat(goog[k].cpm); } } } logDebug('EHB('+refid+'): JSON END',ret); return ret;}function logWinner(winner, refid){ var datas = createJsonFromData(winner, refid);logDebug('EHB:(82176) winnerLog',winner,datas); logDebug('EHB('+refid+'): draw-fallback','winner',winner,refid,window.winnerLog[refid]); if(winner && winner!=null && !window.winnerLog[refid]){ window.winnerLog[refid] = 1; var data = JSON.stringify(datas); var pos = 'btf'; var isVisible = visibleArea(hbparent); if(isVisible===1){ pos = 'atf'; } var device = isMobile.any() ? 'mobile' : 'desktop'; var url = 'https://bg.search.etargetnet.com/generic/header_bidding_log.php?ref='+refid+'&position='+pos+'&data='+data+'&device='+device+'&referer=82176&winner='+winner; ajaxcallX(url,function(e){logDebug('EHB:('+refid+') success',url);},true); var winner_logo = logos[winner]; if(winner_logo){ var newlogo = '//sk.search.etargetnet.com/img/logo/etarget_logo_dark_uni_small'+winner_logo+'.png'; var footer = document.querySelector('#inmain .footer'); if(footer){ var footera = footer.firstChild; if(footera){ footera.style.cssText = 'background-image:url('+newlogo+') !important'; logDebug('EHB:(82176) logo',footera); } } } }else{ logDebug('EHB:('+refid+') before goToEtarget from logWinner'); goToEtarget(false,refid); }}"; window.self.document.head.appendChild(bscr); if(typeof(window.etargetHBInit)=='undefined'){ window.etargetHBInit = 1; var waitUntilBC = false; if(hbCheckAccessToTop()==2){ if(''.length>0){ if('0'=='1'){ var pscr = document.createElement('script'); pscr.src = 'https://sk.search.etargetnet.com/generic/branding-common.php?stickmenu=&footer=&flexi=0&divclass='; document.head.appendChild(pscr); }else{ var pscr = document.createElement('script'); pscr.src = 'https://sk.search.etargetnet.com/generic/branding-common.php?fromhb=1&divclass='; document.head.appendChild(pscr); } waitUntilBC = true; } } logDebug('EHB: waitUntilBC',waitUntilBC); if(waitUntilBC){ setTimeout(function(){ _et_laodPrebid(); },500); }else{ _et_laodPrebid(); } } } function _et_laodPrebid(){ var pscr = document.createElement('script'); var pbjs_version = '4.37.0'; if('82176'=='48800' || '82176'=='55409' || '82176'=='56082' || '82176'=='56083' || '82176' == '58700'){ pbjs_version = '4.37.0'; } pscr.src = 'https://sk.search.etargetnet.com/hb/prebid'+pbjs_version+'.js'; window.self.document.head.appendChild(pscr); } function _et_HBAllLoaded(){ var etargetHBCount = 0; if(typeof(adUnits)=='object'){ var scripts = document.getElementsByTagName('script'); var adUnitCount = adUnits.length; for(var k in scripts){ var script = scripts[k]; var src = script.src; if(typeof(src)!='undefined'){ if(src.indexOf('header_bidding')>0){ etargetHBCount++; } } } if(adUnitCount>=etargetHBCount){ return true; } } return false; } function logDebug(){ var ourips = parseInt(''); var args = arguments; var debugon = Math.max(window.location.href.indexOf('hbjsdebug'),document.referrer.indexOf('hbjsdebug')); if(debugon>=0){ console.log(args); return true; } return false; }