;thetahb = {}; thetahb.selector = 'p'; thetahb.sellerId = 10; thetahb.onesticky = (el) => { thetahb.container = thetahb.container || el if (thetahb.container !== null) { window.addEventListener('scroll', () => { thetahb.scrolling = true }) thetahb.scrollInterval = setInterval(() => { thetahb.finalize(el) if (thetahb.scrolling) { thetahb.scrolling = false if(thetahb.container.clientHeight > 0) { thetahb.oneScroll(el) } } }, 300) } else { clearInterval(thetahb, scrollInterval) } } thetahb.simplesticky = (el) => { thetahb.container = thetahb.container || el if (thetahb.container !== null) { window.addEventListener('scroll', () => { thetahb.scrolling = true }) thetahb.scrollInterval = setInterval(() => { thetahb.finalize(el) if (thetahb.scrolling) { thetahb.scrolling = false if(thetahb.container.clientHeight > 0) { thetahb.simpleScroll(el) } } }, 300) } else { clearInterval(thetahb, scrollInterval) } } thetahb.oneScroll = function (el) { thetahb.container = thetahb.container || el thetahb.iframe = thetahb.iframe || thetahb.container.getElementsByTagName('iframe')[0] let { rect, b, c, m, w, iw, ih, mw, mh } = thetahb.preparePositioning() if (c != 0) { let style = `position: fixed; left: 50%; top: 50%; width: 1px !important; height: 1px !important;` thetahb.container.setAttribute('style', style) if(typeof thetahb.iframe !== "undefined") { thetahb.iframe.setAttribute('style', style) } if (thetahb.stickyElement) thetahb.stickyElement.el.setAttribute('style', style) if (thetahb.keepclose === true) { thetahb.close.style.display = 'block' } thetahb.buffer.setAttribute('style', `height:` + thetahb.containerHeight + 'px;') } else { thetahb.originalPosition(m) } } thetahb.simpleScroll = function(el) { thetahb.container = thetahb.container || el thetahb.iframe = thetahb.iframe || thetahb.container.getElementsByTagName('iframe')[0] let { rect, b, c, m, w, iw, ih, mw, mh } = thetahb.preparePositioning() if (c != 0) { if (m) { thetahb.mobilePositioning(mw, mh) } else { let style = `position: fixed; right: 0; bottom: 0; width: ${iw}px !important; height: ${ih}px !important; z-index: 20 !important;` thetahb.container.setAttribute('style', style) if(typeof thetahb.iframe !== "undefined") { thetahb.iframe.setAttribute('style', style) thetahb.player = thetahb.iframe.contentWindow.document.getElementById('vast-wrapper') thetahb.player.play() } } if (thetahb.keepclose === true) { thetahb.close.style.display = 'block' } thetahb.buffer.setAttribute('style', `height:` + thetahb.containerHeight + 'px;') } else { thetahb.originalPosition(m) } } thetahb.mobileCheck = function () { let check = false; ((a) => { if ( /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test( a ) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test( a.substr(0, 4) ) ) check = true })(navigator.userAgent || navigator.vendor || window.opera) return check } thetahb.isElementInViewport = function (rect) { if (rect.top + rect.height / 2 < 0) { return -1 } if (rect.top + rect.height / 2 > (window.innerHeight || document.documentElement.clientHeight)) { return 1 } return 0 } thetahb.preparePositioning = function () { let rect = { bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0 } rect = thetahb.sibling.getBoundingClientRect() let w = thetahb.containerWidth * thetahb.factor let b = { height: rect.height, width: rect.width, top: rect.top + thetahb.container.clientHeight / 2 + thetahb.sibling.clientHeight, left: rect.left } let c = thetahb.isElementInViewport(b) let m = thetahb.mobileCheck() let iw = 270 //thetahb.factor * thetahb.containerWidth let ih = 202 //thetahb.factor * thetahb.containerHeight let mw = thetahb.mobilefactor * thetahb.containerWidth let mh = thetahb.mobilefactor * thetahb.containerHeight return { rect, b, c, m, w, iw, ih, mw, mh } } thetahb.mobilePositioning = function (w, h) { if (thetahb.keepclose === true) { thetahb.close.style.display = 'block' } let style = `position: fixed; bottom:` + thetahb.bottomOffset + `px; left: 50%; transform: translate(-50%, 0); width: ${w}px !important; height: ${h}px !important; z-index: 20;` if (thetahb.mobilePosition !== undefined && thetahb.mobilePosition === 'top') { style = `position: fixed; top: 50px; left: 50%; transform: translate(-50%, 0); width: ${w}px !important; height: ${h}px !important; z-index: 20;` } thetahb.container.setAttribute('style', style) thetahb.iframe.setAttribute('style', style) thetahb.container.setAttribute( 'style', `position: fixed; top: 10%; left: 50%; transform: translate(-50%, -10%); width: ${w}px !important; height: ${h}px !important; z-index: 20;` ) thetahb.iframe.setAttribute( 'style', `position: fixed; top: 10%; left: 50%; transform: translate(-50%, -10%); width: ${w}px !important; height: ${h}px !important; z-index: 20;` ) thetahb.adsby.style.top = '55px' thetahb.close.style.top = '55px' thetahb.controlbar.style.bottom = '45px' } thetahb.originalPosition = function (m) { if (m) { thetahb.container.setAttribute('style', 'position: relative;') thetahb.iframe.setAttribute('style', 'position: relative; margin: 0 !important;') thetahb.adsby.style.top = '7px' thetahb.close.style.top = '7px' thetahb.controlbar.style.bottom = '0px' } else { thetahb.container.setAttribute( 'style', `clear: both; position: relative;width: 100% !important; margin: 0 auto;` ) thetahb.iframe.setAttribute( 'style', `clear: both; position: relative; width: 100% !important; margin: 0 !important;` ) } thetahb.buffer.setAttribute('style', `height: 0;`) } thetahb.prepare = function (el) { thetahb.container = thetahb.container || el if (thetahb.container !== null) { thetahb.container.style.bottom = 0 thetahb.container.style.right = 0 thetahb.container.style.margin = '0 auto' thetahb.container.parentElement.style.zIndex = '3' } thetahb.sibling = document.createElement('div') thetahb.sibling.setAttribute('id', 'thetasib') thetahb.container.parentNode.insertBefore(thetahb.sibling, thetahb.container) thetahb.buffer = document.createElement('div') thetahb.buffer.setAttribute('id', 'thetabuffer') thetahb.container.parentNode.insertBefore(thetahb.buffer, thetahb.container) } thetahb.finalize = (el) => { thetahb.container = thetahb.container || el thetahb.iframe = thetahb.container.querySelectorAll('iframe')[0] if (typeof thetahb.iframe !== "undefined" && thetahb.iframe.contentWindow.document.getElementById('thetaadsby') === null && thetahb.iframe.contentWindow.document.getElementById('banner') !== null && thetahb.iframe.contentWindow.document.getElementById('vast-skip') !== null) { thetahb.adsby = document.createElement('div') thetahb.adsby.setAttribute('id', 'thetaadsby') thetahb.adsby.setAttribute( 'style', 'display: block; \ position: absolute; \ z-index: 20; \ cursor: pointer; \ top: 7px; \ left: 5px; \ color: #fff; \ font-size: 11px; \ text-decoration: none; \ border-radius: 5px' ) let img = document.createElement('img') img.src = 'https://assets.thetamedia.gr/inread/ads-by-theta@2x.png' if (thetahb.mobileCheck()) { img.setAttribute('width', '60') } else { img.setAttribute('width', '125') } thetahb.adsby.appendChild(img) thetahb.iframe.contentWindow.document.getElementById('banner').appendChild(thetahb.adsby) thetahb.player = thetahb.iframe.contentWindow.document.getElementById('vast-wrapper') thetahb.player.style.backgroundColor = 'transparent' img = document.createElement('img') img.src = 'https://assets.thetamedia.gr/inread/close-theta@2x.png' img.setAttribute('width', '16') thetahb.close = thetahb.iframe.contentWindow.document.getElementById('vast-skip') // thetahb.close.innerHTML = ""; // thetahb.close.appendChild(img) if (thetahb.keepclose === false) { thetahb.close.style.display = 'none' } // thetahb.controlbar = // thetahb.iframe.contentWindow.document.querySelector('.vjs-control-bar') // thetahb.controlbar.setAttribute('style', 'opacity: 1 !important; bottom: 0 !important;') let e = thetahb.iframe.contentWindow.document.querySelector('.vjs-progress-control') e = thetahb.iframe.contentWindow.document.querySelector('.vjs-play-control') //e.parentElement.removeChild(e) thetahb.clearInterval = window.setInterval(function () { if (thetahb.iframe.contentWindow.document.getElementById('banner') === null) { thetahb.container.remove() window.clearInterval(thetahb.clearInterval); window.clearInterval(thetahb.scrollInterval); } }, 500); } } thetahb.thetalize = (el) => { thetahb.container = thetahb.container || el thetahb.adsby = document.createElement('div') thetahb.adsby.setAttribute('id', 'thetaadsby') thetahb.adsby.setAttribute( 'style', 'display: block; \ position: absolute; \ z-index: 20; \ cursor: pointer; \ top: 30px; \ left: 0px; \ color: #fff; \ font-size: 11px; \ text-decoration: none; \ border-radius: 5px' ) let img = document.createElement('img') img.src = 'https://assets.thetamedia.gr/inread/ads-by-theta@2x.png' if (thetahb.mobileCheck()) { img.setAttribute('width', '60') } else { img.setAttribute('width', '140') } thetahb.adsby.appendChild(img) thetahb.container.appendChild(thetahb.adsby) img = document.createElement('img') img.src = 'https://assets.thetamedia.gr/inread/close-theta@2x.png' img.setAttribute('width', '30') img.setAttribute('style', 'position: absolute; top: 30px; right:0px; z-index:20;') img.addEventListener("click", (ev) => { thetahb.container.remove() }) thetahb.container.appendChild(img) } console.log("THETA HEADER BIDDING"); thetahb.selector = 'p' thetahb.wrapperLength = 1 thetahb.reloaded = false thetahb.mobile = function () { let check = false; ((a) => { if ( /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test( a ) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test( a.substr(0, 4) ) ) check = true })(navigator.userAgent || navigator.vendor || window.opera) return check } thetahb._theta_head = window.parent.document.head || window.parent.document.getElementsByTagName('head')[0] thetahb._theta_body = window.document.body || window.document.getElementsByTagName('body')[0] thetahb.pel = document.createElement('script') thetahb.pel.src = '//www.googletagservices.com/tag/js/gpt.js' thetahb.pel.async = true thetahb._theta_head.appendChild(thetahb.pel) thetahb.pel = document.createElement('script') var timestamp = new Date().getTime(); thetahb.pel.src = `https://assets.thetamedia.gr/prebid.js?t=${timestamp}` thetahb.pel.async = true thetahb._theta_head.appendChild(thetahb.pel) thetahb.PREBID_TIMEOUT = 3000; thetahb.FAILSAFE_TIMEOUT = 5000; thetahb.div_sizes = [ [300, 250], [300, 600] ] thetahb.div0_sizes = [ [300, 250] ]; thetahb.div1_sizes = [ [300, 600] ]; thetahb.div2_sizes = [ [970, 250] ] thetahb.div3_sizes = [ [320, 50] ] var googletag = googletag || {}; googletag.cmd = googletag.cmd || []; thetahb.slots = []; (thetahb.buildSlots = function () { if (thetahb.mobile()) { googletag.cmd.push(function () { let e = document.querySelectorAll('div[data-adunitname="billboard1"]') e = e[e.length - 1] thetahb.slots.push(googletag.defineSlot('/21689298071/caranddriver.gr/billboard1', thetahb.div2_sizes, e.id).addService(googletag.pubads())); googletag.pubads().disableInitialLoad(); googletag.pubads().enableSingleRequest(); googletag.enableServices(); googletag.display(e.id); }) googletag.cmd.push(function () { googletag.defineSlot('/21689298071/caranddriver.gr/mobile_sticky', thetahb.div3_sizes, 'div-d_ros_article_32050_mobile').addService(googletag.pubads()); googletag.pubads().disableInitialLoad(); googletag.pubads().enableSingleRequest(); googletag.enableServices(); googletag.display('div-d_ros_article_32050_mobile'); }) } else { googletag.cmd.push(function () { let e = document.querySelectorAll('div[data-adunitname="billboard1"]') e = e[e.length - 1] thetahb.slots.push(googletag.defineSlot('/21689298071/caranddriver.gr/billboard1', thetahb.div2_sizes, e.id).addService(googletag.pubads())); googletag.pubads().disableInitialLoad(); googletag.pubads().enableSingleRequest(); googletag.enableServices(); googletag.display(e.id); }) googletag.cmd.push(function () { let e = document.querySelectorAll('div[data-adunitname="sidebar1"]') e = e[e.length - 1] thetahb.slots.push(googletag.defineSlot('/21689298071/caranddriver.gr/sidebar1', thetahb.div_sizes, e.id).addService(googletag.pubads())); googletag.pubads().disableInitialLoad(); googletag.pubads().enableSingleRequest(); googletag.enableServices(); googletag.display(e.id); }) googletag.cmd.push(function () { let e = document.querySelectorAll('div[data-adunitname="sidebar2"]') e = e[e.length - 1] thetahb.slots.push(googletag.defineSlot('/21689298071/caranddriver.gr/sidebar2', thetahb.div_sizes, e.id).addService(googletag.pubads())); googletag.pubads().disableInitialLoad(); googletag.pubads().enableSingleRequest(); googletag.enableServices(); googletag.display(e.id); }) } })() if (thetahb.mobile()) { thetahb.adUnits = [ { code: '/21689298071/caranddriver.gr/billboard1', mediaTypes: { banner: { sizes: thetahb.div_sizes } }, bids: [{ bidder: "adform", params: { mid: 1148794 } }, { bidder: "richaudience", params: { supplyType: "site", pid: "6jMv18zBy4" } }, { bidder: 'adtelligent', params: { aid: 872369 } }, { bidder: "adform", params: { mid: 1265251 } }, { bidder: 'adtelligent', params: { aid: 872370 } }] }, { code: '/21689298071/caranddriver.gr/inline1', mediaTypes: { banner: { sizes: thetahb.div_sizes } }, bids: [{ bidder: "adform", params: { mid: 1148794 } }, { bidder: "richaudience", params: { supplyType: "site", pid: "6jMv18zBy4" } }, { bidder: 'adtelligent', params: { aid: 872369 } }, { bidder: "adform", params: { mid: 1265251 } }, { bidder: 'adtelligent', params: { aid: 872370 } }] }, { code: '/21689298071/caranddriver.gr/inline2', mediaTypes: { banner: { sizes: thetahb.div_sizes } }, bids: [{ bidder: "adform", params: { mid: 1148794 } }, { bidder: "richaudience", params: { supplyType: "site", pid: "6jMv18zBy4" } }, { bidder: 'adtelligent', params: { aid: 872369 } }, { bidder: "adform", params: { mid: 1265251 } }, { bidder: 'adtelligent', params: { aid: 872370 } }] }, { code: 'mobile_sticky', mediaTypes: { banner: { sizes: thetahb.div3_sizes } }, bids: [{ bidder: "adform", params: { mid: 1866290 } }, { bidder: 'adtelligent', params: { aid: 872863 } }] } ]; } else { thetahb.adUnits = [ { code: '/21689298071/caranddriver.gr/sidebar1', mediaTypes: { banner: { sizes: thetahb.div_sizes } }, bids: [{ bidder: "adform", params: { mid: 1148794 } }, { bidder: "adform", params: { mid: 1757077 } }, { bidder: "richaudience", params: { supplyType: "site", pid: "6jMv18zBy4" } }, { bidder: 'adtelligent', params: { aid: 872370 } }, { bidder: "adform", params: { mid: 1265251 } }, { bidder: 'adtelligent', params: { aid: 872370 } }] }, { code: '/21689298071/caranddriver.gr/sidebar2', mediaTypes: { banner: { sizes: thetahb.div_sizes } }, bids: [{ bidder: "adform", params: { mid: 1148794 } }, { bidder: "adform", params: { mid: 1757077 } }, { bidder: "richaudience", params: { supplyType: "site", pid: "6jMv18zBy4" } }, { bidder: 'adtelligent', params: { aid: 872370 } }, { bidder: "adform", params: { mid: 1265251 } }, { bidder: 'adtelligent', params: { aid: 872370 } }] }, { code: '/21689298071/caranddriver.gr/sidebar3', mediaTypes: { banner: { sizes: thetahb.div_sizes } }, bids: [{ bidder: "adform", params: { mid: 1148794 } }, { bidder: "adform", params: { mid: 1757077 } }, { bidder: "richaudience", params: { supplyType: "site", pid: "6jMv18zBy4" } }, { bidder: 'adtelligent', params: { aid: 872370 } }, { bidder: "adform", params: { mid: 1265251 } }, { bidder: 'adtelligent', params: { aid: 872370 } }] }, { code: 'theta_sticky', mediaTypes: { banner: { sizes: thetahb.div_sizes } }, bids: [{ bidder: "adform", params: { mid: 1148794 } }, { bidder: "richaudience", params: { supplyType: "site", pid: "6jMv18zBy4" } }, { bidder: 'adtelligent', params: { aid: 872369 } }, { bidder: "adform", params: { mid: 1265251 } }, { bidder: 'adtelligent', params: { aid: 872370 } }] }, { code: '/21689298071/caranddriver.gr/billboard1', mediaTypes: { banner: { sizes: thetahb.div2_sizes } }, bids: [{ bidder: "adform", params: { mid: 1718514 } }, { bidder: 'adtelligent', params: { aid: 872864 } }] }, ]; } thetahb.ins = document.querySelectorAll(thetahb.selector) thetahb.ins = thetahb.ins.length === 1 || thetahb.selector.includes('#') ? thetahb.ins[0] : thetahb.ins[1] thetahb.container = document.createElement('div') thetahb.container.setAttribute('id', 'thetainreadcontainer') thetahb.container.setAttribute('style', 'position: relative') thetahb.ins.append(thetahb.container) thetahb.videoAdUnit = { code: 'thetainreadcontainer', renderer: { url: 'https://s2.adform.net/banners/scripts/video/outstream/render.js', render: function (bid) { let ad = bid.ad || bid.vastXml; if (ad) { bid.renderer.push(() => { Adform.renderOutstream(bid, ad) thetahb.prepare(thetahb.container); if (thetahb.mobile()) { thetahb.onesticky(thetahb.container); } else { thetahb.simplesticky(thetahb.container); } }); } else { if (bid.vastUrl) { (async () => { ad = await fetch(resp).then(resp => resp.text()); if (typeof ad === 'string') { bid.renderer.push(() => { Adform.renderOutstream(bid, ad) thetahb.prepare(thetahb.container); if (thetahb.mobile()) { // thetahb.onesticky(thetahb.container); let observerOptions = { threshold: [0.3] } var observer = new IntersectionObserver(observerCallback, observerOptions); function observerCallback(entries, observer) { entries.forEach(entry => { if (entry.isIntersecting && theta.inread.container.clientHeight > 0) { theta.originalPosition() } else if (!entry.isIntersecting) { theta.one() } }); }; observer.observe(document.getElementById('thetasib')) theta.finalize() } else { thetahb.simplesticky(thetahb.container); } }); } else { console.log('Invalid VAST'); } })(); } else { console.log('Invalid ad'); } } } }, mediaTypes: { video: { playerSize: [640, 480], context: 'outstream', mimes: ['video/mp4'], protocols: [1, 2, 3, 4, 5, 6, 7, 8], playbackmethod: [2], skip: 1 } }, bids: [{ bidder: "adform", params: { mid: 1148881 } }] }; thetahb.CMP_TIMEOUT = 8000; thetahb.consentManagement = { gdpr: { cmpApi: 'iab', timeout: thetahb.CMP_TIMEOUT, actionTimeout: 10000, defaultGdprScope: true } } // googletag.cmd.push(function () { // googletag.defineSlot('/21689298071/caranddriver.gr/thetainreadcontainer', [[1, 1]], 'thetainreadcontainer').addService(googletag.pubads()); // googletag.pubads().disableInitialLoad(); // googletag.pubads().enableSingleRequest(); // googletag.enableServices(); // }); // let s = document.createElement('script') // s.innerHTML = 'googletag.cmd.push(function() {googletag.display("thetainreadcontainer");});' // thetahb.container.append(s) var pbjs = pbjs || {}; pbjs.que = pbjs.que || []; (thetahb.run = function () { function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } // if (typeof __tcfapi === 'undefined' && !window.location.host.includes('localhost')) { // sleep(100).then(() => { // thetahb.run() // }) // } else { pbjs.que.push(function () { if (window.location.pathname.split('/').length > 3) { pbjs.addAdUnits(thetahb.videoAdUnit); } pbjs.addAdUnits(thetahb.adUnits); thetahb.cfg = { enableTIDs: true, consentManagement: thetahb.consentManagement, currency: { adServerCurrency: 'EUR' }, schain: { validation: "strict", "config": { ver: "1.0", complete: 1, nodes: [ { asi: "thetamarketplace.com", sid: `${thetahb.sellerId}`, hp: 1 } ] } } } if (typeof __tcfapi === 'undefined') delete thetahb.cfg.consentManagement pbjs.setConfig(thetahb.cfg) pbjs.requestBids({ timeout: thetahb.PREBID_TIMEOUT, bidsBackHandler: thetahb.initAdserver }); }); thetahb.initAdserver = function () { if (pbjs.initAdserverSet) return; pbjs.initAdserverSet = true; googletag.cmd.push(function () { pbjs.que.push(function () { pbjs.setTargetingForGPTAsync(); googletag.pubads().refresh(); }); }); if (thetahb.mobile()) { let r = pbjs.getBidResponsesForAdUnitCode('/21689298071/caranddriver.gr/billboard1').bids if (r.length === 0) { let e = document.querySelectorAll('div[data-adunitname="billboard1"]') e = e[e.length - 1] if (e.childElementCount == 0) { let d = document.createElement('div') d.setAttribute('id', 'w2g-slot1-cnt') let s = document.createElement('script') s.innerHTML = `(function () { var domain = 'www.caranddriver.gr'; var slot = 'w2g-slot1'; if (window.self !== window.parent) { var d = top.document, w = window.parent; var parent = this.frameElement; parent.style.display = "none"; } else { var d = document, w = window, parent = null; if (typeof d.currentScript !== 'undefined') { parent = d.currentScript; if (parent == null) { parent = document.getElementById(slot + '-cnt'); } } else { parent = d.body.lastElementChild; } } d.addEventListener('wtgLoaded', function (e) { if (typeof w.w2g.single === 'function') { w.w2g.single(domain, slot, parent); } }, false); if (w.w2gLoaded === undefined) { w.w2gLoaded = 0; } if (w.w2gLoaded < 1 && w.w2g === undefined) { var element = d.createElement('script'), head = d.head || d.getElementsByTagName('head')[0]; element.type = 'text/javascript'; element.async = true; element.src = 'https://lib.wtg-ads.com/lib.single.wtg.min.js'; head.appendChild(element); w.w2gLoaded++; } if (w.w2g !== undefined && typeof w.w2g.single === 'function') { w.w2g.single(domain, slot, parent); } })();` e.appendChild(d) d.appendChild(s) } } r = pbjs.getBidResponsesForAdUnitCode('/21689298071/caranddriver.gr/inline1').bids if (r.length === 0) { let e = document.querySelectorAll('div[data-adunitname="inline1"]') e = e[e.length - 1] if (e.childElementCount == 0) { let d = document.createElement('div') d.setAttribute('id', 'w2g-slot2-cnt') let s = document.createElement('script') s.innerHTML = `(function () { var domain = 'www.caranddriver.gr'; var slot = 'w2g-slot2'; if (window.self !== window.parent) { var d = top.document, w = window.parent; var parent = this.frameElement; parent.style.display = "none"; } else { var d = document, w = window, parent = null; if (typeof d.currentScript !== 'undefined') { parent = d.currentScript; if (parent == null) { parent = document.getElementById(slot + '-cnt'); } } else { parent = d.body.lastElementChild; } } d.addEventListener('wtgLoaded', function (e) { if (typeof w.w2g.single === 'function') { w.w2g.single(domain, slot, parent); } }, false); if (w.w2gLoaded === undefined) { w.w2gLoaded = 0; } if (w.w2gLoaded < 1 && w.w2g === undefined) { var element = d.createElement('script'), head = d.head || d.getElementsByTagName('head')[0]; element.type = 'text/javascript'; element.async = true; element.src = 'https://lib.wtg-ads.com/lib.single.wtg.min.js'; head.appendChild(element); w.w2gLoaded++; } if (w.w2g !== undefined && typeof w.w2g.single === 'function') { w.w2g.single(domain, slot, parent); } })();` e.appendChild(d) d.appendChild(s) } } r = pbjs.getBidResponsesForAdUnitCode('/21689298071/caranddriver.gr/inline2').bids if (r.length === 0) { let e = document.querySelectorAll('div[data-adunitname="inline2"]') e = e[e.length - 1] if (e.childElementCount == 0) { let d = document.createElement('div') d.setAttribute('id', 'w2g-slot3-cnt') let s = document.createElement('script') s.innerHTML = `(function () { var domain = 'www.caranddriver.gr'; var slot = 'w2g-slot3'; if (window.self !== window.parent) { var d = top.document, w = window.parent; var parent = this.frameElement; parent.style.display = "none"; } else { var d = document, w = window, parent = null; if (typeof d.currentScript !== 'undefined') { parent = d.currentScript; if (parent == null) { parent = document.getElementById(slot + '-cnt'); } } else { parent = d.body.lastElementChild; } } d.addEventListener('wtgLoaded', function (e) { if (typeof w.w2g.single === 'function') { w.w2g.single(domain, slot, parent); } }, false); if (w.w2gLoaded === undefined) { w.w2gLoaded = 0; } if (w.w2gLoaded < 1 && w.w2g === undefined) { var element = d.createElement('script'), head = d.head || d.getElementsByTagName('head')[0]; element.type = 'text/javascript'; element.async = true; element.src = 'https://lib.wtg-ads.com/lib.single.wtg.min.js'; head.appendChild(element); w.w2gLoaded++; } if (w.w2g !== undefined && typeof w.w2g.single === 'function') { w.w2g.single(domain, slot, parent); } })();` e.appendChild(d) d.appendChild(s) } } } else { let r = pbjs.getBidResponsesForAdUnitCode('/21689298071/caranddriver.gr/sidebar1').bids if (r.length === 0) { let e = document.querySelectorAll('div[data-adunitname="sidebar1"]') e = e[e.length - 1] if (e.childElementCount == 0) { let d = document.createElement('div') d.setAttribute('id', 'w2g-slot4-cnt') let s = document.createElement('script') s.innerHTML = `(function () { var domain = 'www.caranddriver.gr'; var slot = 'w2g-slot4'; if (window.self !== window.parent) { var d = top.document, w = window.parent; var parent = this.frameElement; parent.style.display = "none"; } else { var d = document, w = window, parent = null; if (typeof d.currentScript !== 'undefined') { parent = d.currentScript; if (parent == null) { parent = document.getElementById(slot + '-cnt'); } } else { parent = d.body.lastElementChild; } } d.addEventListener('wtgLoaded', function (e) { if (typeof w.w2g.single === 'function') { w.w2g.single(domain, slot, parent); } }, false); if (w.w2gLoaded === undefined) { w.w2gLoaded = 0; } if (w.w2gLoaded < 1 && w.w2g === undefined) { var element = d.createElement('script'), head = d.head || d.getElementsByTagName('head')[0]; element.type = 'text/javascript'; element.async = true; element.src = 'https://lib.wtg-ads.com/lib.single.wtg.min.js'; head.appendChild(element); w.w2gLoaded++; } if (w.w2g !== undefined && typeof w.w2g.single === 'function') { w.w2g.single(domain, slot, parent); } })();` e.appendChild(d) d.appendChild(s) } } r = pbjs.getBidResponsesForAdUnitCode('/21689298071/caranddriver.gr/sidebar2').bids if (r.length === 0) { let e = document.querySelectorAll('div[data-adunitname="sidebar2"]') e = e[e.length - 1] if (e.childElementCount == 0) { let d = document.createElement('div') d.setAttribute('id', 'w2g-slot5-cnt') let s = document.createElement('script') s.innerHTML = `(function () { var domain = 'www.caranddriver.gr'; var slot = 'w2g-slot5'; if (window.self !== window.parent) { var d = top.document, w = window.parent; var parent = this.frameElement; parent.style.display = "none"; } else { var d = document, w = window, parent = null; if (typeof d.currentScript !== 'undefined') { parent = d.currentScript; if (parent == null) { parent = document.getElementById(slot + '-cnt'); } } else { parent = d.body.lastElementChild; } } d.addEventListener('wtgLoaded', function (e) { if (typeof w.w2g.single === 'function') { w.w2g.single(domain, slot, parent); } }, false); if (w.w2gLoaded === undefined) { w.w2gLoaded = 0; } if (w.w2gLoaded < 1 && w.w2g === undefined) { var element = d.createElement('script'), head = d.head || d.getElementsByTagName('head')[0]; element.type = 'text/javascript'; element.async = true; element.src = 'https://lib.wtg-ads.com/lib.single.wtg.min.js'; head.appendChild(element); w.w2gLoaded++; } if (w.w2g !== undefined && typeof w.w2g.single === 'function') { w.w2g.single(domain, slot, parent); } })();` e.appendChild(d) d.appendChild(s) } } r = pbjs.getBidResponsesForAdUnitCode('/21689298071/caranddriver.gr/sidebar3').bids if (r.length === 0) { let e = document.querySelectorAll('div[data-adunitname="sidebar3"]') e = e[e.length - 1] if (e.childElementCount == 0) { let d = document.createElement('div') d.setAttribute('id', 'w2g-slot6-cnt') let s = document.createElement('script') s.innerHTML = `(function () { var domain = 'www.caranddriver.gr'; var slot = 'w2g-slot6'; if (window.self !== window.parent) { var d = top.document, w = window.parent; var parent = this.frameElement; parent.style.display = "none"; } else { var d = document, w = window, parent = null; if (typeof d.currentScript !== 'undefined') { parent = d.currentScript; if (parent == null) { parent = document.getElementById(slot + '-cnt'); } } else { parent = d.body.lastElementChild; } } d.addEventListener('wtgLoaded', function (e) { if (typeof w.w2g.single === 'function') { w.w2g.single(domain, slot, parent); } }, false); if (w.w2gLoaded === undefined) { w.w2gLoaded = 0; } if (w.w2gLoaded < 1 && w.w2g === undefined) { var element = d.createElement('script'), head = d.head || d.getElementsByTagName('head')[0]; element.type = 'text/javascript'; element.async = true; element.src = 'https://lib.wtg-ads.com/lib.single.wtg.min.js'; head.appendChild(element); w.w2gLoaded++; } if (w.w2g !== undefined && typeof w.w2g.single === 'function') { w.w2g.single(domain, slot, parent); } })();` e.appendChild(d) d.appendChild(s) } } } let bids = pbjs.getAllPrebidWinningBids() if (bids.length > 0) { thetahb.auctionId = bids[bids.length - 1].auctionId } for (let i = 0; i < bids.length; i++) { let bid = bids[i] if (bid.auctionId !== thetahb.auctionId) { continue } if (bid.adUnitCode === "thetainreadcontainer") { if (!thetahb.reloaded) { pbjs.renderAd(thetahb.container, bid['adId']); } //Render Adform // if (typeof thetahb.container !== 'undefined') { // thetahb.container.remove() // } // if (thetahb.reloaded) { // thetahb.parent = document.getElementsByClassName('infiniteArticleWrapper') // thetahb.parent = thetahb.parent[thetahb.parent.length - 1] // thetahb.ins = thetahb.parent.querySelectorAll(thetahb.selector) // } else { // thetahb.ins = document.querySelectorAll(thetahb.selector) // } // thetahb.ins = thetahb.ins.length === 1 || thetahb.selector.includes('#') ? thetahb.ins[0] : thetahb.ins[1] // thetahb.container = document.createElement('div') // thetahb.container.setAttribute('id', 'thetainreadcontainer') // thetahb.container.setAttribute('style', 'position: relative') // thetahb.ins.append(thetahb.container) // let t = document.createElement('iframe') // t.setAttribute('frameBorder', 0) // t.setAttribute('id', 'thetahbvideo') // thetahb.container.append(t) // let iframeDoc = t.contentWindow.document; // pbjs.renderAd(iframeDoc, bid['adId']); // if (bid.bidderCode === "adform") { // thetahb.prepare(thetahb.container); // thetahb.onesticky(thetahb.container); // } } else if (bid.adUnitCode === 'theta_sticky') { if (typeof thetahb.sticky !== 'undefined') { thetahb.sticky_close.click() } thetahb.sticky_close = document.createElement('img') thetahb.sticky_close.src = 'https://assets.thetamedia.gr/inread/close-theta@2x.png' thetahb.sticky_close.setAttribute('width', '16') thetahb.sticky_close.setAttribute('style', `position: sticky; left:16px; bottom: ${bid.height}px; z-index:22;`) thetahb._theta_body.append(thetahb.sticky_close) thetahb.sticky_close.setAttribute("onclick", "thetahb.sticky.remove();this.remove();"); thetahb.sticky = document.createElement('iframe') thetahb.sticky.setAttribute('style', `position: sticky; bottom: 0px; z-index:21; width:320px;`) thetahb.sticky.setAttribute('id', bid.adUnitCode) thetahb.sticky.setAttribute('frameBorder', 0) thetahb.sticky.setAttribute('scrolling', "no") thetahb._theta_body.append(thetahb.sticky) let iframeDoc = thetahb.sticky.contentWindow.document; pbjs.renderAd(iframeDoc, bid['adId']); } } } setTimeout(function () { thetahb.initAdserver(); }, thetahb.FAILSAFE_TIMEOUT); // } thetahb.reload = async function () { pbjs.initAdserverSet = false; thetahb.reloaded = true await pbjs.requestBids({ timeout: thetahb.PREBID_TIMEOUT, bidsBackHandler: thetahb.initAdserver }); } document.addEventListener("scroll", async (event) => { let l = document.getElementsByClassName('billboard_inArt').length if (l > 0 && l !== thetahb.wrapperLength) { thetahb.wrapperLength = l googletag.destroySlots(thetahb.slots) thetahb.slots = [] thetahb.buildSlots() await thetahb.reload() } }); })()