From 13095cb97c3378bb8a0465c19983d6c907056baa Mon Sep 17 00:00:00 2001 From: florevallatmrf <32760132+florevallatmrf@users.noreply.github.com> Date: Thu, 9 Aug 2018 09:35:09 +0200 Subject: [PATCH] GLU-657/remove resize from securecreatives (#17) --- src/secureCreatives.js | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/src/secureCreatives.js b/src/secureCreatives.js index cd289cf657f..3878ffaa057 100644 --- a/src/secureCreatives.js +++ b/src/secureCreatives.js @@ -26,7 +26,7 @@ function receiveMessage(ev) { } if (data && data.adId) { - const adObject = find(auctionManager.getBidsReceived(), function (bid) { + const adObject = find(auctionManager.getBidsReceived(), function(bid) { return bid.adId === data.adId; }); @@ -57,14 +57,17 @@ function sendAdToCreative(adObject, remoteDomain, source) { if (adId) { resizeRemoteCreative(adObject); - source.postMessage(JSON.stringify({ - message: 'Prebid Response', - ad, - adUrl, - adId, - width, - height - }), remoteDomain); + source.postMessage( + JSON.stringify({ + message: 'Prebid Response', + ad, + adUrl, + adId, + width, + height + }), + remoteDomain + ); } } @@ -76,7 +79,16 @@ function resizeRemoteCreative({ adUnitCode, width, height }) { elementStyle.height = height; }); function getElementByAdUnit(elmType) { - return document.getElementById(find(window.googletag.pubads().getSlots().filter(isSlotMatchingAdUnitCode(adUnitCode)), slot => slot) - .getSlotElementId()).querySelector(elmType); + return document + .getElementById( + find( + window.googletag + .pubads() + .getSlots() + .filter(isSlotMatchingAdUnitCode(adUnitCode)), + slot => slot + ).getSlotElementId() + ) + .querySelector(elmType); } }