From 6db95c296512d46d7bbd59c414e5839d388f0dd2 Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Wed, 8 Jul 2026 22:38:41 +0200 Subject: [PATCH] fix: walk up to .top-ad/.google-auto-placed ancestor before removing ad slot Removing only the inner ins.adsbygoogle left the outer .container.top-ad wrapper (with pb-4 padding) in the layout, preserving the blank gap. Now walk up via closest() to the nearest ad-slot container class before removal so the whole slot including padding collapses. --- crates/archivr-core/src/downloader/singlefile.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/archivr-core/src/downloader/singlefile.rs b/crates/archivr-core/src/downloader/singlefile.rs index 98f8422..dabc667 100644 --- a/crates/archivr-core/src/downloader/singlefile.rs +++ b/crates/archivr-core/src/downloader/singlefile.rs @@ -305,11 +305,11 @@ fn save_with( iframe[src*=\"googlesyndication\"],\ iframe[src*=\"doubleclick\"]'\ ).forEach(function(el){\ - var p=el.parentElement;\ - el.remove();\ - /* collapse parent if it's now empty and was ad-only */\ - if(p&&!p.textContent.trim()&&p.children.length===0)\ - p.style.display='none';\ + /* Walk up to the nearest ad-slot container so padding/margin \ + * on the wrapper (e.g. .top-ad, .google-auto-placed) collapses \ + * too, not just the inner ins/iframe element. */\ + var slot=el.closest('.top-ad,.google-auto-placed,.ad-slot,.ad-container');\ + (slot||el).remove();\ });", ); }