A Chrome extension that blocks video progress spoilers on YouTube by limiting how much of the progress bar is visible.
- Hide video ending: Blocks the progress bar from revealing how much time is left in a video
- Two threshold modes:
- Percentage-based: Hide the last X% of the video (e.g., last 30%)
- Time-based: Hide the last X minutes of the video (e.g., last 10 minutes)
- Visual marker: Shows where the blocking starts with a 🔒 marker on the progress bar
- Real-time updates: Settings changes apply immediately without page refresh
- Auto-save: Settings are automatically saved as you change them
- Chapter support: Works with videos that have multiple chapters
- Clone or download this repository
- Open Chrome and go to
chrome://extensions/ - Enable "Developer mode" (top right toggle)
- Click "Load unpacked" and select the extension folder
- The extension icon will appear in your toolbar
Click the extension icon in your browser toolbar to open the settings popup:
- Percentage mode: Hide the last X% of the video
- Time mode: Hide the last X minutes of the video
- Settings are auto-saved as you change them
On the YouTube video player, you can toggle the extension on/off using the clock button in the control bar:
-
Blue icon: Extension is ON
-
White icon: Extension is OFF
-
Everything after the 🔒 marker is hidden
-
The progress bar, buffer indicator, and scrubber will not go past this point
YouTube's video player uses a complex DOM structure for the progress bar. This extension intercepts and modifies the following elements:
.ytp-progress-bar
├── .ytp-chapters-container
│ └── .ytp-chapter-hover-container (one per chapter)
│ └── .ytp-progress-list
│ ├── .ytp-play-progress ← Red played portion (scaleX controlled)
│ ├── .ytp-load-progress ← Gray buffered portion (scaleX controlled)
│ └── .ytp-hover-progress ← Light hover indicator (scaleX controlled)
└── .ytp-scrubber-container ← Draggable red dot (translateX controlled)
YouTube uses CSS transform: scaleX(value) to show progress, where:
scaleX(0)= 0% filledscaleX(1)= 100% filled
This extension uses a MutationObserver to watch for style changes on progress elements and enforces a maximum scaleX value:
// For chapters BEFORE the clip point: no restriction
// For the chapter AT the clip point: maxScaleX = (clipTime - chapterStart) / chapterDuration
// For chapters AFTER the clip point: scaleX(0)The red dot (scrubber) position is controlled via transform: translateX(Xpx). The extension limits its maximum position to the clip point.
Videos with chapters have multiple .ytp-chapter-hover-container elements. The extension:
- Calculates each chapter's time range based on its width relative to total progress bar width
- Determines which chapters are before, at, or after the clip point
- Applies appropriate restrictions to each chapter independently
The video duration display is hidden via CSS:
.ytp-time-duration,
.ytp-time-separator {
opacity: 0 !important;
}| File | Description |
|---|---|
manifest.json |
Extension configuration and permissions |
content.js |
Main logic - injects into YouTube pages |
popup.html |
Settings UI |
popup.js |
Settings handling and messaging |
styles.css |
Additional styles |
| Setting | Description | Default |
|---|---|---|
| Threshold Mode | Choose between percentage or time-based hiding | Percentage |
| Percentage | Hide last X% of video | 30% |
| Time | Hide last X minutes of video | 10 min |
The extension uses Chrome's messaging API to communicate between popup and content script:
// Popup → Content Script
chrome.tabs.sendMessage(tabId, {
type: 'SETTINGS_UPDATED',
settings: { thresholdMode, percentageThreshold, timeThreshold, enabled }
});
// Content Script receives and applies changes without page reload
chrome.runtime.onMessage.addListener((message) => {
if (message.type === 'SETTINGS_UPDATED') {
// Update settings and reapply
}
});- Chrome (Manifest V3)
- Edge (Chromium-based)
- The extension relies on YouTube's DOM structure. If YouTube changes their player significantly, updates may be needed.
- For videos without chapters, the entire progress bar is treated as one segment.
- Live streams are not supported (no defined duration).
The extension logs its actions to the browser console with the prefix [Spoiler Blocker]:
[Spoiler Blocker] New video detected
[Spoiler Blocker] Video ready, duration: 1660.861s
[Spoiler Blocker] Progress bar ready, width: 538px, chapters: 10
[Spoiler Blocker] Duration: 1660.861s, Clip Point: 1060.861s (63.9%)
[Spoiler Blocker] Chapter 0: 0.0s - 35.0s, maxScaleX: 1.000, after: false, before: true
...
[Spoiler Blocker] Setup completed
- Open a YouTube video with chapters
- Open browser DevTools (F12)
- Watch the console for
[Spoiler Blocker]logs - Verify the progress bar stops at the marker point
MIT License

