melihgurlek/basic-subreddit-randomizer

★ 0Forks 0JavaScriptGitHub ↗Compare

README

Reddit Randomizer

A Manifest V3 Chrome extension that natively integrates a "Random Post" button into Reddit's modern UI. It bypasses API rate limits and pagination constraints by utilizing concurrent background fetching and local caching.

Features

  • Native UI Integration: Injects seamlessly into Reddit's React/Lit Shadow DOM (feed header and post credit bar) adapting to native CSS variables.
  • Zero-Latency Navigation: Uses Promise.all to concurrently fetch and shuffle up to 400 top posts across different timeframes into chrome.storage.session, making subsequent random loads instantaneous.
  • Subreddit Isolation: Maintains separate memory caches dynamically based on the active subreddit.
  • Keyboard Navigation: Press → (Right Arrow) while reading a comment thread to instantly teleport to the next random post.

Installation (Developer Mode)

Since this is not published on the Chrome Web Store, you can install it locally:

  1. Download or clone this repository to your computer.
  2. Open Chrome and navigate to chrome://extensions/.
  3. Toggle on Developer mode in the top right corner.
  4. Click Load unpacked in the top left and select the folder containing the extension files.
  5. Refresh any open Reddit tabs.

Technical Highlights

  • Manifest V3: Utilizes Service Workers for background data processing to ensure longevity and low memory footprint.
  • MutationObserver: Intelligently watches for Single Page Application (SPA) DOM changes to re-inject UI elements without breaking Reddit's React state.
  • Rate-Limit Evasion: Condenses hundreds of page-loads into a single background batch-fetch to stay well within Reddit's unauthenticated API constraints.

License

MIT License - Melih Gürlek

Contributors

melihgurlek

Issues