This repository has been archived by the owner on Feb 13, 2021. It is now read-only.
forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request prebid#75 in AOLP_ADS_JS/prebid.js from release/1.…
…14.0 to master * commit 'c008f3f531ae3409f4a16bf03470d84e82aead0e': (35 commits) Add adapters in aolPartnersIds.json. Add changelog entry. Prebid 0.19.0 Release check truthiness of adUnitCode (prebid#990) fixed exception when refreshing individual Ad Units and bidder responds slowly (prebid#989) Stub pixel drop to prevent network request in test (prebid#988) Updating Komoona adapter to support future Prebid requirements (prebid#974) Use stable version of Chrome (prebid#984) Revert to running browser tests in Travis (prebid#983) Fix issue with appnexusAst sending `user` object in the wrong place. (prebid#980) Integrate Browserstack tests into Travis CI build (prebid#839) Add StickyAdsTV Bidder adapter (prebid#916) Stronger xdomain checks (prebid#971) added matomy as an alias for appnexus (prebid#850) Added 152Media Appnexus Alias (prebid#952) OpenX Adapter: Handles fallback ads correctly as a no fill (prebid#39) (prebid#963) Use package dependencies for ES6 Array shims (prebid#962) Make x-domain safe frame example work out of the box (prebid#955) added usersync for adkernel adapter (prebid#951) Rubicon adapter: add a floor variable (prebid#964) ...
- Loading branch information
Showing
47 changed files
with
3,222 additions
and
643 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<script> | ||
// this script can be returned by an ad server delivering a cross domain iframe, into which the | ||
// creative will be rendered, e.g. DFP delivering a SafeFrame | ||
|
||
var urlParser = document.createElement('a'); | ||
urlParser.href = '%%PATTERN:url%%'; | ||
var publisherDomain = urlParser.protocol + '//' + urlParser.hostname; | ||
var adServerDomain = 'https://tpc.googlesyndication.com'; | ||
|
||
function renderAd(ev) { | ||
var key = ev.message ? 'message' : 'data'; | ||
var adObject = {}; | ||
try { | ||
adObject = JSON.parse(ev[key]); | ||
} catch (e) { | ||
return; | ||
} | ||
|
||
var origin = ev.origin || ev.originalEvent.origin; | ||
if (adObject.message && adObject.message === 'Prebid Response' && | ||
publisherDomain === origin && | ||
adObject.adId === '%%PATTERN:hb_adid%%' && | ||
(adObject.ad || adObject.adUrl)) { | ||
var body = window.document.body; | ||
var ad = adObject.ad; | ||
var url = adObject.adUrl; | ||
var width = adObject.width; | ||
var height = adObject.height; | ||
|
||
if (adObject.mediaType === 'video') { | ||
console.log('Error trying to write ad.'); | ||
} else | ||
|
||
if (ad) { | ||
var frame = document.createElement('iframe'); | ||
frame.setAttribute('FRAMEBORDER', 0); | ||
frame.setAttribute('SCROLLING', 'no'); | ||
frame.setAttribute('MARGINHEIGHT', 0); | ||
frame.setAttribute('MARGINWIDTH', 0); | ||
frame.setAttribute('TOPMARGIN', 0); | ||
frame.setAttribute('LEFTMARGIN', 0); | ||
frame.setAttribute('ALLOWTRANSPARENCY', 'true'); | ||
frame.setAttribute('width', width); | ||
frame.setAttribute('height', height); | ||
body.appendChild(frame); | ||
frame.contentDocument.open(); | ||
frame.contentDocument.write(ad); | ||
frame.contentDocument.close(); | ||
} else if (url) { | ||
body.insertAdjacentHTML('beforeend', '<IFRAME SRC="' + url + '" FRAMEBORDER="0" SCROLLING="no" MARGINHEIGHT="0" MARGINWIDTH="0" TOPMARGIN="0" LEFTMARGIN="0" ALLOWTRANSPARENCY="true" WIDTH="' + width + '" HEIGHT="' + height + '"></IFRAME>'); | ||
} else { | ||
console.log('Error trying to write ad. No ad for bid response id: ' + id); | ||
} | ||
} | ||
} | ||
|
||
function requestAdFromPrebid() { | ||
var message = JSON.stringify({ | ||
message: 'Prebid Request', | ||
adId: '%%PATTERN:hb_adid%%', | ||
adServerDomain: adServerDomain | ||
}); | ||
window.parent.postMessage(message, publisherDomain); | ||
} | ||
|
||
function listenAdFromPrebid() { | ||
window.addEventListener('message', renderAd, false); | ||
} | ||
|
||
listenAdFromPrebid(); | ||
requestAdFromPrebid(); | ||
</script> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.