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