1
Fork 0
mirror of https://github.com/thegeneralist01/archivr synced 2026-07-21 18:55:36 +02:00

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.
This commit is contained in:
TheGeneralist 2026-07-08 22:38:41 +02:00
parent 5a9c65551a
commit 6db95c2965
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4

View file

@ -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();\
});",
);
}