console.log("THETA VIDEO"); let caranddriverinread = {} caranddriverinread.pel = document.createElement('script') caranddriverinread.pel.src = 'https://securepubads.g.doubleclick.net/tag/js/gpt.js' caranddriverinread.pel.async = true window.parent.document.head.appendChild(caranddriverinread.pel) caranddriverinread.pel = document.createElement('script') caranddriverinread.pel.src = `https://static.thetamedia.gr/prebid.js?t=1721893585` caranddriverinread.pel.async = true window.parent.document.head.appendChild(caranddriverinread.pel) caranddriverinread._theta_head = window.parent.document.head || window.parent.document.getElementsByTagName('head')[0] caranddriverinread.scrolling = false caranddriverinread.carousel = JSON.parse('{"mediaTypes":{"banner":{"sizes":[[300,250],[300,600]]}},"bidders":[{"bidder":"adform","params":{"mid":1947253}}]}'.replaceAll('"', '"')) caranddriverinread.conf = JSON.parse('{"mediaTypes":{"video":{"context":"outstream","plcmt":1,"mimes":["video/mp4"]}},"bidders":[{"bidder":"adform","params":{"mid":1148881}}]}'.replaceAll('"', '"')) caranddriverinread.sellerId = "10" caranddriverinread.selector = "p" caranddriverinread.selectorIndex = "1" caranddriverinread.selectorIndexMobile = "1" caranddriverinread.margin = "0" caranddriverinread.passbackuri = "https://thetamarketplace.com/passback/caranddriverinread" caranddriverinread.hituri = "https://thetamarketplace.com/hit/caranddriverinread/host/false" caranddriverinread.brandsafetyuri = "https://thetamarketplace.com/brandsafety/dealID" caranddriverinread.dmp = false caranddriverinread.containerHeight = 0 caranddriverinread.method = "SimpleSticky" caranddriverinread.thisscript = document.currentScript caranddriverinread.PREBID_TIMEOUT = 1500; caranddriverinread.FAILSAFE_TIMEOUT = 3000; caranddriverinread.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 } caranddriverinread.sindex = caranddriverinread.selectorIndex if(caranddriverinread.mobileCheck()) { caranddriverinread.sindex = caranddriverinread.selectorIndexMobile } caranddriverinread.ins = window.parent.document.querySelectorAll(caranddriverinread.selector) caranddriverinread.ins = caranddriverinread.ins.length === 1 || caranddriverinread.selector.includes('#') ? caranddriverinread.ins[0] : caranddriverinread.ins[caranddriverinread.sindex] if(caranddriverinread.ins.tagName == 'P') { caranddriverinread.n = window.parent.document.createElement('div') caranddriverinread.n.setAttribute('id', 'caranddriverinread_inread') caranddriverinread.ins.parentNode.insertBefore(caranddriverinread.n, caranddriverinread.ins.nextSibling); caranddriverinread.ins = caranddriverinread.n caranddriverinread.ins.setAttribute('data-margin', true) } else { let t = document.createElement('div') t.setAttribute('id', `caranddriverinread_inread`) caranddriverinread.ins.append(t) caranddriverinread.ins = t; // caranddriverinread.ins.setAttribute('id', 'caranddriverinread_inread') } caranddriverinread.ins.setAttribute('style', 'text-align:center;') let bidders = caranddriverinread.conf.bidders if(caranddriverinread.mobileCheck()) { bidders.push(caranddriverinread.carousel.mobile) } else { bidders.push(caranddriverinread.carousel.desktop) } caranddriverinread.adUnits = [ { code: 'caranddriverinread_inread', mediaTypes: { banner: { sizes: [ [ 300, 250 ], [ 300, 600 ], [ 570, 427 ] ] }, video: { api: [1,2,3,4,5,6], context: 'outstream', linearity: 2, mimes: ['video/mp4'], playerSize: [[640, 480]], protocols: [1, 2, 3, 4, 5, 6, 7, 8], skip: 1, 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(() => { window.parent.Adform.renderOutstream(bid, ad) caranddriverinread.prepare(); if(caranddriverinread.method == 'StickyOne') { caranddriverinread.onesticky(); } else { caranddriverinread.finalizeInterval = setInterval(() => { caranddriverinread.finalize() }, 300) } }); } else { if (bid.vastUrl) { (async () => { ad = await fetch(resp).then(resp => resp.text()); if (typeof ad === 'string') { bid.renderer.push(() => { window.parent.Adform.renderOutstream(bid, ad) caranddriverinread.prepare(); if(caranddriverinread.method == 'StickyOne') { caranddriverinread.onesticky(); } else { caranddriverinread.finalizeInterval = setInterval(() => { caranddriverinread.finalize() }, 300) } }); } else { console.log('Invalid VAST'); } })(); } else { console.log('Invalid ad'); } } } } } }, bids: caranddriverinread.conf.bidders, }]; window.parent.pbjs = window.parent.pbjs || {}; window.parent.pbjs.que = window.parent.pbjs.que || []; caranddriverinread.onesticky = () => { if (caranddriverinread.ins !== null) { window.parent.addEventListener('scroll', () => { caranddriverinread.scrolling = true }) caranddriverinread.scrollInterval = setInterval(() => { caranddriverinread.finalize() if (caranddriverinread.scrolling) { caranddriverinread.scrolling = false caranddriverinread.oneScroll() } }, 300) } } caranddriverinread.oneScroll = function() { caranddriverinread.iframe = caranddriverinread.iframe || caranddriverinread.ins.getElementsByTagName('iframe')[0] if(typeof caranddriverinread.iframe !== "undefined") { let { rect, b, c, m, w, iw, ih, mw, mh } = caranddriverinread.preparePositioning() if (c != 0) { if(caranddriverinread.containerHeight === 0) { caranddriverinread.containerHeight = caranddriverinread.ins.clientHeight } let style = `position: fixed; left: 50%; top: 50%; width: 1px !important; height: 1px !important;` caranddriverinread.ins.setAttribute('style', style) caranddriverinread.iframe.setAttribute('style', style) if (caranddriverinread.stickyElement) caranddriverinread.stickyElement.el.setAttribute('style', style) if (caranddriverinread.keepclose === true) { caranddriverinread.close.style.display = 'block' } caranddriverinread.buffer.setAttribute('style', `height:${ caranddriverinread.containerHeight }px; margin:${ caranddriverinread.margin } `) } else { caranddriverinread.originalPosition(m) } } } caranddriverinread.isElementInViewport = function(rect) { if (rect.top + rect.height / 2 < 0) { return -1 } if (rect.top + rect.height / 2 > (window.parent.innerHeight || window.parent.document.documentElement.clientHeight)) { return 1 } return 0 } caranddriverinread.preparePositioning = function() { let rect = { bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0 } rect = caranddriverinread.sibling.getBoundingClientRect() let w = caranddriverinread.containerWidth * caranddriverinread.factor let b = { height: rect.height, width: rect.width, top: rect.top + caranddriverinread.ins.clientHeight / 2 + caranddriverinread.sibling.clientHeight, left: rect.left } let c = caranddriverinread.isElementInViewport(b) let m = caranddriverinread.mobileCheck() let iw = 270 //caranddriverinread.factor * caranddriverinread.containerWidth let ih = 202 //caranddriverinread.factor * caranddriverinread.containerHeight let mw = caranddriverinread.mobilefactor * caranddriverinread.containerWidth let mh = caranddriverinread.mobilefactor * caranddriverinread.containerHeight return { rect, b, c, m, w, iw, ih, mw, mh } } caranddriverinread.mobilePositioning = function(w, h) { if (caranddriverinread.keepclose === true) { caranddriverinread.close.style.display = 'block' } let style = `position: fixed; bottom:` + caranddriverinread.bottomOffset + `px; left: 50%; transform: translate(-50%, 0); width: ${w}px !important; height: ${h}px !important; z-index: 20;` if (caranddriverinread.mobilePosition !== undefined && caranddriverinread.mobilePosition === 'top') { style = `position: fixed; top: 50px; left: 50%; transform: translate(-50%, 0); width: ${w}px !important; height: ${h}px !important; z-index: 20;` } caranddriverinread.ins.setAttribute('style', style) caranddriverinread.iframe.setAttribute('style', style) caranddriverinread.ins.setAttribute( 'style', `position: fixed; top: 10%; left: 50%; transform: translate(-50%, -10%); width: ${w}px !important; height: ${h}px !important; z-index: 20;` ) caranddriverinread.iframe.setAttribute( 'style', `position: fixed; top: 10%; left: 50%; transform: translate(-50%, -10%); width: ${w}px !important; height: ${h}px !important; z-index: 20;` ) caranddriverinread.adsby.style.top = '55px' caranddriverinread.close.style.top = '55px' caranddriverinread.controlbar.style.bottom = '45px' } caranddriverinread.originalPosition = function(m) { if (caranddriverinread.keepclose === false) { caranddriverinread.close.style.display = 'none' } if (caranddriverinread.stickyElement) caranddriverinread.stickyElement.el.setAttribute( 'style', `clear: both; position:relative;` ) if (m) { caranddriverinread.ins.setAttribute('style', `position: relative; margin:${ caranddriverinread.margin }`) caranddriverinread.iframe.setAttribute('style', `position: relative;`) } else { caranddriverinread.ins.setAttribute( 'style', `clear: both; position: relative; margin: ${ caranddriverinread.margin };` ) caranddriverinread.iframe.setAttribute( 'style', `clear: both; position: relative;` ) } caranddriverinread.buffer.setAttribute('style', `height: 0;`) } caranddriverinread.prepare = function() { caranddriverinread.sibling = document.createElement('div') caranddriverinread.sibling.setAttribute('id', 'thetasib') caranddriverinread.ins.parentNode.insertBefore(caranddriverinread.sibling, caranddriverinread.ins) caranddriverinread.buffer = document.createElement('div') caranddriverinread.buffer.setAttribute('id', 'thetabuffer') caranddriverinread.ins.parentNode.insertBefore(caranddriverinread.buffer, caranddriverinread.ins) } caranddriverinread.finalize = () => { caranddriverinread.iframe = caranddriverinread.ins.querySelectorAll('iframe')[0] if(typeof caranddriverinread.iframe !== "undefined" && caranddriverinread.iframe.contentWindow !== null && caranddriverinread.iframe.contentWindow.document.getElementById('thetaadsby') === null && caranddriverinread.iframe.contentWindow.document.getElementById('banner') !== null) { caranddriverinread.adsby = document.createElement('div') caranddriverinread.adsby.setAttribute('id', 'thetaadsby') caranddriverinread.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 (caranddriverinread.mobileCheck()) { img.setAttribute('width', '60') } else { img.setAttribute('width', '125') } caranddriverinread.adsby.appendChild(img) caranddriverinread.iframe.contentWindow.document.getElementById('banner').appendChild(caranddriverinread.adsby) caranddriverinread.player = caranddriverinread.iframe.contentWindow.document.getElementById('vast-wrapper') caranddriverinread.player.style.backgroundColor = 'transparent' img = document.createElement('img') img.src = 'https://assets.thetamedia.gr/inread/close-theta@2x.png' img.setAttribute('width', '16') caranddriverinread.close = caranddriverinread.iframe.contentWindow.document.getElementById('vast-skip') if (caranddriverinread.keepclose === false) { caranddriverinread.close.style.display = 'none' } let e = caranddriverinread.iframe.contentWindow.document.querySelector('.vjs-progress-control') e = caranddriverinread.iframe.contentWindow.document.querySelector('.vjs-play-control') caranddriverinread.clearIntervals = window.parent.setInterval(function() { if(caranddriverinread.ins.childElementCount < 3) { caranddriverinread.ins.remove() window.parent.clearInterval(caranddriverinread.clearIntervals); window.parent.clearInterval(caranddriverinread.scrollInterval); window.parent.clearInterval(caranddriverinread.finalizeInterval); } }, 500); } } caranddriverinread.passback = function() { thetapbins = caranddriverinread.thisscript.parentElement if(thetapbins.parentElement.tagName === 'HTML') { thetapbins = thetapbins.parentElement.querySelector('body') } var script_tag = document.createElement('script') script_tag.src = caranddriverinread.passbackuri script_tag.async = true script_tag.defer = true caranddriverinread.ins.appendChild(script_tag) } caranddriverinread.pbjsconfig = { enableTIDs: true, currency: { adServerCurrency: 'EUR' }, ortb2: { site: { ext: { data: { hostname: location.hostname } }, publisher: { domain: location.hostname } } }, schain: { validation: "strict", config: { ver: "1.0", complete: 1, nodes: [ { asi: "thetamarketplace.com", sid: caranddriverinread.sellerId, hp:1 } ] } }, userSync: { iframeEnabled: true, filterSettings: { iframe: { bidders: '*', filter: 'include', }, }, userIds: [], auctionDelay: 1000, syncDelay: 3000, syncEnabled: true } } caranddriverinread.initAdserver = function() { if (caranddriverinread.initAdserverSet) return; caranddriverinread.initAdserverSet = true; let adServerTargeting = window.parent.pbjs.getAdserverTargetingForAdUnitCode('caranddriverinread_inread'); if (adServerTargeting && adServerTargeting['hb_adid']) { const text = window.parent.document.body.innerText var formdata = new FormData(); formdata.append('t', text) var requestOptions = { method: 'POST', body: formdata, redirect: 'follow' }; fetch(caranddriverinread.brandsafetyuri.replace("dealID", adServerTargeting["hb_deal"]), requestOptions) .then((response) => { return response.json() }) .then((data) => { if(data.res === false) { if(caranddriverinread.ins.hasAttribute('data-margin') === true) { caranddriverinread.ins.style.margin = caranddriverinread.margin } if(adServerTargeting["hb_format"] === 'banner') { var iframe = document.createElement('iframe'); iframe.setAttribute('id', 'thetacarousel') iframe.setAttribute('frameBorder', '0') // iframe.setAttribute('style', 'width:unset !important;') caranddriverinread.ins.appendChild(iframe) var iframeDoc = iframe.contentWindow.document; window.parent.pbjs.renderAd(iframeDoc, adServerTargeting['hb_adid']); } else { window.parent.pbjs.renderAd(caranddriverinread.ins, adServerTargeting['hb_adid']); } } else { caranddriverinread.passback() } }) .catch((error) => console.error(error)); } else { caranddriverinread.passback() } } if(location.hostname === 'localhost' || location.hostname === '127.0.0.1') { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); if(urlParams.get('passback') === 'true') { caranddriverinread.passback() } else { window.parent.pbjs.que.push(function() { window.parent.pbjs.addAdUnits(caranddriverinread.adUnits); window.parent.pbjs.setConfig(caranddriverinread.pbjsconfig) window.parent.pbjs.requestBids({ timeout: caranddriverinread.PREBID_TIMEOUT, bidsBackHandler: caranddriverinread.initAdserver }); }); } } else { fetch(caranddriverinread.hituri.replace('/host', '/' + window.location.host), { method: 'GET', }) caranddriverinread.pbjsconfig.consentManagement = { gdpr: { cmpApi: 'iab', timeout: 1000, actionTimeout: 10000, defaultGdprScope: true } } window.parent.__tcfapi('addEventListener', 2, function (tcData, success) { if (success) { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); if(urlParams.get('passback') === 'true') { caranddriverinread.passback() return } if (tcData.eventStatus == 'useractioncomplete' || tcData.eventStatus == 'tcloaded') { if(tcData.purpose.consents[1] && tcData.purpose.consents[3] && tcData.purpose.consents[5] && tcData.purpose.consents[7] && tcData.purpose.consents[8] && tcData.purpose.consents[9] && tcData.purpose.consents[10]) { if (tcData.vendor.consents[131]) { caranddriverinread.pbjsconfig.userSync.userIds.push({ name: "id5Id", params: { partner: 1653, externalModuleUrl: 'https://cdn.id5-sync.com/api/1.0/id5PrebidModule.js', }, storage: { type: "html5", name: "id5id", expires: 90, refreshInSeconds: 8 * 3600 } }) } if (tcData.vendor.consents[95]) { caranddriverinread.pbjsconfig.userSync.userIds.push({ name: "lotamePanoramaId", params: { clientId: 17773 } }) } caranddriverinread.pbjsconfig.userSync.userIds.push({ name: "sharedId", storage: { name: "_sharedID", type: "html5", expires: 30 } }) caranddriverinread.pbjsconfig.userSync.userIds.push({ name: "criteo" }) } window.parent.pbjs.que.push(function() { window.parent.pbjs.addAdUnits(caranddriverinread.adUnits); window.parent.pbjs.setConfig(caranddriverinread.pbjsconfig) window.parent.pbjs.requestBids({ timeout: caranddriverinread.PREBID_TIMEOUT, bidsBackHandler: caranddriverinread.initAdserver }); }); setTimeout(function() { caranddriverinread.initAdserver(); }, caranddriverinread.FAILSAFE_TIMEOUT); if(caranddriverinread.dmp === true) { const stringToUuid = (str) => { str = str.replace('-', ''); return 'xxxxxxxx-xxxx-4xxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/g, function (c, p) { return str[p % str.length]; }); } navigator.mediaDevices .enumerateDevices() .then((devices) => { const uuid = JSON.parse(decodeURIComponent(localStorage.id5id)).universal_uid const source = window.location.host const atype = 1 const text = window.parent.document.body.innerText var formdata = new FormData(); formdata.append('t', text) var requestOptions = { method: 'POST', body: formdata, redirect: 'follow' }; fetch('https://contextual.thetamarketplace.com/', requestOptions) .then(response => response.json()) .then(data => { const key = data.key let ns = document.createElement('noscript') let img = document.createElement('img') img.src = `//dmp.adform.net/dmp/profile/?pid=12269&sg=${key}&eid_${source}_${atype}=${uuid}` img.setAttribute('style', 'display:none !important') ns.appendChild(img) caranddriverinread._theta_head.appendChild(ns) }) }) .catch((err) => { console.log(`${err.name}: ${err.message}`); }); } } } }); }