Skip to content

Commit

Permalink
GLU-657/remove resize from securecreatives (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
florevallatmrf committed Sep 6, 2018
1 parent 43fca45 commit 13095cb
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions src/secureCreatives.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down Expand Up @@ -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
);
}
}

Expand All @@ -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);
}
}

0 comments on commit 13095cb

Please sign in to comment.