Flashbank Protection (YouTube UI + Settings)

Inverts video if bright flashes are detected. YouTube-native toggle + settings panel.

ئاپتورى
Björn Trier
بۈگۈن قاچىلانغىنى
0
جەمئىي قاچىلانغىنى
4
باھا نومۇرى
1 0 0
نەشرى
3.1
قۇرۇلغان ۋاقتى
2025-06-07
يېڭىلانغان ۋاقتى
2025-06-07
Size
10.5 KB
ئىجازەتنامىسى
MIT
قوللايدىغىنى

Flashbank Protection
Flashbank Protection is a userscript designed to shield your eyes from sudden bright flashes in YouTube videos. It continuously analyzes visual brightness and inverts the video colors in real-time if it detects potentially harmful flashes.

🔧 How It Works
The script captures three thin horizontal stripes from each video frame: top, middle, and bottom.

Each stripe is scanned via an invisible for pixel brightness.

If ≥55% of any stripe's pixels exceed the brightness threshold (RGB ≥ 240), the video is inverted.

Inversion is automatically removed once brightness levels drop below the threshold.

A floating indicator (👁 Bright Flash Protection Active) is shown when protection is active.

Optionally displays a live debug canvas at the bottom for visual analysis.

▶️ Usage
Install the script using Violentmonkey or Tampermonkey.

It automatically detects video elements on YouTube pages and begins scanning every 250ms.

The YouTube-native Flashbank button (next to Like/Dislike) opens a settings panel:

Enable/disable script

Show/hide overlay

Toggle debug canvas

Adjust threshold

Toggle console logging

All settings are saved in localStorage and persist across sessions.

⚙️ Configuration
You can tweak detection behavior via script constants:


const DETECT_MODE = 'bright'; // 'bright' or 'gray'
const BRIGHT_THRESHOLD = 240;
const GRAY_TARGET = 80;
const TOLERANCE = 10;
const THRESHOLD_PERCENT = 55;
Use 'gray' mode to detect dark (gray) flashes instead of bright ones.

Adjust THRESHOLD_PERCENT to fine-tune sensitivity.

Modify BRIGHT_THRESHOLD or GRAY_TARGET for different light/dark detection cutoffs.

MIT Licensed.
Designed with comfort in mind.