Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Remove codefund Ads #21713

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 3 additions & 19 deletions docs/src/modules/components/Ad.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ function Ad(props) {

const [adblock, setAdblock] = React.useState(null);
const [carbonOut, setCarbonOut] = React.useState(null);
const [codeFundOut, setCodeFundOut] = React.useState(null);

let children;

Expand All @@ -133,7 +132,7 @@ function Ad(props) {
}

if (!children) {
if (carbonOut || codeFundOut) {
if (carbonOut) {
children = <AdInHouse ad={inHouseAds[Math.floor(inHouseAds.length * randomInHouse)]} />;
} else {
children = <AdCarbon />;
Expand All @@ -146,9 +145,7 @@ function Ad(props) {
if (children.type === AdCarbon) {
label = 'carbon';
} else if (children.type === AdInHouse) {
if (!adblock && codeFundOut) {
label = 'in-house-codefund';
} else if (!adblock && carbonOut) {
if (!adblock && carbonOut) {
label = 'in-house-carbon';
} else {
label = 'in-house';
Expand All @@ -170,7 +167,6 @@ function Ad(props) {
if (
document.querySelector('.cf-wrapper') ||
document.querySelector('#carbonads') ||
codeFundOut ||
carbonOut
) {
if (
Expand All @@ -195,7 +191,7 @@ function Ad(props) {
setAdblock(true);
}
},
[codeFundOut, carbonOut],
[carbonOut],
);

React.useEffect(() => {
Expand All @@ -209,18 +205,6 @@ function Ad(props) {
};
}, [checkAdblock]);

React.useEffect(() => {
const handler = (event) => {
if (event.detail.status === 'no-advertiser') {
setCodeFundOut(true);
}
};
window.addEventListener('codefund', handler);
return () => {
window.removeEventListener('codefund', handler);
};
}, []);

React.useEffect(() => {
// Avoid an exceed on the Google Analytics quotas.
if (Math.random() < 0.9) {
Expand Down