Kritim Yantra
Jun 14, 2025
π₯ 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.
Focus Mode gives granular control:
Real impact: Students, professionals, and creators report 2-4 hours DAILY productivity gain with similar manual hacks.
focus-mode-extension/
βββ manifest.json
βββ popup.html
βββ popup.js
βββ background.js
βββ content.js
βββ icons/
βββ styles/
βββ popup.css
βββ youtube-override.css
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"]
}
]
}
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();
}
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>
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;
}
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"});
});
});
}
}
});
}
});
Psychological insight:
Monetization-ready:
Virality potential:
β
You just built a life-changing tool in under 100 lines of code!
β
Core techniques learned:
π Enhance it further:
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! π
Transform from beginner to Laravel expert with our personalized Coaching Class starting June 21, 2025. Limited enrollment ensures focused attention.
1-hour personalized coaching
Build portfolio applications
Industry-standard techniques
Interview prep & job guidance
Complete your application to secure your spot
Thank you for your interest in our Laravel mentorship program. We'll contact you within 24 hours with next steps.
No comments yet. Be the first to comment!
Please log in to post a comment:
Sign in with Google