Add Danbooru rule for post listing pages - #1248
Open
yydfh33 wants to merge 1 commit into
Open
Conversation
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 <source> carries the URL in src rather than srcset. Both need a delayed retry — the blacklist instance is not reachable at insertion time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a narrower rule for Danbooru's post listing pages. It does not
replace the existing
Danboorurule by @skofkyo — that one also coverse621.net and Danbooru's other pages (comments, tags, pools), which this rule
deliberately leaves alone.
Problem
The existing rule uses
"pageElement": "article", which is not scoped to thepost grid. In practice auto-detection falls back to iframe mode, loading the
entire next page — sidebar included — into a narrow iframe appended at the
bottom. Danbooru's grid is responsive, so the reduced width renders thumbnails
noticeably smaller, and click-to-enlarge does not work across the iframe
boundary. Disabling iframe mode alone produces duplicate posts.
Two Danbooru-specific quirks
1. Posts start hidden.
Blacklist#initialize()buildsthis.postsas aone-time snapshot of the posts present at load, so elements inserted later are
never evaluated and keep
visibility: hidden— they occupy layout space butstay invisible.
Danbooru.Post.initialize_all()does not re-scan them.The rule recovers the live
Blacklistinstance viasomeInitializedPost.post.blacklist, registers each inserted post withnew Danbooru.Blacklist.Post(el, bl), then callsbl.apply(). This runs thesite's own rules, so user blacklists stay in effect on inserted pages.
2. Thumbnail variant. Previews are served as
<picture><source type="image/webp" src="...720x720....webp">— notesrc,not
srcset. Danbooru's own script rewrites that attribute after load;inserted posts miss it and fall back to the
<img>360x360 JPEG. The rulereads which attribute an already-initialized
<source>ended up using andmirrors that on inserted posts, rather than hardcoding either behaviour.
Timing matters for both. The
Blacklistinstance is reachable through anAlpine-reactive property that is not ready at insertion time, so
pageActionretries every 150 ms (up to 20 times) until it resolves. Running immediately
silently does nothing — no error, no effect.
Tested
Chrome + Tampermonkey, logged in, 2026-09. Listing pages: no iframe, no
duplicates, all inserted posts visible, blacklist applied, thumbnails at the
same variant as page 1, no broken images. Post detail pages (
/posts/<id>)unaffected — still handled by the existing rule. Not tested while logged out.
Question
When two rules match the same URL, which takes precedence? I placed this entry
before the existing one assuming first match wins.
I verified the behaviour I care about — listing pages use the new rule and
detail pages still work — but I did not test the ordering itself (e.g. whether
moving the entry after the existing one changes anything), so the placement is
an assumption rather than a verified requirement.