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.
I2PSnark
I2PSnark
click
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.