[Userscript] Danbooru Insights

Posted under General

Danbooru Insights (formerly Danbooru Grass) is a comprehensive analytics suite for Danbooru users and tags. It injects GitHub-style contribution graphs and advanced dashboards directly into profile and wiki pages, with full support for both desktop and mobile.

The script consists of three main components:

  • GrassApp: Visualizes user contributions (Uploads, Approvals, Notes) on a GitHub-like calendar heatmap with support for hourly activity analysis, 12 themes, and per-theme grass color palettes.
  • UserAnalyticsApp: Provides deep insights into a user's posting habits, including milestones, tag usage, tag cloud, created tags discovery, post scores with downvote filtering, and extensive distribution charts.
  • TagAnalyticsApp: A specialized dashboard for Artist, Copyright, and Character tags. It analyzes extensive data including historical trends, popular posts, active uploaders/approvers, and milestones for any specific tag.

Installation

Project page
Main script
Wiki
  • TBA
Usage notes
  • Where it runs
    • Profile pages (/users/*, /profile): GrassApp (contribution graph) + UserAnalyticsApp (πŸ“Š button next to username).
    • Wiki pages (/wiki_pages/*) and Artist pages (/artists/*): TagAnalyticsApp (πŸ“Š button next to tag name).
  • First-time setup
    • GrassApp loads automatically on profile pages β€” no action needed.
    • UserAnalyticsApp: Click the πŸ“Š button next to the username. A one-time data sync runs on first use. Posts ≀1,200 sync instantly; larger accounts may take a few minutes. You can close the modal β€” sync continues in the background.
    • TagAnalyticsApp: Click the πŸ“Š button on a wiki or artist page. Data is fetched on first click and cached for 24 hours.
  • Settings (βš™οΈ)
    • 12 themes (6 light / 6 dark), each with 4 selectable grass color palettes (48 total). Click an active theme icon to open the palette flyout.
    • Contribution thresholds: Customize the 4-level color scale per metric (Uploads / Approvals / Notes).
    • Settings are saved per-user in localStorage.
  • Data & Caching
    • Post metadata is cached locally in IndexedDB (Dexie.js) β€” no re-fetching on revisit.
    • TagAnalyticsApp cache expires after 24h or when post count changes significantly (threshold configurable via βš™οΈ).
    • Use the πŸ—‘οΈ button inside the dashboard to full-reset and re-fetch.
    • Stale data for inactive users is auto-cleaned after 14 days.
    • API calls are rate-limited to 6 req/s (Token Bucket) to comply with Danbooru rate limits.

Final

Any suggestions or feedback is appreciated.

Latest edits

  • (2026-04-21)
    • Version 9.3.0 β€” GrassApp magnet snap-to-edge resize, structured logging with dual-gated logger & toast notifications, mobile diagnostic overlay, v9.2.4 cache revalidation, mobile layout fixes (stats clipping, scatter filter overlap, milestones grid, tap-only tooltip), DataManager integrity test coverage (30 cases, 185 total).

Versions

Show
  • (2025-12-12)
    • Version 1.0 - Initial release of Danbooru Grass β€” GitHub-style contribution graph using d3.v7 and cal-heatmap with Dexie.js local caching.
  • (2025-12-13)
    • Version 2.0 - Added Notes and Approvals metric modes alongside Uploads.
  • (2025-12-14)
    • Version 3.0 - Introduced a theme system with light/dark presets and a custom contribution threshold editor.
  • (2025-12-14)
    • Version 3.1 - Added new color themes (Aurora, Solarized, Ice) and improved label/scrollbar coloring per theme.
  • (2025-12-24)
    • Version 4.0 - Rebranded to Danbooru Insights; added Analytics Dashboard with Tag Distribution, Milestones, Scatter Plot, and improved sync.
  • (2025-12-24)
    • Version 4.2 - Incremental bug fixes and UX improvements.
  • (2025-12-27)
    • Version 4.4 - Refined Milestone tracking, Monthly Activity chart, and Post Performance analytics.
  • (2026-01-01)
    • Version 4.5 - Fixed new year / January 1st edge cases in GrassApp date calculation.
  • (2026-01-11)
    • Version 5.0 - Advanced Approvals Tracking with exact Post ID logging and Hourly Activity heatmap.
  • (2026-01-18)
    • Version 5.1 - Character Bubble Chart (Jaccard Similarity) and Hair Length/Color analysis tabs in the Pie Chart.
  • (2026-01-18)
    • Version 5.2 - Enhanced sync stability for large datasets and refined thumbnail selection logic.
  • (2026-01-26)
    • Version 5.3 - Overhauled Approvals to use /post_approvals.json with server-side filtering for a major speed improvement.
  • (2026-02-10)
    • Version 6.0 - Launched TagAnalyticsApp with full analytics support for any Tag, Artist, Copyright, or Character.
  • (2026-02-11)
    • Version 6.1 - Resizable and movable GrassApp layout with per-user IndexedDB storage; added multi-booru compatibility.
  • (2026-02-16)
    • Version 6.2 - Dynamic level-tier username colors, fixed hourly uploads distribution, added commentary support for small tags.
  • (2026-02-17)
    • Version 6.3 - Pill-style pie chart tabs, post dropdown menus (Most/Recent Popular, Random), and Token Bucket rate limiter (6 req/s).
  • (2026-02-17)
    • Version 6.4 included a general UI cleanup and thumbnail optimization for a smoother experience.
  • (2026-02-23)
    • Version 6.5 which includes a structural UI overhaul and performance optimizations for TagAnalyticsApp.
  • (2026-03-04)
    • Version 7.0.0 which is a full TypeScript migration of the codebase with no user-facing changes.
  • (2026-03-10)
    • Version 7.1.0 β€” security hardening, bug fixes, and internal performance improvements with no user-facing breaking changes.
  • (2026-03-10)
    • Version 7.2.0 β€” granular G/S/Q/E rating tabs, unified chronological user history timeline, and thumbnail fetch fixes.
  • (2026-04-04)
    • Version 7.3.0 β€” Tag Cloud widget (d3-cloud word cloud with 4 category tabs and log-scale sizing).
  • (2026-04-04)
    • Version 7.4.0 β€” Created Tags widget (NNTBot forum parsing, previous username detection, alias status).
  • (2026-04-04)
    • Version 7.5.0 β€” Gender/Commentary/Translation pie chart tabs, 2-row tab layout, scatter plot drag range display, Repdigit milestones.
  • (2026-04-04)
    • Version 8.0.0 β€” 3 new themes (Lavender/Monokai/Ember), grass color picker (48 palettes), architecture separation, 112 tests, thumbnail loading fix.
  • (2026-04-07)
    • Version 8.1.0 β€” Cross-tab rate coordination via BroadcastChannel, global 429 backoff, error page guard, shared rate limiter per tab.
  • (2026-04-11)
    • Version 9.0.0 β€” Full mobile support, scatter plot overhaul (Y=10 click, downvote filter, hover preview), next milestone card, DB schema v10 with auto backfill, and project moved to its own dedicated repository.
  • (2026-04-13)
    • Version 9.1.0 β€” UserAnalyticsApp/ TagAnalyticsApp Dashboard dark mode (Auto/Light/Dark), GrassApp delta-fetch performance fix (~2,100 ms β†’ ~300 ms), strict ESLint posture.
  • (2026-04-17)
    • Version 9.2.0 β€” GrassApp vertical drag layout (inline ↔ below with per-mode persistence), UserAnalyticsApp stale-while-revalidate render caching, GrassApp natural-width fit & stats max-width fix for long Previous Names.
  • (2026-04-21)
    • Version 9.3.0 β€” GrassApp magnet snap-to-edge resize, structured logging with dual-gated logger & toast notifications, mobile diagnostic overlay, v9.2.4 cache revalidation, mobile layout fixes (stats clipping, scatter filter overlap, milestones grid, tap-only tooltip), DataManager integrity test coverage (30 cases, 185 total).

Updated by AkaringoP

Pushed Version 6.5 which includes a structural UI overhaul and performance optimizations for TagAnalyticsApp:

UI: Redesigned UserAnalyticsApp with a new animated 3-pane summary card layout.
Performance: Extended TagAnalyticsApp fast-path calculation logic to optimize tags with up to 1,200 posts (up from 100).
Refactor: Cleaned up the CSS architecture by consolidating all scattered inline styles into a centralized GLOBAL_CSS.

Updated by AkaringoP

Pushed Version 7.0 which is a full TypeScript migration of the codebase with no user-facing changes:

  • Rewrite: Converted the entire ~12,000-line single-file script into 13 TypeScript modules (config, styles, types, core/*, ui/*, apps/*) with complete type annotations.
  • Build: Introduced Vite + vite-plugin-monkey and tsc for bundling and type checking, replacing the hand-edited single file workflow.
  • Tests: Added 55 automated unit tests (Vitest) covering core logic β€” settings, rate limiter, utils, analytics, and routing.

Starting from v7.0, development has moved from Gemini 3.1 Pro + Antigravity to Claude Code + VS Code.

Pushed Version 7.2.0 focusing on enhanced rating controls, a unified user history timeline, and thumbnail fetch fixes:

  • UI/UX: Replaced basic SFW/NSFW tabs with granular G/S/Q/E rating tabs for the Most Popular Post widget, and maintained separate tab states across different widget modes.
  • Features: Completely redesigned the "User History" card into a unified, chronological timeline that seamlessly merges join dates, milestones, and level changes into a single view.
  • Bug Fixes: Resolved HTTP 422 errors when fetching pie chart thumbnails from user favorites, and fixed an issue where thumbnails failed to re-render upon data updates.

Updated by AkaringoP

Pushed Version 8.0 with new widgets, expanded pie charts, a theme system overhaul, and various improvements.
Full changelog: GitHub

GrassApp

  • Grass Color Picker: Each of the 12 themes now offers 4 selectable grass color palettes (48 total), inspired by d3-scale-chromatic (Viridis, Inferno, Plasma, etc.). Click an active theme icon to open the color flyout.
  • New Themes: Added Lavender (light), Monokai (dark), and Ember (dark gradient). Removed Sunset.
  • Hourly Panel Sync: The Hourly Distribution panel now follows the heatmap when you resize or move it.

UserAnalyticsApp

  • Pie Chart β€” 3 New Tabs: Gender (Girl/Boy/Other/No Humans), Commentary (Commentary/Requested/Untagged), Translation (Translated/Requested/Untagged). Tabs are now arranged in two rows with hover tooltips showing full names.
  • Milestones: New dropdown options β€” Repdigit (11, 111, 222, …, 11111) and Every 10k.
  • Created Tags Widget: Discovers general tags the user was the first to create by parsing NNTBot's daily tag reports (topic #21649). Automatically searches previous usernames. Shows current status β€” Active, Aliased (with consequent tag post count), Deprecated, or Empty.
  • Tag Cloud Widget: A d3-cloud word cloud showing the user's most characteristic tags. 4 category tabs (General, Artist, Copyright, Character) with crossfade transitions. General tags are selected by Cosine similarity rather than plain frequency, surfacing tags that define the user's style.
  • Scatter Plot: Dragging a selection now shows the date range, score/tag count range, and post count in a tooltip above the box. Crosshair cursor added.

Architecture

  • Monolithic app files split into data / charts / app modules (~5,000 lines reorganized).
  • 112 automated tests (up from 86), including architecture fitness tests that enforce dependency direction and ban raw fetch().
  • Git pre-commit hook runs the full build pipeline before every commit.

Development uses Claude Code + VS Code.

Updated by AkaringoP

Pushed Version 8.1.0 focusing on multi-tab rate limit coordination and error page handling:

  • Bug Fixes: The script no longer renders on nginx error pages (429, 502, etc.) that previously caused it to misparse the error title as a username.
  • Features: Added cross-tab rate coordination via BroadcastChannel β€” multiple open tabs now automatically share the API rate budget equally instead of competing independently.
  • Features: Added global 429 backoff β€” when any request is rate-limited, all tabs pause API requests for 5 seconds to let the server recover.

Thanks to @CommentaryRequest for reporting this issue.

Pushed Version 9.0 with full mobile support, a scatter plot overhaul, a schema migration, and various improvements.
Full changelog: GitHub

GrassApp

  • Post Hover Preview Card (also in scatter plot popovers): Hovering a post in the approval detail popover shows a floating card with thumbnail, score, favs, rating, and first artist/copyright/character tag. Debounced + cached.

UserAnalyticsApp

  • Scatter Plot β€” Tag Count Mode Y=10 Click: The "10" tick on the Y axis is now clickable and shows two counts (gentags:<10, tagcount:<10) with deep links. Points with t < 10 are highlighted in black on hover.
  • Scatter Plot β€” Score Mode Downvote Filter: Four mutually-exclusive toggle buttons (>0, >2, >5, >10) above the chart filter by downvote count. Applies to both rendered points and the drag-selection popover.
  • Scatter Plot β€” Drag Popover Improvements: Selection rectangle stays visible while the popover is open. Deleted/banned posts shown as gray dots with tooltip. Hover preview card on each list item.
  • Next Milestone Card: A new dashed-border placeholder at the end of the milestones grid shows the upcoming milestone, posts remaining, and a progress bar. Respects the active step selector (Auto / 1k / 2.5k / 5k / 10k / Repdigit).

TagAnalyticsApp

  • Next Milestone Card: Same placeholder card as UserAnalyticsApp, appended to the milestones grid.

Mobile Support (new in v9.0)

  • Fullscreen Modal (100dvh), responsive layout for every widget under 768 px, TagAnalytics rankings switch to a horizontal swipe.
  • Touch Interactions (consistent 2-step "tap β†’ tooltip β†’ action" pattern): CalHeatmap cells, pie chart slices, and tag cloud words all show their tooltip on first tap, then act on second tap. Scatter plot drag selection disabled on touch.
  • Back Button Closes Modal via history.pushState / popstate. Escape key support also added to UserAnalyticsApp.

Repository Migration

As of v9.0.1, Danbooru Insights lives in its own dedicated repository at AkaringoP/Danbooru-Insights, split out of the original monorepo with full commit history preserved. Existing installations will self-migrate to the new update endpoint on the next update check β€” no action required.

It’s a very interesting userscript overall. Lots of stats to look at, mostly out of curiosity, but some can be helpful in gardening posts!

All I ask for is dark mode on UserAnalyticsApp and TagsAnalyticsApp. my eyesss

Pushed Version 9.2.0 focusing on GrassApp vertical drag layout, dashboard render performance, and theme improvements:

Click and drag the top-left corner to move the graph horizontally or switch between inline and below layout.
Click and drag the left or right edge to resize the graph width.

GrassApp

  • Vertical Drag Layout: GrassApp can now be moved between inline (beside stats) and below (own row) positions by dragging the move handle vertically. Each mode independently remembers its width and horizontal offset. A glowing destination bar appears during drag to indicate the target position.
  • Layout Fix: Users with very long Previous Names no longer have GrassApp forced below stats β€” the stats section is now width-constrained so both elements fit side by side.
  • Theme: Replaced the Newspaper theme (which was actually light) with Dracula, a proper dark theme with Green, Pink, Purple, and Cyan grass options. Added a "Preview all" link in the settings popover that opens a GitHub Pages-hosted visual comparison of all 12 themes.

UserAnalyticsApp

  • Render Performance: Dashboard render speed improved via stale-while-revalidate caching for Milestones, TopPosts, RecentPopular, and LevelChange data. Random posts moved off the critical render path. Fixed a race condition where the sync button could trigger a spurious partial sync on fast page loads.

Updated by AkaringoP

Pushed Version 9.3.0 focusing on magnet snap-to-edge resize, structured logging & observability, and mobile layout fixes:

GrassApp

  • Magnet Snap Resize: Container width snaps to the December edge with Β±15px hysteresis when resizing. Togglable via "Snap to edge when resizing" checkbox in settings.

Structured Logging & Observability

  • Structured Logger: Replaced all 123 raw console.* calls with a dual-gated structured logger (dead-code eliminated on main, runtime opt-in on dev).
  • Toast & Diagnostic: Replaced 6 alert() calls with non-blocking toast notifications. Added mobile diagnostic overlay (#di_diag) with zero app dependencies.

Mobile Fixes

  • Layout: Stats table no longer clipped on narrow viewports; scatter downvote filter no longer overlaps the chart.
  • Tooltip: Grass tooltip uses tap detection β€” drag gestures only scroll, no accidental tooltips.

Internal

  • Test Coverage: 30 new DataManager data integrity tests (remote/local count comparison, cache revalidation, pagination). 185 tests total.
1