(global, data)
| 5 | * @param {!Object} data |
| 6 | */ |
| 7 | export function conative(global, data) { |
| 8 | validateData(data, ['domain', 'adslot', 'height'], ['preview']); |
| 9 | |
| 10 | data.domain = data.domain || null; |
| 11 | data.adslot = data.adslot || null; |
| 12 | data.preview = data.preview || null; |
| 13 | |
| 14 | window.dmConativeData = window.dmConativeData || {}; |
| 15 | window.dmConativeData.domain = window.dmConativeData.domain || data.domain; |
| 16 | window.dmConativeData.adslot = window.dmConativeData.adslot || data.adslot; |
| 17 | window.dmConativeData.preview = window.dmConativeData.preview || data.preview; |
| 18 | window.dmConativeData.visibility = window.dmConativeData.visibility || 0; |
| 19 | |
| 20 | window.context.observeIntersection(function (changes) { |
| 21 | /** @type {!Array} */ (changes).forEach(function (c) { |
| 22 | window.dmConativeData.visibility = parseInt( |
| 23 | (c.intersectionRect.height / c.boundingClientRect.height) * 100, |
| 24 | 10 |
| 25 | ); |
| 26 | }); |
| 27 | }); |
| 28 | |
| 29 | if (data.domain) { |
| 30 | writeScript( |
| 31 | global, |
| 32 | '//s3-eu-west-1.amazonaws.com/ccc-adscript/serve/domain/' + |
| 33 | data.domain + |
| 34 | '/config.js' |
| 35 | ); |
| 36 | } |
| 37 | } |
nothing calls this directly
no test coverage detected