Booru Enhancer

Modular enhancement suite for Danbooru/Gelbooru/Moebooru-family booru sites — original-quality media, smart downloads, fullscreen viewer, tag tools, blacklist filtering, infinite scroll, reverse image search, and more.

A continuación se muestran las versiones de este script en las que se actualizó el código. Ver todas las versiones.

  • v1.2.7 27/8/2026

    ===============================================================================

    BOORU ENHANCER — v1.2.7

    CHANGELOG

    v1.2.7 — Interaction & Pagination Regression Fixes

    FIXED

    • Moved gallery click and pointer-event delegation from capture phase to bubble phase.

      • Prevents Booru Enhancer from intercepting thumbnail events before the site's own target-level handlers execute.
      • Preserves viewer interception for normal left-clicks.
      • Modifier-key and non-primary clicks remain untouched.
    • Hardened Gelbooru-family thumbnail wrapper detection.

      • Wrapper candidates are now validated before being accepted.
      • A candidate must contain exactly one thumbnail image.
      • The candidate's resolved post ID must match the thumbnail's post ID.
      • Prevents generic [data-id]/[data-post-id] ancestors from accidentally becoming the thumbnail wrapper.
      • Prevents multi-post containers from being styled or treated as a single thumbnail.
    • Removed the hard-coded Gelbooru "+42" pagination fallback.

      • No fabricated page size is assumed.
      • Pagination is extrapolated only after a real page-size delta has been observed from the site's pagination controls.
      • If no reliable pagination information exists, native pagination remains available instead of requesting a guessed URL.
    • Preserved and reinforced native pagination recovery.

      • Native pagination is hidden only after a successful infinite-scroll load.
      • Failed requests restore the native paginator.
      • Empty/overlapping pages do not automatically terminate a valid pagination chain.
    • Preserved pagination loop protection.

      • Previously visited page identities are never requested again.
      • Prevents A → B → A and repeated-page loops.

    IMPROVED

    • Gelbooru-family interaction handling is now considerably more conservative.
    • Thumbnail wrapper resolution is consistent between initial thumbnails and thumbnails inserted by infinite scroll.
    • Viewer/action handling operates from the explicitly enhanced thumbnail wrapper instead of broad ancestor matching.
    • Infinite-scroll initialization remains fully idempotent.
    • Dynamic gallery settings continue to apply immediately without requiring a page reload.
    • Runtime initialization remains resilient: failures in individual stages are isolated and logged instead of preventing the rest of the extension from starting.

    v1.2.6 — Gelbooru Interaction & Gallery Layout Fixes

    FIXED

    • Replaced broad thumbnail wrapper detection using generic article/span/div/a ancestors with adapter-specific getThumbWrapper() implementations.
    • Prevented the gallery container or unrelated ancestors from being tagged as thumbnail wrappers.
    • Fixed viewer, hover preview, favorite, download, and grid-layout failures caused by incorrect wrapper detection.
    • Restricted gallery click/hover delegation to explicitly enhanced .be-thumb-wrap elements.
    • Fixed hover-preview flickering caused by pointerout/pointerover transitions between children of the same thumbnail.
    • Fixed gallery thumbnailSize, gridDensity, and gridGap settings not affecting the actual grid layout.
    • Fixed compactMode having no visible CSS effect.
    • Fixed --be-thumbnail-size being calculated but not applied to the DOM.
    • Fixed dynamically inserted infinite-scroll thumbnails not receiving the same action-bar behavior as initial thumbnails.
    • Fixed viewer opening being unnecessarily dependent on asynchronous metadata enrichment.

    IMPROVED

    • Added immediate CSS-grid sizing through custom properties.
    • Neutralized conflicting native thumbnail sizing so Booru Enhancer controls the enhanced gallery layout.
    • Added defensive numeric coercion for persisted gallery settings.
    • Preserved idempotent infinite-scroll initialization.
    • Preserved pagination loop detection and native paginator restoration.

    v1.2.5 — Pagination & Grid Stability

    FIXED

    • Made gallery initialization idempotent.
    • Made infinite-scroll setup idempotent.
    • Added protection against duplicate observers and sentinels.
    • Added pagination loop detection.
    • Prevented already-visited pages from being requested repeatedly.
    • Restored native pagination when infinite-scroll requests fail.
    • Prevented grid items from collapsing or overlapping.
    • Added min-width/min-height/overflow protections for grid items.
    • Improved aspect-ratio and object-fit handling for thumbnails.

    IMPROVED

    • Made SPA/AJAX navigation handling safer.
    • Reduced the possibility of duplicated UI and event listeners after navigation or re-initialization.
    • Added more defensive error handling around gallery operations.

    v1.2.7 — Overall Result

    • Safer event interception
    • Safer Gelbooru wrapper detection
    • No fabricated Gelbooru pagination URLs
    • Reliable infinite-scroll recovery
    • Idempotent gallery initialization
    • Stable dynamic grid sizing
    • Correct action handling for dynamically loaded thumbnails
    • More resilient SPA/AJAX navigation
    • Better separation between site-native behavior and Booru Enhancer behavior

    ===============================================================================

  • v1.2.5 26/8/2026

    Booru Enhancer — v1.2.5

    Gallery, Pagination & Reliability Overhaul

    Fixed

    • Fixed infinite-scroll fallback pagination

      • Corrected an issue where a calculated fallback next-page URL was stored but never actually used for the request.
      • Calculated pagination URLs are now correctly passed to the page loader.
    • Fixed initial gallery duplicate detection

      • loadedPostIds is now populated from posts already present on the page before infinite scrolling starts.
      • Prevents the first dynamically loaded page from re-inserting posts that are already visible.
    • Fixed gallery state resets

      • Gallery-specific state is now reset only when the actual gallery container is replaced.
      • Ordinary DOM mutations no longer unnecessarily reset pagination or post-tracking state.
    • Fixed duplicate thumbnails during infinite scrolling

      • Newly fetched posts are checked against the existing loadedPostIds set before insertion.
      • Overlapping pagination results no longer create duplicate thumbnails.
    • Fixed repeated infinite-scroll initialization

      • Reinitializing the gallery no longer creates multiple IntersectionObservers, sentinels, or delegated event handlers.
      • This is especially important for SPA navigation, MutationObserver updates, and settings changes.
    • Fixed repeated infinite-scroll toggling

      • Turning infinite scrolling on and off repeatedly no longer leaves stale observers or sentinel elements behind.
      • Disabling infinite scrolling correctly disconnects the observer and restores native pagination.
    • Fixed pagination loops

      • Added pagination identity tracking to prevent repeatedly requesting the same page.
      • A → B → A pagination loops are detected and stopped automatically.
      • Repeated page identities now transition the loader into a safe exhausted state.
    • Fixed gallery replacement handling

      • When a site replaces its gallery during SPA/AJAX navigation, the old gallery's page-scoped state is discarded correctly.
      • New galleries receive fresh pagination and duplicate-detection state.

    Improved

    • More reliable pagination discovery

      • Explicit rel="next" and site-specific next-page links are preferred.
      • Additional pagination links are inspected when a dedicated next link is unavailable.
      • Generic pagination no longer blindly assumes a universal +42 page size.
    • Safer generic-site pagination

      • Generic adapters now prefer real pagination evidence from the site's own links.
      • Observed pid increments can be reused when a valid next-page link provides enough information.
      • If pagination cannot be determined safely, the enhancer stops instead of generating arbitrary URLs.
    • Improved infinite-scroll failure handling

      • The native paginator is not hidden prematurely.
      • Failed or exhausted infinite-scroll attempts can restore the site's original pagination controls.
    • Improved page-loading diagnostics

      • Added detailed debug logging for:
      • Infinite-scroll triggers
      • Selected next URLs
      • Pagination identities
      • Page requests
      • HTTP responses
      • Gallery detection
      • Thumbnail counts
      • Duplicate filtering
      • Page-loop detection
      • Exhaustion conditions
    • Improved dynamic gallery support

      • Newly inserted thumbnails automatically inherit the existing delegated gallery interactions.
      • Gallery interaction no longer depends on attaching individual listeners to every thumbnail.
    • Improved immediate thumbnail interaction

      • Thumbnail clicks are handled through gallery-level event delegation.
      • Opening a thumbnail does not require waiting for metadata enrichment to finish.
      • Metadata can continue loading in the background and upgrade the viewer afterward.
    • Improved gallery initialization

      • Gallery initialization is now designed to be idempotent.
      • Repeated initialization attempts do not duplicate listeners or gallery infrastructure.

    Settings & Persistence

    • Settings continue to use persistent userscript storage.
    • Storage writes support both synchronous and Promise-based userscript manager APIs.
    • Settings changes can update the active gallery without recreating the entire gallery system.
    • Gallery settings now safely control grid layout and infinite-scroll lifecycle.

    Version

    • Updated Booru Enhancer to v1.2.5.
    • Userscript metadata and internal runtime version are synchronized at 1.2.5.

    Known Limitations

    • Some older Gelbooru-family installations may still require site-specific pagination handling because their pid page size can vary.
    • Generic booru compatibility remains best-effort when a site does not expose reliable pagination or post identifiers.

    Compatibility

    Tested architecture targets:

    • Danbooru
    • Gelbooru
    • Safebooru
    • Rule34
    • Realbooru
    • TBIB
    • Xbooru
    • HypnoHub
    • Moebooru-family sites
    • e621 / e926
    • Generic booru-style sites

    Summary

    v1.2.5 focuses on making the gallery and infinite-scroll system idempotent, duplicate-safe, loop-resistant, and resilient to SPA/AJAX page changes, while preserving the existing viewer, downloader, settings, metadata, and adapter architecture.

  • v1.2.0 25/8/2026

    v1.2.0 — Runtime Repair & Feature Integration

    Added

    • Added a resilient GM API compatibility layer for:
      • Violentmonkey
      • Tampermonkey
      • ScriptCat
    • Added persistent userscript menu commands:
      • Booru Enhancer → Settings
      • Booru Enhancer → Enable/Disable
      • Booru Enhancer → Reset Settings
      • Booru Enhancer → Debug Mode
    • Added configurable thumbnail size.
    • Added configurable gallery grid spacing.
    • Added live gallery layout settings.
    • Added download controls to the main Booru Enhancer toolbar.
    • Added Download, Open Original, Favorite, and Close controls to the fullscreen viewer.
    • Added immediate event delegation for gallery thumbnails.
    • Added improved infinite-scroll status and retry handling.
    • Added HTTP 429 retry handling with exponential backoff.
    • Added adapter fallback to the generic booru implementation.

    Fixed

    • Fixed the downloader being implemented but not exposed through the user interface.
    • Fixed the missing Download action in the main toolbar.
    • Fixed the missing Download action in the fullscreen viewer.
    • Fixed viewer initialization being dependent on metadata loading.
    • Fixed thumbnail clicks being handled too late after page load.
    • Fixed gallery hover/click functionality not being immediately available.
    • Fixed settings initialization being able to fail silently when storage was unavailable.
    • Fixed adapter detection failures preventing the entire script from starting.
    • Fixed gallery grid spacing and thumbnail sizing configuration.
    • Fixed thin thumbnails overflowing their gallery tiles.
    • Fixed gallery pagination relying exclusively on a single next-page selector.
    • Fixed Gelbooru-family pagination fallback from blindly assuming a fixed page size.
    • Improved duplicate post prevention during infinite scrolling.
    • Improved handling of failed pagination requests.

    Improved

    • Reworked startup into a more resilient initialization pipeline.
    • Added storage fallback to an in-memory cache when userscript storage fails.
    • Added safer settings defaults and persistent settings loading.
    • Added explicit startup logging.
    • Improved adapter detection and generic fallback behavior.
    • Improved cross-origin networking through the userscript GM API.
    • Improved download filename generation using metadata templates.
    • Improved original-media discovery through adapter-specific post fetching.
    • Improved fullscreen viewer behavior.
    • Improved gallery event handling through event delegation.
    • Improved responsive gallery layout.
    • Improved infinite-scroll pagination state handling.
    • Improved retry behavior for failed network requests.
    • Added SPA navigation detection and reinitialization support.

    Gallery Settings

    The following settings are now available:

    • gallery.infiniteScroll
    • gallery.gridDensity
    • gallery.thumbnailSize
    • gallery.gridGap

    Downloading

    The downloader now supports:

    • Original-quality media
    • Images and videos
    • Custom filename templates
    • GM_download
    • Browser download fallback
    • Metadata-based filenames

    Example:

    Character - Artist (123456).jpg
    
  • v1.1.2 25/8/2026

    v1.1.2 — Gallery UX & Initialization Improvements

    Fixed

    • Fixed gallery interactions taking several seconds to become available after page load.
    • Fixed thumbnail click handling being delayed until metadata finished loading.
    • Fixed thumbnails opening in a new tab before the Booru Enhancer viewer was ready.
    • Fixed hover-preview initialization being unnecessarily dependent on metadata loading.
    • Fixed thin thumbnails overflowing or overlapping adjacent thumbnails.
    • Improved thumbnail containment and grid layout stability.
    • Fixed gallery spacing being absent between thumbnails.
    • Fixed gallery layout settings not being applied immediately after changing them.
    • Improved gallery container detection across supported booru layouts.
    • Improved dynamically inserted thumbnails so they become interactive immediately.

    Added

    • Added configurable thumbnail size.
    • Added configurable gallery grid spacing.
    • Added live thumbnail-size adjustment.
    • Added live grid-gap adjustment.
    • Added event delegation for gallery click and hover interactions.
    • Added more detailed infinite-scroll diagnostics.
    • Added separate handling for HTTP errors, login pages, empty responses, and rate-limit responses.
    • Added retry handling for HTTP 429 responses with exponential backoff.
    • Added adapter-aware gallery container detection.

    New Gallery Settings

    • gallery.thumbnailSize
      • Adjustable from 120px to 500px.
    • gallery.gridGap
      • Adjustable from 0px to 20px.
    • gallery.gridDensity
      • Controls the number of grid columns.
    • gallery.compactMode
      • Provides a more compact gallery layout.

    Performance

    • Gallery interactions no longer wait for metadata enrichment.
    • Viewer click handling is initialized immediately.
    • Hover previews are initialized immediately.
    • Metadata enrichment runs independently from the initial gallery UI.
    • Dynamically loaded thumbnails use the same delegated event handlers as the initial gallery.
    • Reduced the need for repeatedly attaching individual thumbnail event listeners.

    Infinite Scroll

    • Added extensive pagination diagnostics.
    • Improved pagination error reporting.
    • Added HTTP 429 rate-limit handling.
    • Added retry handling for failed page requests.
    • Improved validation of fetched gallery pages.
    • Improved detection of login/error responses.
    • Improved handling of dynamically loaded gallery content.

    Note: Infinite-scroll pagination is still being actively tested across the different Gelbooru-family implementations. Additional site-specific pagination fixes may follow.

  • v1.1.1 25/8/2026

    Changelog — Booru Enhancer v1.1.1

    [1.1.1] — Infinite Scroll & Pagination Rewrite

    Added

    • Added a site-independent pagination API to adapters:

      • getNextUrl()
      • getPageIdentity()
      • getPostIdentity()
      • calculateNextUrl()
    • Added dedicated pagination support for:

      • Gelbooru
      • Safebooru
      • Rule34.xxx
      • Realbooru
      • TBIB
      • Xbooru
      • HypnoHub
      • Danbooru
      • Moebooru
      • e621/e926
      • Generic booru sites
    • Added support for Safebooru/Gelbooru-style:

      • #paginator a[alt="next"]
      • a[title="next"]
      • a.next
      • a[rel="next"]
    • Added PID-based pagination detection for Gelbooru-family sites.

    • Added automatic page-size detection from real pagination links.

    • Added calculated pagination fallback when a site does not expose a usable next link.

    • Added dynamic infinite-scroll sentinel with status messages:

      • Loading more…
      • Scroll for more…
      • No more posts
      • Unable to load the next page.
    • Added Retry button when a page request fails.

    Changed

    • Completely rewrote the infinite-scroll implementation.
    • Moved pagination logic out of the gallery module and into individual adapters.
    • Infinite scroll now obtains pagination information exclusively through adapter.pagination.
    • Pagination state is now stored in JavaScript rather than repeatedly reading the live paginator DOM.
    • Native pagination controls are hidden using a reversible CSS class instead of directly modifying style.display.
    • Fetched pages are validated before being inserted into the gallery.
    • Added HTTP-status and response-body validation.
    • Added detection for invalid/login/error pages.
    • The gallery now extracts the next-page URL before modifying the live DOM.
    • Infinite scroll automatically continues when the sentinel remains inside the preload area after a page is loaded.
    • Preserved existing query parameters when calculating fallback URLs.

    Fixed

    • Fixed Safebooru infinite scroll stopping after the first page.

      • Safebooru uses #paginator a[alt="next"], which was not recognized by the previous implementation.
    • Fixed pagination logic that incorrectly marked a gallery as exhausted when the standard a[rel="next"] / a.next selectors were unavailable.

    • Fixed duplicate page requests.

    • Fixed duplicate post insertion across dynamically loaded pages.

    • Fixed pagination state being lost when the site's paginator DOM is replaced.

    • Fixed infinite-scroll requests being triggered concurrently.

    • Fixed false "No more posts" states when pagination detection temporarily fails.

    • Fixed retry behavior by preserving the exact failed URL.

    • Fixed calculated pagination from losing existing query parameters such as tags, rating, sorting, page, pid, and s.

    Pagination Behavior

    Current Page
         │
         ▼
    adapter.pagination.getNextUrl()
         │
         ├── Explicit next link
         │
         ├── Advancing PID/page link
         │
         └── calculateNextUrl() fallback
                  │
                  ▼
            Load next page
                  │
                  ▼
           Validate response
                  │
                  ▼
            Extract posts
                  │
                  ▼
           Deduplicate posts
                  │
                  ▼
            Insert into grid
                  │
                  ▼
           Find next page URL
                  │
                  ▼
            Continue scrolling
    

    Supported Pagination

    Adapter Pagination
    Gelbooru-family pid + explicit next links + calculated fallback
    Danbooru page + next links
    Moebooru page + next links
    e621/e926 page / cursor-based pagination
    Generic pid / page + next links

    Internal Improvements

    • Added loadedPages tracking.
    • Added loadedPostIds tracking.
    • Added consecutiveEmptyPages tracking.
    • Added explicit IDLE → LOADING → SUCCESS / ERROR / EXHAUSTED state handling.
    • Exposed gallery pagination state through:
    BE.modules.gallery._scrollState
    
    • Added detailed pagination debug logging.
    • Added safer handling of empty or malformed responses.

    Compatibility

    • Existing gallery functionality remains intact.
    • Infinite scroll remains controlled by:
    gallery.infiniteScroll
    
    • Disabling infinite scroll restores the site's native pagination controls after reload.
  • v1.1.0 25/8/2026

    Changelog

    [1.1.0] — Reliability & Gallery Overhaul

    Fixed

    • Settings persistence race conditions

      • Settings now load only after the GM storage cache has finished initializing, preventing saved preferences from being overwritten by defaults on startup.
      • Added safer handling for asynchronous storage operations.
    • Storage schema migration support

      • Introduced a storage-version/migration hook for future settings changes.
      • Corrupt or unreadable stored values now fail safely instead of breaking initialization.
    • Gallery thumbnail sizing

      • Thumbnail sizing is now completely independent of metadata/API requests.
      • Grid layout is applied immediately when thumbnails are discovered.
      • API failures can no longer cause thumbnails to remain extremely small.
    • gridDensity / compactMode

      • Grid density now directly controls the gallery's CSS grid columns via new --be-grid-columns and --be-thumb-gap custom properties.
      • Changes to grid density and compact mode apply live, without requiring a page reload.
    • Gelbooru-family API failures

      • Added a multi-stage metadata retrieval strategy:
      • Same-origin fetch() with session credentials.
      • GM_xmlhttpRequest fallback.
      • Rendered post-page HTML scraping as a final fallback.
      • API outages, authentication restrictions, or CSP issues no longer disable gallery metadata enrichment.
      • HTML fallback requests use bounded concurrency and gentle pacing to avoid hammering the server.
    • Silent toolbar/keybind failures

      • Actions requiring a selected post or active selection now provide visible toast feedback.
      • Selection mode now reports its current state.
      • Bulk download and reverse-search actions no longer fail silently.
    • Settings-page consistency

      • The settings toolbar is now available consistently across gallery, search, index, post, and pool pages.
      • Settings that require a page reload are explicitly marked with a "Reload required" indicator.

    Improved

    • Gallery architecture — Visual thumbnail processing and metadata enrichment are now separate stages, so browsing remains functional even when metadata APIs are unavailable.
    • Network handling — Centralized GM_xmlhttpRequest wrapper provides Promise-based requests with retry/backoff handling and better compatibility between classic GM_* and namespaced GM.* APIs.
    • User feedback — Added lightweight, auto-dismissing toast notifications for non-blocking UI feedback.
    • Adapter resilience — Gelbooru-family adapters now tolerate differences between Gelbooru clones and markup versions, with improved post-ID detection across multiple thumbnail markup patterns.

    Architecture

    Continued modular adapter-based design:

    Module Responsibility
    BE.core Lifecycle and adapter/module registry
    BE.store Persistent storage
    BE.settings Typed configuration
    BE.bus Event bus
    BE.net Network layer
    BE.adapters.* Site/engine adapters
    BE.modules.* Independent feature modules

    Verification

    This release resolves the major issues identified in 1.0.x:

    • [x] Settings persistence race
    • [x] Storage initialization race
    • [x] Tiny thumbnails after API failure
    • [x] Broken grid-density behavior
    • [x] Gelbooru API failure handling
    • [x] Missing HTML fallback
    • [x] Silent toolbar actions
    • [x] Inconsistent settings access
    • [x] Reload-required settings feedback
    • [x] Version consistency (1.1.0)

    Known / Deliberately Unimplemented

    The following remain intentionally out of scope for this release:

    • Cloud synchronization
    • Tag analytics
    • ML tag suggestions
    • Duplicate finder
    • Local download database
    • External plugin loader
    • Full i18n/theme system
    • Command-palette UI

    The current architecture already provides extension points for these features without requiring changes to the core system.

  • v1.0.1 20/7/2026

    changed namespace and version

  • v1.0.0 20/7/2026