function adElementBlocked()

in src/lib/detect-ad-blocker.ts [12:33]


function adElementBlocked(ad: HTMLElement): boolean {
	if (
		ad.offsetParent === null ||
		ad.offsetHeight === 0 ||
		ad.offsetLeft === 0 ||
		ad.offsetTop === 0 ||
		ad.offsetWidth === 0 ||
		ad.clientHeight === 0 ||
		ad.clientWidth === 0
	) {
		return true;
	}
	const adStyles = window.getComputedStyle(ad);

	if (adStyles.getPropertyValue('display') === 'none') return true;
	if (adStyles.getPropertyValue('visibility') === 'hidden') return true;

	const mozBindingProp = adStyles.getPropertyValue('-moz-binding');
	if (mozBindingProp.includes('about:')) return true;

	return false;
}