death.fun ETH → USD overlay

Show USD price next to ETH amounts on death.fun

作者
Portablelle
日安装量
0
总安装量
0
评分
0 0 0
版本
0.1.0
创建于
2025-09-30
更新于
2025-09-30
大小
11.6 KB
许可证
MIT
适用于

death.fun ETH → USD Overlay

A Tampermonkey userscript that enhances the death.fun betting interface by displaying real-time USD conversions next to ETH amounts.

Features

  • Automatic ETH Detection: Intelligently identifies ETH amounts in text, whether explicitly labeled or contextually implied
  • Real-time USD Conversion: Shows USD equivalent next to all ETH values throughout the page
  • Input Field Support: Displays live USD conversion below ETH input fields as you type
  • Sign-Aware Formatting: Properly handles positive (+) and negative (-) amounts
  • Smart Context Detection: Uses multiple heuristics including:
    • ETH icon detection (SVG viewBox matching)
    • ARIA labels and element attributes
    • Parent/ancestor element text content analysis
  • Auto-updating Prices: Fetches current ETH price from CryptoCompare API every 60 seconds
  • Lightweight & Fast: Uses WeakMaps and efficient DOM traversal with MutationObserver

Installation

  1. Install Tampermonkey browser extension
  2. Click on the Tampermonkey icon and select "Create a new script"
  3. Copy the entire contents of tampermonkey.js
  4. Paste into the editor and save (Ctrl+S / Cmd+S)

How It Works

The script:

  1. Scans the page for text containing ETH amounts (e.g., "0.5 ETH", "+2.3 ETH")
  2. Detects numeric inputs likely to contain ETH values based on context
  3. Fetches real-time ETH/USD price from CryptoCompare API
  4. Injects inline USD conversions with tooltips showing the exchange rate
  5. Monitors DOM changes to update conversions dynamically

Example Output

  • Text: 0.5 ETH0.5 ETH ($1,234.56 USD)
  • Input field: Shows ≈ $1,234.56 USD below the input as you type

Configuration

The script uses sensible defaults but key constants can be adjusted:

  • ETH_REGEX: Pattern for matching ETH amounts in text
  • MAX_TEXT_LENGTH: Maximum text length to scan (performance optimization)
  • Price update interval: 60 seconds (line 379)

Privacy & Security

  • Only connects to CryptoCompare API for price data
  • No tracking, analytics, or data collection
  • Runs entirely client-side in your browser
  • Open source - inspect the code yourself

License

MIT Free to use and modify for personal use.