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

fix(core): tighten Freedium download-button cleanup

Replace the broad previousElementSibling/HEADER removal with a
precise selector that matches only the .flex.justify-end wrapper
containing the 'Download article' button. The old heuristic was
removing article headers on NYT/WaPo captures.
This commit is contained in:
TheGeneralist 2026-07-19 20:23:52 +02:00
parent 64f94c6eda
commit 00e3b966ee
Signed by: thegeneralist01
SSH key fingerprint: SHA256:pp9qddbCNmVNoSjevdvQvM5z0DHN7LTa8qBMbcMq/R4

View file

@ -540,12 +540,12 @@ fn save_with(
document.querySelectorAll('[data-nosnippet]').forEach(function(el){\ document.querySelectorAll('[data-nosnippet]').forEach(function(el){\
if(!el.firstElementChild&&!el.textContent.trim())el.remove();\ if(!el.firstElementChild&&!el.textContent.trim())el.remove();\
});\ });\
document.querySelectorAll('[data-slot=\"dropdown-menu-trigger\"]').forEach(function(btn){\ document.querySelectorAll('section>.flex.justify-end>button[data-slot=\"dropdown-menu-trigger\"][type=\"button\"].flex.items-center>span').forEach(function(span){\
if(!/download/i.test(btn.textContent||''))return;\ if(span.textContent.trim()!=='Download article')return;\
var sec=btn.closest('section');if(!sec)return;\ var wrap=span.closest('.flex.justify-end');\
var prev=sec.previousElementSibling;\ var sec=wrap.closest('section');\
if(prev&&prev.tagName==='HEADER')prev.remove();\ wrap.remove();\
sec.remove();\ if(sec&&sec.children.length===0)sec.remove();\
});", });",
); );
} }