Fix lint and formatting (#394)

This commit is contained in:
infinite-persistence 2021-11-30 16:53:23 -08:00 committed by GitHub
parent fcb70c8e8b
commit 0aff130ea4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 17 deletions

View file

@ -118,22 +118,23 @@ function HomePage(props: Props) {
const elemBottom = rect.bottom;
// Only completely visible elements return true:
const isVisible = (elemTop >= 0) && (elemBottom <= window.innerHeight);
const isVisible = elemTop >= 0 && elemBottom <= window.innerHeight;
return isVisible;
}
//
React.useEffect(() => {
if (authenticated || !SHOW_ADS) {
return;
}
(async function() {
(async function () {
// test if adblock is enabled
let adBlockEnabled = false;
const googleAdUrl = 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js';
try {
await fetch(new Request(googleAdUrl)).catch(_ => { adBlockEnabled = true });
await fetch(new Request(googleAdUrl)).catch((_) => {
adBlockEnabled = true;
});
} catch (e) {
adBlockEnabled = true;
} finally {
@ -171,7 +172,8 @@ function HomePage(props: Props) {
clonedCard.querySelector('.claim__menu-button').remove();
// $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
clonedCard.querySelector('.claim-tile__info').remove();
@ -192,7 +194,9 @@ function HomePage(props: Props) {
clonedCard.querySelector('.claim-tile__header').firstChild.removeAttribute('aria-label');
// $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
document.getElementsByClassName('homepageAdContainer')[0].style.display = 'block';
@ -224,8 +228,6 @@ function HomePage(props: Props) {
timeoutCount += 100;
if (timeoutCount < 500) {
window.setTimeout(checkForAniview, 100);
} else {
}
} else {
clonedCard.style.display = 'block';

View file

@ -7,13 +7,14 @@ import I18nMessage from 'component/i18nMessage';
import Button from 'component/button';
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 IOS_ADS_URL = 'https://cdn.vidcrunch.com/integrations/618bb4d28aac298191eec411/Lbry_Odysee.com_Mobile_Floating_DFP_Rev70_1611.js';
const IOS_ADS_URL =
'https://cdn.vidcrunch.com/integrations/618bb4d28aac298191eec411/Lbry_Odysee.com_Mobile_Floating_DFP_Rev70_1611.js';
const IOS_ADS_TAG = 'vidcrunchJS199212779';
const HOMEPAGE_ADS_URL = 'https://cdn.vidcrunch.com/integrations/618bb4d28aac298191eec411/Lbry_Odysee.com_Responsive_Floating_300x169_DFP_Rev70_1211.js';
const HOMEPAGE_ADS_URL =
'https://cdn.vidcrunch.com/integrations/618bb4d28aac298191eec411/Lbry_Odysee.com_Responsive_Floating_300x169_DFP_Rev70_1211.js';
const HOMEPAGE_ADS_TAG = 'vidcrunchJS330442776';
const IS_IOS =
@ -94,7 +95,7 @@ function Ads(props: Props) {
// ad shown in the related videos area
const videoAd = (
<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
className={classnames('ads__claim-text', {
'ads__claim-text--small': small,
@ -108,8 +109,8 @@ function Ads(props: Props) {
// homepage ad in a card
const homepageCardAd = (
<div className="homepageAdContainer media__thumb" style={{display: 'none'}}>
<div id={tagNameToUse} className="homepageAdDiv media__thumb" style={{display: 'none'}} />
<div className="homepageAdContainer media__thumb" style={{ display: 'none' }}>
<div id={tagNameToUse} className="homepageAdDiv media__thumb" style={{ display: 'none' }} />
</div>
);