Console

jdenticon

Jdenticon - SVG/Canvas identicon generator. Generates unique visual identifiers (identicons) from hash values. Supports configurable icon size, color palette, and rendering backends.

progressx

A lightweight progress bar library with theme support, optimized by dr|z3d

I2PSnark

click

Adds a .depress CSS class to input elements on click for visual feedback, with extended timing for action buttons. Provides custom confirmation dialogs for remove and delete torrent operations, with keyboard support (Enter/Escape), iframe-aware positioning, and animated transitions.

convertTooltips

Converts native browser title attributes on progress bar and torrent status elements into custom data-tooltip attributes with CSS-based tooltip styling. Uses a MutationObserver to handle dynamically added elements. Provides styled pseudo-element tooltips with arrow indicators.

filterBar

Manages the filter bar UI for showing/hiding torrents by status (all, seeding, downloading, etc.). Handles badge count display, filter state persistence to localStorage, URL updates for sort icons, and AJAX-based loading of filtered content.

getImgDimensions

On DOM load, iterates over all thumbnail images (.thumb) in the file listing, reads their natural dimensions, and inserts a span element displaying the width x height next to the file name link.

graphRefresh

Fetches a bandwidth graph image from the I2P stats servlet at a configurable interval, converts it to a blob URL, and applies it as a CSS custom property so the UI can display a live download graph. Also applies the graph as a background in the message log when available. Auto-disables on HTTP 400 errors.

lightbox

A self-contained lightbox class for viewing thumbnail images in a fullscreen overlay. Supports grouped image navigation (prev/next), slideshow playback with configurable delay, responsive resizing, iframe-aware positioning, and preloading of adjacent images. Based on jsOnlyLightbox by Felix Hagspiel.

messageTypes

Message type identifiers used to coordinate fetch and abort requests between the main thread and the snarkWork worker. Each fetch request carries a requestId so multiple requests can be in flight concurrently.

pageNav

Intercepts clicks on pagination links in the I2PSnark UI, converts them to AJAX requests, and updates the browser history without full page reloads. Prevents duplicate listeners via a body class check.

realtimeSearch

Overrides the native #snarkSearch form submission with a debounced, worker-backed search that filters the torrent list without page navigation. The native GET form remains the no-JavaScript fallback.

refreshPayload

Parses a fetched HTML document into a structured payload of container strings and cell texts, so the main thread can update the page without parsing the whole document. Also extracts the snark tunnel counts from the raw tunnel configuration page text. Runs inside the snarkWork worker, on the main-thread fallback path, and in tests.

refreshTorrents

Core refresh module for I2PSnark. Manages periodic AJAX-based updates of the torrent list, screen log, header/footer stats, and file listings. Uses a web worker for fetch operations, caches responses, handles visibility changes, and orchestrates initialization of sub-modules (sorting, pagination, filter bar, lightbox, debug toggle).

setFilterQuery

Reads the current filter value from the URL query string or localStorage, then updates the href attributes of the I2PSnark navbar link and cancel-search link so they preserve the active filter across navigation.

snarkAlert

Handles form submission for adding and creating torrents, then displays inline notification messages to the user. Integrates with the torrent refresh system to update the screen log after operations complete.

snarkSort

Intercepts clicks on column-sort links in the I2PSnark torrent table header, converts them into AJAX requests, and updates the browser history to reflect the active sort.

snarkWork

Fetches AJAX HTML documents off the main thread with streaming reads and per-request abort support. Parses the response and extracts the refresh payload so the main thread only performs minimal DOM writes. Also fetches the tunnel configuration page for the snark tunnel counters. Document objects cannot cross the worker boundary, so all payload values are strings or arrays of strings.

textView

Provides an inline text viewing overlay for supported text file types (.asc, .bat, .css, .ini, .js, .json, .md5, .nfo, .sh, .srt, .txt, .url, and CSV). Supports line-numbered display for code-like files, iframe-aware fullscreen mode, response caching, scroll locking, and open-in-new-tab links.

toggleAddCreate

Ensures the Add Torrent and Create Torrent panels are fully visible when expanded and restores the prior scroll position when they are collapsed again. Works both standalone and embedded in the router console iframe.

toggleConfigs

Provides expand/collapse functionality for the file filter and tracker configuration tables in I2PSnark. Handles iframe-aware scrolling by posting messages to the parent frame when embedded, or scrolling natively in standalone mode.

toggleDebug

Adds a click listener that toggles a "debug" class on the document body, allowing debug-related table rows and panels to be shown or hidden in the I2PSnark UI.

toggleLinks

Provides UI controls for switching between magnet link and direct torrent link display modes in I2PSnark. Also enables copying magnet links to the system clipboard with a toast notification on success.

toggleLog

Provides expand/collapse controls for the I2PSnark screen log (#screenlog). Adds "expand" and "shrink" buttons that toggle between a collapsed (56px) and expanded (up to 300px) view. Injects the required CSS dynamically.

togglePriorities

Adds a toggle row to the file directory header that allows bulk toggling of download priority (high/skip) for all incomplete files. Supports mutual exclusion between priority levels and falls back to normal priority when all toggles are unchecked.

toggleVaryTunnelLength

Provides a toggle mechanism for inbound and outbound tunnel length variance by manipulating the i2cpOpts input field. When a checkbox is checked, sets lengthVariance=1; when unchecked, sets it back to 0. Appends the option if not present.

tunnelCounter

Periodically fetches tunnel data from the I2P tunnel configuration page, counts active inbound and outbound snark tunnels, and injects the counts into the UI via CSS pseudo-element content. Fetches and extracts through the snarkWork worker, falling back to a direct fetch when the worker is unavailable. Requires I2P+ and does not work with standalone I2PSnark.

I2PTunnel

delete

Attaches click handlers to delete buttons to prompt user confirmation before deletion

filterTunnels

Creates a search input that filters tunnel blocks based on user input matching against tunnel name, type, interface, location, and port

refreshIndex

Handles auto-refreshing the tunnel index page, updating service status counts, managing router down state overlay, and providing tunnel control functionality

toggleThrottler

I2PTunnel Manager component that toggles the throttler panel visibility and remembers the user's preference via localStorage

toggleTunnelInfo

Expands or collapses tunnel detail rows and updates the toggle button icon

SusiDNS

clearSearch

I2P+ SusiDNS clear-search widget. Injects a clear-search button alongside the search input field and dynamically shows/hides it based on input content.

deleteHosts

I2P+ SusiDNS host deletion utility. Provides command-line style host deletion from address books via URL parameters.

refreshStatus

I2P+ SusiDNS status refresher. Automatically refreshes host status elements in the address book at regular intervals using AJAX polling.

toggleAllHosts

I2P+ SusiDNS toggle-all-hosts utility. Provides a master checkbox to select/deselect all hosts for deletion when the "dead hosts" filter is active.

togglePanels

I2P+ SusiDNS panel toggler. Provides show/hide functionality for the "Add New Host" and "Import Hosts" panels, including scroll-lock and iframe-aware behavior.

SusiMail

compose

SusiMail compose-window unload guard. Prevents accidental navigation away from the compose page by prompting the user before unload, unless a form submission button has been clicked.

deleteMail

I2P+ SusiMail delete-mail modal handler. Ensures the delete-mail confirmation modal is correctly positioned and visible on instantiation, with iframe-aware viewport calculations and a MutationObserver for cleanup on removal.

folder

SusiMail folder view button handlers. Manages delete, select-all, clear-selection, and row-click interactions in the mail folder list view.

HtmlSanitizer

Client-side HTML sanitizer for preventing XSS in user-generated content. Uses DOMParser for browser-native, fast parsing with allowlist approach.

htmlView

SusiMail HTML view handler. Manages toggle-view buttons for switching between text and HTML mail views, and applies fallback CSS styling inside the HTML iframe.

markdown

SusiMail Markdown renderer. Converts Markdown-formatted mail bodies into HTML. Supports: CommonMark + GFM (tables, strikethrough, task lists, fenced code lang). Self-contained, no external dependencies.

Security model:

  • Renderer emits only a fixed set of whitelisted HTML tags.
  • All link URLs pass through scheme allowlist (http:, https:, mailto:).
  • All text content is HTML-escaped before output.

Security note: initMarkdown() expects mailbody elements to contain plain text markdown. Do not pre-populate with HTML. For defense-in-depth, consider post-processing output with DOMPurify if handling untrusted third-party input.

notifications

SusiMail notification handler. Auto-removes empty notification elements and adds a click-to-dismiss handler for notification banners.

previewMail

SusiMail message preview on hover. Displays a floating preview popup when hovering over mail subject links in the folder list, with caching, timeout handling, and theme-aware styling.

refreshInbox

I2P+ SusiMail inbox refresher. Performs AJAX polling to refresh the mailbox view and notification elements without a full page reload. The "Refresh Page" button also triggers an immediate fetch on click.

sanitizeHTML

SusiMail HTML sanitizer and display fixer. Addresses layout and security issues in iframed HTML messages: removes !important declarations, normalises div margins, blocks remote images, and surfaces blocked-image/web-bug counts.

toggleHeaders

SusiMail toggle-headers utility. Provides expand/collapse controls for showing or hiding debug email headers in the message view.