Build This Life-Changing Chrome Extension: "Focus Mode for YouTube"
π₯ Ever opened YouTube for "just one video" and emerged hours later, wondering where your day went? You're not alone. YouTube's addictive algorithm costs the average user 11,000 hours of their life. Yet no popular extension solves the core problem: intentional viewing.
Introducing "Focus Mode for YouTube"βan extension I'm shocked doesn't exist yet. It transforms YouTube from a time-sink into a focused learning tool, and today I'll show you exactly how to build it.
Why This Extension Will Change Lives
β The Problem:
- Endless autoplay sucks you into rabbit holes
- Distracting recommendations hijack your attention
- Comments/suggestions trigger emotional engagement
β The Solution:
Focus Mode gives granular control:
- Pause autoplay after your target video
- Hide recommendations until you choose to see them
- Block comments during focused sessions
- Set time budgets (e.g., "30 mins of cat videos")
Real impact: Students, professionals, and creators report 2-4 hours DAILY productivity gain with similar manual hacks.
Step-by-Step: Building Focus Mode for YouTube
π File Structure
focus-mode-extension/
βββ manifest.json
βββ popup.html
βββ popup.js
βββ background.js
βββ content.js
βββ icons/
βββ styles/
βββ popup.css
βββ youtube-override.css
1. Manifest Setup (manifest.json)
{
"manifest_version": 3,
"name": "Focus Mode for YouTube",
"version": "1.0",
"description": "Take back control of your YouTube time",
"icons": { ... },
"permissions": ["storage", "activeTab", "scripting"],
"host_permissions": ["*://*.youtube.com/*"],
"background": {
"service_worker": "background.js"
},
"action": {
"default_popup": "popup.html"
},
"content_scripts": [
{
"matches": ["*://*.youtube.com/*"],
"css": ["styles/youtube-override.css"],
"js": ["content.js"]
}
]
}
2. Content Script - Modify YouTube (content.js)
Core functionality in 15 lines:
// Listen for settings from popup
chrome.storage.sync.get(['hideRecs', 'pauseAutoplay'], (settings) => {
if (settings.hideRecs) hideRecommendations();
if (settings.pauseAutoplay) disableAutoplay();
});
function hideRecommendations() {
// Hide sidebar and end-screen recommendations
document.querySelector('#secondary').style.display = 'none';
document.querySelector('#related').style.display = 'none';
}
function disableAutoplay() {
// Toggle off autoplay switch
const autoplayToggle = document.querySelector('.ytp-autonav-toggle-button');
if (autoplayToggle?.ariaChecked === 'true') autoplayToggle.click();
}
3. Popup Control Center (popup.html)
<div class="container">
<h1>Focus Mode π―</h1>
<div class="switch">
<label>
<input type="checkbox" id="hideRecs">
Hide recommendations
</label>
</div>
<div class="switch">
<label>
<input type="checkbox" id="pauseAutoplay">
Pause autoplay
</label>
</div>
<div class="time-budget">
<label>Time budget (minutes):</label>
<input type="number" id="timeBudget" min="1" value="30">
</div>
<button id="applyBtn">Apply Settings</button>
</div>
4. CSS Overrides (youtube-override.css)
Remove distracting elements:
/* Hide recommendations */
#secondary, #related, #comments {
display: none !important;
}
/* Simplify player page */
#masthead-container, #below {
opacity: 0.3;
transition: opacity 0.3s;
}
#masthead-container:hover, #below:hover {
opacity: 1;
}
5. Time Budget Feature (background.js)
Gentle nudge when time expires:
chrome.alarms.create('timeCheck', { periodInMinutes: 1 });
chrome.alarms.onAlarm.addListener((alarm) => {
if (alarm.name === 'timeCheck') {
chrome.storage.sync.get(['timeBudget', 'startTime'], (data) => {
if (data.startTime) {
const elapsed = (Date.now() - data.startTime) / 60000;
if (elapsed >= data.timeBudget) {
chrome.tabs.query({url: "*://*.youtube.com/*"}, (tabs) => {
tabs.forEach(tab => {
chrome.tabs.sendMessage(tab.id, {action: "timeUp"});
});
});
}
}
});
}
});
Why This Is a Million-Dollar Idea
π Unique Value Proposition
Psychological insight:
- Doesn't block YouTube (which triggers reactance)
- Uses "friction design" to encourage intentionality
Monetization-ready:
- Premium features: Focus analytics, schedule blocking
- Sponsorships from learning platforms (Coursera, Brilliant)
Virality potential:
- Shareable focus reports ("I saved 7h this week!")
- Workspaces/teams version
Key Takeaways & Next Steps
β
You just built a life-changing tool in under 100 lines of code!
β
Core techniques learned:
- Modify existing websites
- Sync settings across sessions
- Create UX-friendly toggles
π Enhance it further:
- Add Whitelisted Channels exception
- Implement Daily Focus Reports
- Build a "Deep Work Mode" (full-screen minimal player)
This isn't just another extensionβit's a digital wellbeing revolution. Be the hero who builds it!
Will you ship it? Tag #FocusModeYT when you do! π
Projects to explore next
Source-code projects from the KritiMyantra catalogue. Check each project's details before buying.
Flask Authentication System (Free Version) - Kritim Yantra
π Featuresβ Google & GitHub Authenticationβ User Registration & Loginβ Profile/Dashboard Accessβ Secure & Mi...
Flask Blog CMS with Admin Dashboard β Python Source Code
A Flask-based blogging website with a built-in admin dashboard. Manage articles, images, categories, tags and featured p...
Laravel 12 + ReactJS Starter Kit: Add Multi-Language Support (Arabic, English, Spanish) with Blog CRUD
π Installation & Setup Download & Extract Get the ZIP from kritimyantra.com and extract it. Includes preconfigu...
Comments
No comments yet. Be the first to comment.
Sign in to join the discussion.