"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "docs/src/modules/components/Ad.js" between
material-ui-4.12.1.tar.gz and material-ui-4.12.2.tar.gz

About: Material-UI is a simple and customizable component library to build faster, beautiful, and more accessible React applications.

Ad.js  (material-ui-4.12.1):Ad.js  (material-ui-4.12.2)
import React from 'react'; import React from 'react';
import clsx from 'clsx'; import clsx from 'clsx';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { withStyles } from '@material-ui/core/styles'; import { withStyles } from '@material-ui/core/styles';
import Typography from '@material-ui/core/Typography'; import Typography from '@material-ui/core/Typography';
import Paper from '@material-ui/core/Paper'; import Paper from '@material-ui/core/Paper';
import AdCarbon from 'docs/src/modules/components/AdCarbon'; import AdCarbon from 'docs/src/modules/components/AdCarbon';
import AdReadthedocs from 'docs/src/modules/components/AdReadthedocs';
import AdInHouse from 'docs/src/modules/components/AdInHouse'; import AdInHouse from 'docs/src/modules/components/AdInHouse';
import { AdContext, adShape } from 'docs/src/modules/components/AdManager'; import { AdContext, adShape } from 'docs/src/modules/components/AdManager';
const styles = (theme) => ({ const styles = (theme) => ({
root: { root: {
position: 'relative', position: 'relative',
display: 'block', display: 'block',
}, },
'placement-body-image': { 'placement-body-image': {
margin: theme.spacing(4, 1, 3), margin: theme.spacing(4, 1, 3),
skipping to change at line 118 skipping to change at line 117
'<b>For Figma</b>. A large UI kit with over 600 handcrafted Material-UI co mponents 🎨.', '<b>For Figma</b>. A large UI kit with over 600 handcrafted Material-UI co mponents 🎨.',
}, },
]; ];
function Ad(props) { function Ad(props) {
const { classes } = props; const { classes } = props;
const [adblock, setAdblock] = React.useState(null); const [adblock, setAdblock] = React.useState(null);
const [carbonOut, setCarbonOut] = React.useState(null); const [carbonOut, setCarbonOut] = React.useState(null);
const { current: randomSplit } = React.useRef(Math.random());
const { current: randomAdblock } = React.useRef(Math.random()); const { current: randomAdblock } = React.useRef(Math.random());
const { current: randomInHouse } = React.useRef(Math.random()); const { current: randomInHouse } = React.useRef(Math.random());
let children; let children;
let label; let label;
// Hide the content to google bot. // Hide the content to google bot.
if (/Googlebot/.test(navigator.userAgent) || disable) { if (/Googlebot/.test(navigator.userAgent) || disable) {
children = <span />; children = <span />;
} else if (adblock) { } else if (adblock) {
if (randomAdblock < 0.2) { if (randomAdblock < 0.2) {
children = <PleaseDisableAdblock className={classes.paper} />; children = <PleaseDisableAdblock className={classes.paper} />;
label = 'in-house-adblock'; label = 'in-house-adblock';
} else { } else {
children = <AdInHouse ad={inHouseAds[Math.floor(inHouseAds.length * random InHouse)]} />; children = <AdInHouse ad={inHouseAds[Math.floor(inHouseAds.length * random InHouse)]} />;
label = 'in-house'; label = 'in-house';
} }
} else if (carbonOut) { } else if (carbonOut) {
children = <AdInHouse ad={inHouseAds[Math.floor(inHouseAds.length * randomIn House)]} />; children = <AdInHouse ad={inHouseAds[Math.floor(inHouseAds.length * randomIn House)]} />;
label = 'in-house-carbon'; label = 'in-house-carbon';
} else if (randomSplit < 0.9) { } else {
children = <AdCarbon />; children = <AdCarbon />;
label = 'carbon'; label = 'carbon';
} else {
children = <AdReadthedocs />;
label = 'readthedocs';
} }
const ad = React.useContext(AdContext); const ad = React.useContext(AdContext);
const eventLabel = label ? `${label}-${ad.portal.placement}-${adShape}` : null ; const eventLabel = label ? `${label}-${ad.portal.placement}-${adShape}` : null ;
const timerAdblock = React.useRef(); const timerAdblock = React.useRef();
const checkAdblock = React.useCallback( const checkAdblock = React.useCallback(
(attempt = 1) => { (attempt = 1) => {
if ( if (
 End of changes. 4 change blocks. 
6 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)