From 544808cdda957d5fe48226ceb110de5dc427bf19 Mon Sep 17 00:00:00 2001 From: yydfh33 <61532836+yydfh33@users.noreply.github.com> Date: Fri, 11 Sep 2026 23:53:40 +1200 Subject: [PATCH] Add Danbooru rule for post listing pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a narrower rule scoped to /posts listing pages. Does not replace the existing Danbooru rule by skofkyo, which also covers e621 and other Danbooru pages. Handles two site-specific quirks: inserted posts stay hidden because the blacklist builds a one-time snapshot at init, and thumbnails fall back to the 360x360 variant because carries the URL in src rather than srcset. Both need a delayed retry — the blacklist instance is not reachable at insertion time. --- Pagetual/pagetualRules.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Pagetual/pagetualRules.json b/Pagetual/pagetualRules.json index 2b81ff29282..c08b16a6b80 100644 --- a/Pagetual/pagetualRules.json +++ b/Pagetual/pagetualRules.json @@ -2772,6 +2772,19 @@ "pageElement": "#image-container", "nextLink": "#content > section.reader-bar > div.reader-pagination > a.next" }, +{ + "name": "Danbooru", + "author": "yydfh33", + "example": "https://danbooru.donmai.us/posts", + "url": "^https://danbooru\\.donmai\\.us/posts(\\?|$)", + "action": 0, + "pageElement": "div.posts-container>article", + "insert": "div.posts-container", + "insertPos": 2, + "nextLink": ["a[rel=next]", "a.paginator-next"], + "fitWidth": false, + "pageAction": "const targets = []; eles.forEach(el => { if (el.matches('article.post-preview')) targets.push(el); else targets.push(...el.querySelectorAll('article.post-preview')); }); let tries = 0; const run = () => { tries++; try { const seed = document.querySelector('article.post-preview.blacklist-initialized'); const bl = seed && seed.post && seed.post.blacklist; if (bl && window.Danbooru && Danbooru.Blacklist && Danbooru.Blacklist.Post) { targets.forEach(p => { if (!p.classList.contains('blacklist-initialized')) bl.posts.push(new Danbooru.Blacklist.Post(p, bl)); }); bl.apply(); const ref = seed.querySelector('picture>source'); const refAttr = ref && (ref.getAttribute('srcset') ? 'srcset' : (ref.getAttribute('src') ? 'src' : null)); targets.forEach(p => { const s = p.querySelector('picture>source'); const i = p.querySelector('img'); if (!s || !i) return; const u = s.getAttribute('src') || s.getAttribute('srcset'); if (!u) return; if (refAttr === 'srcset') { s.setAttribute('srcset', u); } else { const orig = i.getAttribute('src'); i.onerror = () => { i.onerror = null; i.src = orig; }; i.src = u; } }); return; } } catch(e) { console.warn('[pagetual danbooru]', e); return; } if (tries < 20) setTimeout(run, 150); else console.warn('[pagetual danbooru] blacklist instance not found'); }; run();" +}, { "name": "Danbooru", "author": "skofkyo",