console.log("THETA VIDEO"); let androinread = {} androinread.pel = document.createElement('script') androinread.pel.src = 'https://securepubads.g.doubleclick.net/tag/js/gpt.js' androinread.pel.async = true window.parent.document.head.appendChild(androinread.pel) androinread.pel = document.createElement('script') androinread.pel.src = `https://static.thetamedia.gr/prebid.js?t=1721893585` androinread.pel.async = true window.parent.document.head.appendChild(androinread.pel) androinread._theta_head = window.parent.document.head || window.parent.document.getElementsByTagName('head')[0] androinread.scrolling = false androinread.carousel = JSON.parse('{"desktop":{},"mobile":{}}'.replaceAll('"', '"')) androinread.conf = JSON.parse('{"code":"google_ads_iframe_/21893394101/In_Read_0__container__","mediaTypes":{"video":{"context":"outstream","plcmt":1,"mimes":["video/mp4"]}},"bidders":[{"bidder":"adform","params":{"mid":982153}},{"bidder":"adform","params":{"mid":1348910}}]}'.replaceAll('"', '"')) androinread.sellerId = "3" androinread.selector = ".in-read-ad" androinread.selectorIndex = "1" androinread.selectorIndexMobile = "1" androinread.margin = "0" androinread.passbackuri = "https://thetamarketplace.com/passback/androinread" androinread.hituri = "https://thetamarketplace.com/hit/androinread/host/false" androinread.brandsafetyuri = "https://thetamarketplace.com/brandsafety/dealID" androinread.dmp = false androinread.containerHeight = 0 androinread.method = "StickyOne" androinread.thisscript = document.currentScript androinread.unset_carousel_width = "false" androinread.unset_carousel_width = androinread.unset_carousel_width == "true" androinread.PREBID_TIMEOUT = 1500; androinread.FAILSAFE_TIMEOUT = 3000; androinread.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 } androinread.sindex = androinread.selectorIndex if(androinread.mobileCheck()) { androinread.sindex = androinread.selectorIndexMobile } androinread.ins = window.parent.document.querySelectorAll(androinread.selector) androinread.ins = androinread.ins.length === 1 || androinread.selector.includes('#') ? androinread.ins[0] : androinread.ins[androinread.sindex] if(location.hostname == 'cypress.tester' && (!androinread.ins || typeof(androinread.ins) == 'undefined')) { console.info('Theta Video - Placement selector not found') androinread.ins = window.parent.document.querySelector('header') } if(androinread.ins.tagName == 'P') { androinread.n = window.parent.document.createElement('div') androinread.n.setAttribute('id', 'androinread_inread') androinread.ins.parentNode.insertBefore(androinread.n, androinread.ins.nextSibling); androinread.ins = androinread.n androinread.ins.setAttribute('data-margin', true) } else { let t = document.createElement('div') t.setAttribute('id', `androinread_inread`) androinread.ins.append(t) androinread.ins = t; // androinread.ins.setAttribute('id', 'androinread_inread') } androinread.ins.setAttribute('style', 'text-align:center;') let bidders = androinread.conf.bidders if(androinread.mobileCheck()) { bidders.push(androinread.carousel.mobile) } else { bidders.push(androinread.carousel.desktop) } androinread.adUnits = [ { code: 'androinread_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) androinread.prepare(); if(androinread.method == 'StickyOne') { androinread.onesticky(); } else { androinread.finalizeInterval = setInterval(() => { androinread.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) androinread.prepare(); if(androinread.method == 'StickyOne') { androinread.onesticky(); } else { androinread.finalizeInterval = setInterval(() => { androinread.finalize() }, 300) } }); } else { console.log('Invalid VAST'); } })(); } else { console.log('Invalid ad'); } } } } } }, bids: androinread.conf.bidders, }]; window.parent.pbjs = window.parent.pbjs || {}; window.parent.pbjs.que = window.parent.pbjs.que || []; androinread.onesticky = () => { if (androinread.ins !== null) { window.parent.addEventListener('scroll', () => { androinread.scrolling = true }) androinread.scrollInterval = setInterval(() => { androinread.finalize() if (androinread.scrolling) { androinread.scrolling = false androinread.oneScroll() } }, 300) } } androinread.oneScroll = function() { androinread.iframe = androinread.iframe || androinread.ins.getElementsByTagName('iframe')[0] if(typeof androinread.iframe !== "undefined") { let { rect, b, c, m, w, iw, ih, mw, mh } = androinread.preparePositioning() if (c != 0) { if(androinread.containerHeight === 0) { androinread.containerHeight = androinread.ins.clientHeight } let style = `position: fixed; left: 50%; top: 50%; width: 1px !important; height: 1px !important;` androinread.ins.setAttribute('style', style) androinread.iframe.setAttribute('style', style) if (androinread.stickyElement) androinread.stickyElement.el.setAttribute('style', style) if (androinread.keepclose === true) { androinread.close.style.display = 'block' } androinread.buffer.setAttribute('style', `height:${ androinread.containerHeight }px; margin:${ androinread.margin } `) } else { androinread.originalPosition(m) } } } androinread.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 } androinread.preparePositioning = function() { let rect = { bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0 } rect = androinread.sibling.getBoundingClientRect() let w = androinread.containerWidth * androinread.factor let b = { height: rect.height, width: rect.width, top: rect.top + androinread.ins.clientHeight / 2 + androinread.sibling.clientHeight, left: rect.left } let c = androinread.isElementInViewport(b) let m = androinread.mobileCheck() let iw = 270 //androinread.factor * androinread.containerWidth let ih = 202 //androinread.factor * androinread.containerHeight let mw = androinread.mobilefactor * androinread.containerWidth let mh = androinread.mobilefactor * androinread.containerHeight return { rect, b, c, m, w, iw, ih, mw, mh } } androinread.mobilePositioning = function(w, h) { if (androinread.keepclose === true) { androinread.close.style.display = 'block' } let style = `position: fixed; bottom:` + androinread.bottomOffset + `px; left: 50%; transform: translate(-50%, 0); width: ${w}px !important; height: ${h}px !important; z-index: 20;` if (androinread.mobilePosition !== undefined && androinread.mobilePosition === 'top') { style = `position: fixed; top: 50px; left: 50%; transform: translate(-50%, 0); width: ${w}px !important; height: ${h}px !important; z-index: 20;` } androinread.ins.setAttribute('style', style) androinread.iframe.setAttribute('style', style) androinread.ins.setAttribute( 'style', `position: fixed; top: 10%; left: 50%; transform: translate(-50%, -10%); width: ${w}px !important; height: ${h}px !important; z-index: 20;` ) androinread.iframe.setAttribute( 'style', `position: fixed; top: 10%; left: 50%; transform: translate(-50%, -10%); width: ${w}px !important; height: ${h}px !important; z-index: 20;` ) androinread.adsby.style.top = '55px' androinread.close.style.top = '55px' androinread.controlbar.style.bottom = '45px' } androinread.originalPosition = function(m) { if (androinread.keepclose === false) { androinread.close.style.display = 'none' } if (androinread.stickyElement) androinread.stickyElement.el.setAttribute( 'style', `clear: both; position:relative;` ) if (m) { androinread.ins.setAttribute('style', `position: relative; margin:${ androinread.margin }`) androinread.iframe.setAttribute('style', `position: relative;`) } else { androinread.ins.setAttribute( 'style', `clear: both; position: relative; margin: ${ androinread.margin };` ) androinread.iframe.setAttribute( 'style', `clear: both; position: relative;` ) } androinread.buffer.setAttribute('style', `height: 0;`) } androinread.prepare = function() { androinread.sibling = document.createElement('div') androinread.sibling.setAttribute('id', 'thetasib') androinread.ins.parentNode.insertBefore(androinread.sibling, androinread.ins) androinread.buffer = document.createElement('div') androinread.buffer.setAttribute('id', 'thetabuffer') androinread.ins.parentNode.insertBefore(androinread.buffer, androinread.ins) } androinread.finalize = () => { androinread.iframe = androinread.ins.querySelectorAll('iframe')[0] if(typeof androinread.iframe !== "undefined" && androinread.iframe.contentWindow !== null && androinread.iframe.contentWindow.document.getElementById('thetaadsby') === null && androinread.iframe.contentWindow.document.getElementById('banner') !== null) { androinread.adsby = document.createElement('div') androinread.adsby.setAttribute('id', 'thetaadsby') androinread.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 (androinread.mobileCheck()) { img.setAttribute('width', '60') } else { img.setAttribute('width', '125') } androinread.adsby.appendChild(img) androinread.iframe.contentWindow.document.getElementById('banner').appendChild(androinread.adsby) androinread.player = androinread.iframe.contentWindow.document.getElementById('vast-wrapper') androinread.player.style.backgroundColor = 'transparent' img = document.createElement('img') img.src = 'https://assets.thetamedia.gr/inread/close-theta@2x.png' img.setAttribute('width', '16') androinread.close = androinread.iframe.contentWindow.document.getElementById('vast-skip') if (androinread.keepclose === false) { androinread.close.style.display = 'none' } // select control bar and play button. let e = androinread.iframe.contentWindow.document.querySelector('.vjs-progress-control') e = androinread.iframe.contentWindow.document.querySelector('.vjs-play-control') androinread.clearIntervals = window.parent.setInterval(function() { if(androinread.ins.childElementCount < 3) { androinread.ins.remove() window.parent.clearInterval(androinread.clearIntervals); window.parent.clearInterval(androinread.scrollInterval); window.parent.clearInterval(androinread.finalizeInterval); } }, 500); } } androinread.passback = function() { thetapbins = androinread.thisscript.parentElement if(thetapbins.parentElement.tagName === 'HTML') { thetapbins = thetapbins.parentElement.querySelector('body') } var script_tag = document.createElement('script') script_tag.src = androinread.passbackuri script_tag.async = true script_tag.defer = true androinread.ins.appendChild(script_tag) } androinread.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: androinread.sellerId, hp:1 } ] } }, userSync: { aliasSyncEnabled: true, syncsPerBidder: 3, iframeEnabled: true, filterSettings: { iframe: { bidders: '*', filter: 'include', }, }, userIds: [], auctionDelay: 1000, syncDelay: 3000, syncEnabled: true } } androinread.initAdserver = function() { if (androinread.initAdserverSet) return; androinread.initAdserverSet = true; let adServerTargeting = window.parent.pbjs.getAdserverTargetingForAdUnitCode('androinread_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(androinread.brandsafetyuri.replace("dealID", adServerTargeting["hb_deal"]), requestOptions) .then((response) => { return response.json() }) .then((data) => { if(data.res === false) { if(androinread.ins.hasAttribute('data-margin') === true) { androinread.ins.style.margin = androinread.margin } if(adServerTargeting["hb_format"] === 'banner') { var iframe = document.createElement('iframe'); iframe.setAttribute('id', 'thetacarousel') iframe.setAttribute('frameBorder', '0') if(androinread.unset_carousel_width == true){ iframe.setAttribute('style', 'width:unset !important;') } androinread.ins.appendChild(iframe) var iframeDoc = iframe.contentWindow.document; window.parent.pbjs.renderAd(iframeDoc, adServerTargeting['hb_adid']); } else { window.parent.pbjs.renderAd(androinread.ins, adServerTargeting['hb_adid']); } } else { androinread.passback() } }) .catch((error) => console.error(error)); } else { androinread.passback() } } if(location.hostname === 'localhost' || location.hostname === '127.0.0.1' || location.hostname == 'cypress.tester' || location.hostname == '192.168.84.32') { const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); if(urlParams.get('passback') === 'true') { androinread.passback() } else { window.parent.pbjs.que.push(function() { window.parent.pbjs.addAdUnits(androinread.adUnits); window.parent.pbjs.setConfig(androinread.pbjsconfig) window.parent.pbjs.requestBids({ timeout: androinread.PREBID_TIMEOUT, bidsBackHandler: androinread.initAdserver }); }); } } else { fetch(androinread.hituri.replace('/host', '/' + window.location.host), { method: 'GET', }) androinread.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') { androinread.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]) { androinread.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]) { androinread.pbjsconfig.userSync.userIds.push({ name: "lotamePanoramaId", params: { clientId: 17773 } }) } androinread.pbjsconfig.userSync.userIds.push({ name: "sharedId", storage: { name: "_sharedID", type: "html5", expires: 30 } }) androinread.pbjsconfig.userSync.userIds.push({ name: "criteo" }) } window.parent.pbjs.que.push(function() { window.parent.pbjs.addAdUnits(androinread.adUnits); window.parent.pbjs.setConfig(androinread.pbjsconfig) window.parent.pbjs.requestBids({ timeout: androinread.PREBID_TIMEOUT, bidsBackHandler: androinread.initAdserver }); }); setTimeout(function() { androinread.initAdserver(); }, androinread.FAILSAFE_TIMEOUT); if(androinread.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) androinread._theta_head.appendChild(ns) }) }) .catch((err) => { console.log(`${err.name}: ${err.message}`); }); } } } }); }