New:Socket for Asana Is Now Available.Learn more
Get Started

YT Focus — Hide Shorts, Feeds & Distractions

Package Overview
Versions
1
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yt-focus@local - firefox Package Compare versions

Comparing version
4.3
to
4.4
+1
-1
manifest.json
{
"manifest_version": 2,
"name": "YT Focus",
"version": "4.3",
"version": "4.4",
"description": "Declutter YouTube your way: Shorts, comments, recommendations, ads, clickbait \u2014 every filter is a toggle. Timed pause, playback defaults, right-click channel muting. Also mutes Spotify web-player ads.",

@@ -6,0 +6,0 @@ "icons": {

@@ -81,5 +81,6 @@ // YT Focus — Spotify content script (open.spotify.com).

function tick() {
const isAd = adPlaying();
const active = currentSettings.enabled && currentSettings.spotifyMuteAds;
if (active && adPlaying()) {
if (active && isAd) {
if (!adMuted) {

@@ -96,15 +97,52 @@ adMuted = true;

hideAdUI();
hideAdUI(isAd);
}
// ── Visual ad units ──
// Two layers:
// 1. AD_UI_SELECTOR — elements that are ALWAYS ad units (ad testids, ad
// network iframes). Hidden whenever the setting is on.
// 2. Break-only surfaces — the right-sidebar panel ("Your music will
// continue after the break" + Learn more card) and the now-playing
// widget carry NO ad-specific markup during a break; the ad renders
// as ordinary panel content. They can only be hidden POSITIONALLY
// while an ad is detected, via a root class + injected CSS, and are
// restored the moment the break ends.
const AD_UI_SELECTOR = [
'[data-testid="ad-slot"]',
'[data-testid*="advert"]',
'[data-testid*="AdSlot"]',
'iframe[src*="doubleclick.net"]',
'iframe[src*="adform"]',
'iframe[src*="googlesyndication"]',
].join(',');
function hideAdUI() {
const BREAK_CLASS = 'ytf-spotify-ad-break';
const BREAK_SURFACES = [
'[data-testid="right-sidebar"]',
'[data-testid="NPV_Panel"]',
'#Desktop_PanelContainer_Id',
'[data-testid="now-playing-widget"]',
];
// visibility (not display) so the layout doesn't jump when the break ends.
const BREAK_CSS = BREAK_SURFACES
.map(s => 'html.' + BREAK_CLASS + ' ' + s)
.join(',') + '{visibility:hidden !important;}';
let breakStyleEl = null;
function ensureBreakStyle() {
if (breakStyleEl && breakStyleEl.isConnected) return;
breakStyleEl = document.createElement('style');
breakStyleEl.textContent = BREAK_CSS;
// documentElement, not head: head may not exist at document_start, and
// Spotify never rewrites the root, so the style survives SPA renders.
document.documentElement.appendChild(breakStyleEl);
}
function hideAdUI(isAd) {
const active = currentSettings.enabled && currentSettings.spotifyHideAdUI;
ensureBreakStyle();
document.documentElement.classList.toggle(BREAK_CLASS, active && isAd);
document.querySelectorAll(AD_UI_SELECTOR).forEach(el => {

@@ -111,0 +149,0 @@ if (active) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet