Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
data-ad-slot attribute is a placeholder for brave ads
Browse files Browse the repository at this point in the history
As long as the size of a div with that data attribute is set, we will
consider it for ad insertion.

We dont have coverage for tests for this yet but I added this to track
that:
#133

Parent task:
https://app.asana.com/0/41575558488236/76420706546970

Auditors: @bridiver
  • Loading branch information
bbondy committed Jan 10, 2016
1 parent 471ad77 commit 6463a12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion app/content/webviewPreload.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ ipc.on(messages.SET_AD_DIV_CANDIDATES, function (e, adDivCandidates, placeholder
// Common selectors which could be on every page
var commonSelectors = [
'[id^="google_ads_iframe_"][id$="__container__"]',
'[id^="ad-slot-banner-"]'
'[id^="ad-slot-banner-"]',
'[data-ad-slot]'
]
commonSelectors.forEach(commonSelector => {
var nodes = document.querySelectorAll(commonSelector)
Expand Down
10 changes: 5 additions & 5 deletions js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ class Frame extends ImmutableComponent {

insertAds (currentLocation) {
let host = new window.URL(currentLocation).hostname.replace('www.', '')
let adDivCandidates = adInfo[host]
if (adDivCandidates) {
this.webview.send(messages.SET_AD_DIV_CANDIDATES,
adDivCandidates, Config.vault.replacementUrl)
}
let adDivCandidates = adInfo[host] || []
// Call this even when there are no matches because we have some logic
// to replace common divs.
this.webview.send(messages.SET_AD_DIV_CANDIDATES,
adDivCandidates, Config.vault.replacementUrl)
}

goBack () {
Expand Down

0 comments on commit 6463a12

Please sign in to comment.