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:
parent
5a9c65551a
commit
6db95c2965
1 changed files with 5 additions and 5 deletions
|
|
@ -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();\
|
||||
});",
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue