To Top
// Memaksa semua gambar di postingan menggunakan loading='lazy'
document.querySelectorAll('.post-body img').forEach(img => {
img.setAttribute('loading', 'lazy');
// Mengubah resolusi gambar Blogger ke format WebP otomatis
let src = img.getAttribute('src');
if (src.includes('s1600') || src.includes('s640')) {
img.setAttribute('src', src.replace(/\/s(1600|640)\//, '/s1200-rw/'));
}
});
let timeout = null;
window.addEventListener('scroll', () => {
clearTimeout(timeout);
timeout = setTimeout(() => {
// Jalankan tracker hanya setelah user berhenti scroll selama 200ms
trackUserInterest();
}, 200);
}, {passive: true});