(global, data)
| 5 | * @param {!Object} data |
| 6 | */ |
| 7 | export function adunity(global, data) { |
| 8 | const doc = global.document; |
| 9 | |
| 10 | validateData( |
| 11 | data, |
| 12 | ['auAccount', 'auSite'], |
| 13 | [ |
| 14 | 'auSection', |
| 15 | 'auZone', |
| 16 | 'auDemo', |
| 17 | 'auIsdemo', |
| 18 | 'auAd', |
| 19 | 'auOrder', |
| 20 | 'auSegment', |
| 21 | 'auOptions', |
| 22 | 'auSources', |
| 23 | 'auAds', |
| 24 | 'auTriggerFn', |
| 25 | 'auTriggerVal', |
| 26 | 'auCallbackVal', |
| 27 | 'auCallbackFn', |
| 28 | 'auPassbackFn', |
| 29 | 'auPassbackVal', |
| 30 | 'auClick', |
| 31 | 'auDual', |
| 32 | 'auImpression', |
| 33 | 'auVideo', |
| 34 | ] |
| 35 | ); |
| 36 | |
| 37 | //prepare tag structure |
| 38 | const tag = doc.createElement('div'); |
| 39 | tag.classList.add('au-tag'); |
| 40 | tag.setAttribute('data-au-width', data['width']); |
| 41 | tag.setAttribute('data-au-height', data['height']); |
| 42 | |
| 43 | if (data != null) { |
| 44 | for (const key in data) { |
| 45 | //skip not valid attributes |
| 46 | if (!hasOwnProperty.call(data, key)) { |
| 47 | continue; |
| 48 | } |
| 49 | |
| 50 | //skip if attribute is type or ampSlotIndex |
| 51 | if (key.startsWith('type') || key.startsWith('ampSlotIndex')) { |
| 52 | continue; |
| 53 | } |
| 54 | |
| 55 | if (key.startsWith('au')) { |
| 56 | if (key == 'auVideo') { |
| 57 | tag.setAttribute('class', 'au-video'); |
| 58 | } else { |
| 59 | const auKey = key.substring(2).toLowerCase(); |
| 60 | tag.setAttribute('data-au-' + auKey, data[key]); |
| 61 | } |
| 62 | } |
| 63 | } |
| 64 | } |
nothing calls this directly
no test coverage detected