display ad in related sidebar for video view page

Co-authored-by: Thomas Zarebczan <thomas.zarebczan@gmail.com>
This commit is contained in:
mayeaux 2021-11-11 23:15:50 +01:00 committed by GitHub
parent ef0329e03b
commit d047a748b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,7 +8,8 @@ import Button from 'component/button';
import classnames from 'classnames'; import classnames from 'classnames';
// $FlowFixMe // $FlowFixMe
const ADS_URL = '//assets.revcontent.com/master/delivery.js'; const ADS_URL =
'https://cdn.vidcrunch.com/integrations/618bb4d28aac298191eec411/Lbry_Odysee.com_Responsive_Floating_DFP_Rev70_1011.js';
const IS_MOBILE = typeof window.orientation !== 'undefined'; const IS_MOBILE = typeof window.orientation !== 'undefined';
type Props = { type Props = {
@ -32,11 +33,12 @@ function Ads(props: Props) {
try { try {
const d = document; const d = document;
const s = 'script'; const s = 'script';
const n = 'playbuzz-stream'; const n = 'vidcrunch';
let fjs = d.getElementsByTagName(s)[0]; let fjs = d.getElementsByTagName(s)[0];
script = d.createElement(s); script = d.createElement(s);
script.className = n; script.className = n;
script.src = 'https://stream.playbuzz.com/player/62d1eb10-e362-4873-99ed-c64a4052b43b'; script.src =
'https://cdn.vidcrunch.com/integrations/618bb4d28aac298191eec411/Lbry_Odysee.com_Responsive_Floating_DFP_Rev70_1011.js';
// $FlowFixMe // $FlowFixMe
fjs.parentNode.insertBefore(script, fjs); fjs.parentNode.insertBefore(script, fjs);
} catch (e) {} } catch (e) {}
@ -47,7 +49,7 @@ function Ads(props: Props) {
if (SHOW_ADS && !IS_MOBILE && type === 'sidebar') { if (SHOW_ADS && !IS_MOBILE && type === 'sidebar') {
const script = document.createElement('script'); const script = document.createElement('script');
script.src = ADS_URL; script.src = ADS_URL;
script.async = true; script.defer = true;
// $FlowFixMe // $FlowFixMe
document.body.appendChild(script); document.body.appendChild(script);
return () => { return () => {
@ -73,16 +75,15 @@ function Ads(props: Props) {
navigate={`/$/${PAGES.AUTH}?redirect=${pathname}`} navigate={`/$/${PAGES.AUTH}?redirect=${pathname}`}
/> />
), ),
download_the_app: <Button button="link" label={__('download the app')} href="https://lbry.com/get" />,
}} }}
> >
Hate these? %log_in_to_domain% or %download_the_app% for an ad free experience. Hate these? %log_in_to_domain% for an ad free experience.
</I18nMessage> </I18nMessage>
); );
const videoAd = ( const videoAd = (
<div className="ads__claim-item"> <div className="ads__claim-item">
<div id="62d1eb10-e362-4873-99ed-c64a4052b43b" className="ads__injected-video" /> <div id="vidcrunchJS537102317" 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,
@ -98,13 +99,7 @@ function Ads(props: Props) {
<div className="ads-wrapper"> <div className="ads-wrapper">
<p>Ads</p> <p>Ads</p>
<p>{adsSignInDriver}</p> <p>{adsSignInDriver}</p>
<div <div id="vidcrunchJS537102317" />
id="rc-widget-0a74cf"
data-rc-widget
data-widget-host="habitat"
data-endpoint="//trends.revcontent.com"
data-widget-id="117427"
/>
</div> </div>
); );