Skip to content

Commit

Permalink
as
Browse files Browse the repository at this point in the history
  • Loading branch information
imswarnil authored Feb 18, 2025
1 parent fe017e8 commit 8899446
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 25 deletions.
4 changes: 0 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ navigation_footer:
url: https://imswarnil.com



adsense:
data-ad-client: "ca-pub-1291242080282540"

# TIP: Try to keep the number of urls as low to reduce the performance cost
# If multiple fonts can be requested in a single url opt for this
fonts:
Expand Down
22 changes: 1 addition & 21 deletions assets/scripts/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,24 +52,4 @@
parent.appendChild(copyButtonWrapper);
}
});
});
// Lazy Load Adsense
document.addEventListener("DOMContentLoaded", function () {
const ads = document.querySelectorAll('.ads-container');
const observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const ad = entry.target.querySelector('.adsbygoogle');
if (ad && !ad.hasAttribute('data-loaded')) {
(adsbygoogle = window.adsbygoogle || []).push({});
ad.setAttribute('data-loaded', 'true');
observer.unobserve(entry.target);
}
}
});
});

ads.forEach(ad => {
observer.observe(ad);
});
});
});

0 comments on commit 8899446

Please sign in to comment.