Fix lint and formatting (#394)
This commit is contained in:
parent
fcb70c8e8b
commit
0aff130ea4
2 changed files with 20 additions and 17 deletions
|
@ -3,7 +3,7 @@ import * as ICONS from 'constants/icons';
|
||||||
import * as PAGES from 'constants/pages';
|
import * as PAGES from 'constants/pages';
|
||||||
import { SHOW_ADS, SITE_NAME, SIMPLE_SITE, ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
import { SHOW_ADS, SITE_NAME, SIMPLE_SITE, ENABLE_NO_SOURCE_CLAIMS } from 'config';
|
||||||
import Ads from 'web/component/ads';
|
import Ads from 'web/component/ads';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Page from 'component/page';
|
import Page from 'component/page';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import ClaimTilesDiscover from 'component/claimTilesDiscover';
|
import ClaimTilesDiscover from 'component/claimTilesDiscover';
|
||||||
|
@ -118,22 +118,23 @@ function HomePage(props: Props) {
|
||||||
const elemBottom = rect.bottom;
|
const elemBottom = rect.bottom;
|
||||||
|
|
||||||
// Only completely visible elements return true:
|
// Only completely visible elements return true:
|
||||||
const isVisible = (elemTop >= 0) && (elemBottom <= window.innerHeight);
|
const isVisible = elemTop >= 0 && elemBottom <= window.innerHeight;
|
||||||
return isVisible;
|
return isVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (authenticated || !SHOW_ADS) {
|
if (authenticated || !SHOW_ADS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
(async function() {
|
(async function () {
|
||||||
// test if adblock is enabled
|
// test if adblock is enabled
|
||||||
let adBlockEnabled = false;
|
let adBlockEnabled = false;
|
||||||
const googleAdUrl = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
|
const googleAdUrl = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
|
||||||
try {
|
try {
|
||||||
await fetch(new Request(googleAdUrl)).catch(_ => { adBlockEnabled = true });
|
await fetch(new Request(googleAdUrl)).catch((_) => {
|
||||||
|
adBlockEnabled = true;
|
||||||
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
adBlockEnabled = true;
|
adBlockEnabled = true;
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -171,7 +172,8 @@ function HomePage(props: Props) {
|
||||||
clonedCard.querySelector('.claim__menu-button').remove();
|
clonedCard.querySelector('.claim__menu-button').remove();
|
||||||
|
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
clonedCard.querySelector('.truncated-text').innerHTML = 'Hate these? Login to Odysee for an ad free experience';
|
clonedCard.querySelector('.truncated-text').innerHTML =
|
||||||
|
'Hate these? Login to Odysee for an ad free experience';
|
||||||
|
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
clonedCard.querySelector('.claim-tile__info').remove();
|
clonedCard.querySelector('.claim-tile__info').remove();
|
||||||
|
@ -192,7 +194,9 @@ function HomePage(props: Props) {
|
||||||
clonedCard.querySelector('.claim-tile__header').firstChild.removeAttribute('aria-label');
|
clonedCard.querySelector('.claim-tile__header').firstChild.removeAttribute('aria-label');
|
||||||
|
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
clonedCard.querySelector('.media__thumb').replaceWith(document.getElementsByClassName('homepageAdContainer')[0]);
|
clonedCard
|
||||||
|
.querySelector('.media__thumb')
|
||||||
|
.replaceWith(document.getElementsByClassName('homepageAdContainer')[0]);
|
||||||
|
|
||||||
// show the homepage ad which is not displayed at first
|
// show the homepage ad which is not displayed at first
|
||||||
document.getElementsByClassName('homepageAdContainer')[0].style.display = 'block';
|
document.getElementsByClassName('homepageAdContainer')[0].style.display = 'block';
|
||||||
|
@ -224,8 +228,6 @@ function HomePage(props: Props) {
|
||||||
timeoutCount += 100;
|
timeoutCount += 100;
|
||||||
if (timeoutCount < 500) {
|
if (timeoutCount < 500) {
|
||||||
window.setTimeout(checkForAniview, 100);
|
window.setTimeout(checkForAniview, 100);
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
clonedCard.style.display = 'block';
|
clonedCard.style.display = 'block';
|
||||||
|
|
|
@ -7,13 +7,14 @@ import I18nMessage from 'component/i18nMessage';
|
||||||
import Button from 'component/button';
|
import Button from 'component/button';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
const ADS_URL = 'https://cdn.vidcrunch.com/integrations/618bb4d28aac298191eec411/Lbry_Odysee.com_Responsive_Floating_DFP_Rev70_1011.js';
|
const ADS_URL =
|
||||||
|
'https://cdn.vidcrunch.com/integrations/618bb4d28aac298191eec411/Lbry_Odysee.com_Responsive_Floating_DFP_Rev70_1011.js';
|
||||||
const ADS_TAG = 'vidcrunchJS537102317';
|
const ADS_TAG = 'vidcrunchJS537102317';
|
||||||
|
const IOS_ADS_URL =
|
||||||
const IOS_ADS_URL = 'https://cdn.vidcrunch.com/integrations/618bb4d28aac298191eec411/Lbry_Odysee.com_Mobile_Floating_DFP_Rev70_1611.js';
|
'https://cdn.vidcrunch.com/integrations/618bb4d28aac298191eec411/Lbry_Odysee.com_Mobile_Floating_DFP_Rev70_1611.js';
|
||||||
const IOS_ADS_TAG = 'vidcrunchJS199212779';
|
const IOS_ADS_TAG = 'vidcrunchJS199212779';
|
||||||
|
const HOMEPAGE_ADS_URL =
|
||||||
const HOMEPAGE_ADS_URL = 'https://cdn.vidcrunch.com/integrations/618bb4d28aac298191eec411/Lbry_Odysee.com_Responsive_Floating_300x169_DFP_Rev70_1211.js';
|
'https://cdn.vidcrunch.com/integrations/618bb4d28aac298191eec411/Lbry_Odysee.com_Responsive_Floating_300x169_DFP_Rev70_1211.js';
|
||||||
const HOMEPAGE_ADS_TAG = 'vidcrunchJS330442776';
|
const HOMEPAGE_ADS_TAG = 'vidcrunchJS330442776';
|
||||||
|
|
||||||
const IS_IOS =
|
const IS_IOS =
|
||||||
|
@ -94,7 +95,7 @@ function Ads(props: Props) {
|
||||||
// ad shown in the related videos area
|
// ad shown in the related videos area
|
||||||
const videoAd = (
|
const videoAd = (
|
||||||
<div className="ads__claim-item">
|
<div className="ads__claim-item">
|
||||||
<div id={tagNameToUse} className="ads__injected-video" style={{display: 'none'}} />
|
<div id={tagNameToUse} className="ads__injected-video" style={{ display: 'none' }} />
|
||||||
<div
|
<div
|
||||||
className={classnames('ads__claim-text', {
|
className={classnames('ads__claim-text', {
|
||||||
'ads__claim-text--small': small,
|
'ads__claim-text--small': small,
|
||||||
|
@ -108,8 +109,8 @@ function Ads(props: Props) {
|
||||||
|
|
||||||
// homepage ad in a card
|
// homepage ad in a card
|
||||||
const homepageCardAd = (
|
const homepageCardAd = (
|
||||||
<div className="homepageAdContainer media__thumb" style={{display: 'none'}}>
|
<div className="homepageAdContainer media__thumb" style={{ display: 'none' }}>
|
||||||
<div id={tagNameToUse} className="homepageAdDiv media__thumb" style={{display: 'none'}} />
|
<div id={tagNameToUse} className="homepageAdDiv media__thumb" style={{ display: 'none' }} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue