Skip to content

Commit

Permalink
Put ad to appropriate container
Browse files Browse the repository at this point in the history
  • Loading branch information
pyxarez committed Mar 14, 2018
1 parent 518ec29 commit b8e2164
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ads/capirs.js
Expand Up @@ -26,11 +26,13 @@ export function capirs(global, data) {

if (data['customCss']) {
const style = window.document.createElement('style');

if (style.styleSheet) {
style.styleSheet.cssText = data['customCss'];
} else {
style.appendChild(document.createTextNode(data['customCss']));
}

global.document.body.appendChild(style);
}

Expand All @@ -39,7 +41,9 @@ export function capirs(global, data) {
init: () => {
const block = global.document.createElement('div');
block.id = 'x-' + Math.round(Math.random() * 1e8).toString(36);
document.body.appendChild(block);

const container = document.getElementById('c') || document.body;
container.appendChild(block);

global['Adf']['banner']['ssp'](block.id, data['params'], {
'begun-auto-pad': data['begunAutoPad'],
Expand All @@ -50,10 +54,12 @@ export function capirs(global, data) {
block: {
draw: feed => {
const banner = feed['banners']['graph'][0];

window.context.renderStart({
width: banner['width'],
height: banner['height'],
});

const reportId = 'capirs-' + banner['banner_id'];
window.context.reportRenderedEntityIdentifier(reportId);
},
Expand Down

0 comments on commit b8e2164

Please sign in to comment.