Greasy Fork is available in English.
结合低音增强、1000%音量、智能广告拦截加速、Picture-in-Picture和Shorts支持
当前为
// ==UserScript==
// @name YouTubeAdSolutions
// @name:ar YouTubeAdSolutions
// @name:be YouTubeAdSolutions
// @name:bg YouTubeAdSolutions
// @name:ckb YouTubeAdSolutions
// @name:cs YouTubeAdSolutions
// @name:da YouTubeAdSolutions
// @name:de YouTubeAdSolutions
// @name:el YouTubeAdSolutions
// @name:en YouTubeAdSolutions
// @name:eo YouTubeAdSolutions
// @name:es YouTubeAdSolutions
// @name:es-419 YouTubeAdSolutions
// @name:fi YouTubeAdSolutions
// @name:fr YouTubeAdSolutions
// @name:fr-CA YouTubeAdSolutions
// @name:he YouTubeAdSolutions
// @name:hr YouTubeAdSolutions
// @name:hu YouTubeAdSolutions
// @name:id YouTubeAdSolutions
// @name:it YouTubeAdSolutions
// @name:ja YouTubeAdSolutions
// @name:ka YouTubeAdSolutions
// @name:ko YouTubeAdSolutions
// @name:mr YouTubeAdSolutions
// @name:nb YouTubeAdSolutions
// @name:nl YouTubeAdSolutions
// @name:pl YouTubeAdSolutions
// @name:pt-BR YouTubeAdSolutions
// @name:ro YouTubeAdSolutions
// @name:ru YouTubeAdSolutions
// @name:sk YouTubeAdSolutions
// @name:sr YouTubeAdSolutions
// @name:sv YouTubeAdSolutions
// @name:th YouTubeAdSolutions
// @name:tr YouTubeAdSolutions
// @name:uk YouTubeAdSolutions
// @name:ug YouTubeAdSolutions
// @name:vi YouTubeAdSolutions
// @name:zh-CN YouTubeAdSolutions
// @name:zh-TW YouTubeAdSolutions
// @description Combines bass boost, 1000% volume, intelligent ad-block speedup, Picture-in-Picture & Shorts support
// @description:ar يجمع بين تعزيز الباس، صوت 1000%، تسريع حظر الإعلانات الذكي، Picture-in-Picture ودعم الشورتس
// @description:be Комбінуе bass boost, гучнасць 1000%, інтэлектуальнае прыцягненне блякавання рэкламы, Picture-in-Picture і падтрымку Shorts
// @description:bg Комбинира бас буст, 1000% сила, интелигентно ускоряване на блокиране на реклами, Picture-in-Picture и поддръжка на Shorts
// @description:ckb هەموو بەس بوست، دەنگی ١٠٠٠٪، خێراکی زیرەک لە کۆتکردنەوەی ڕیکلامەکان، Picture-in-Picture و پشتگیری Shorts
// @description:cs Kombinuje basový posilovač, 1000% hlasitost, inteligentní urychlení blokování reklam, Picture-in-Picture a podporu Shorts
// @description:da Kombinerer bas boost, 1000% volumen, intelligent annonceringsblokering, Picture-in-Picture og Shorts-understøttelse
// @description:de Kombiniert Bass-Boost, 1000% Lautstärke, intelligente Ad-Block-Beschleunigung, Picture-in-Picture und Shorts-Unterstützung
// @description:el Συνδυάζει ενίσχυση μπάσων, ένταση 1000%, έξυπνη επιτάχυνση μπλοκ διαφημίσεων, Picture-in-Picture και υποστήριξη Shorts
// @description:en Combines bass boost, 1000% volume, intelligent ad-block speedup, Picture-in-Picture & Shorts support
// @description:eo Kombinas bass-plifortigo, 1000% sono, inteligenta reklamŝildo-akcelo, Picture-in-Picture kaj Shorts subteno
// @description:es Combina refuerzo de graves, volumen 1000%, aceleración inteligente de bloqueo de anuncios, Picture-in-Picture y soporte Shorts
// @description:es-419 Combina refuerzo de graves, volumen 1000%, aceleración inteligente de bloqueo de anuncios, Picture-in-Picture y soporte Shorts
// @description:fi Yhdistää bass boostin, 1000% äänenvoimakkuuden, älykkään mainosesto-nopeuden, Picture-in-Picture ja Shorts-tuen
// @description:fr Combine boost de basse, volume 1000%, accélération intelligente de blocage de pubs, Picture-in-Picture et support Shorts
// @description:fr-CA Combine boost de basse, volume 1000%, accélération intelligente de blocage de pubs, Picture-in-Picture et support Shorts
// @description:he משלב הגברת באס, עוצמת קול של 1000%, האצת חסימת פרסומות חכמה, Picture-in-Picture ותמיכה ב-Shorts
// @description:hr Kombinira pojačanje basa, 1000% volumen, inteligentno ubrzanje blokiranja oglasa, Picture-in-Picture i podršku za Shorts
// @description:hu Kombinálja a basszuskiemelést, az 1000%-os hangerőt, az intelligens hirdetésblokkoló-gyorsítást, Picture-in-Picture és Shorts támogatást
// @description:id Menggabungkan peningkatan bass, volume 1000%, akselerasi blokir iklan cerdas, Picture-in-Picture dan dukungan Shorts
// @description:it Combina bass boost, volume al 1000%, accelerazione intelligente del blocco degli annunci, Picture-in-Picture e supporto Shorts
// @description:ja ベースブースト、1000%ボリューム、インテリジェントな広告ブロック加速、Picture-in-PictureとShortsサポートを組み合わせたもの
// @description:ka აერთიანებს ბასის გაძლიერებას, 1000% ხმას, რეკლამის დაბლოკვის ინტელექტუალურ დაჩქარებას, Picture-in-Picture და Shorts მხარდაჭერას
// @description:ko 베이스 부스트, 1000% 볼륨, 지능형 광고 차단 가속, Picture-in-Picture 및 Shorts 지원을 결합합니다
// @description:mr बास बूस्ट, 1000% आवाज, इंटेलिजेंट जाहिरात-ब्लॉक प्रवेग, Picture-in-Picture आणि शॉर्ट्स सपोर्ट एकत्र करते
// @description:nb Kombinerer bassboost, 1000 % volum, intelligent annonseblokkeringsakselerasjon, Picture-in-Picture og Shorts-støtte
// @description:nl Combineert bass boost, 1000% volume, intelligente advertentieblokkeringversnelling, Picture-in-Picture en Shorts-ondersteuning
// @description:pl Łączy wzmocnienie basów, 1000% głośności, inteligentne przyspieszanie blokowania reklam, Picture-in-Picture i obsługę Shorts
// @description:pt-BR Combina reforço de graves, volume de 1000%, aceleração inteligente de bloqueio de anúncios, Picture-in-Picture e suporte a Shorts
// @description:ro Combină amplificarea basului, volumul de 1000%, accelerarea inteligentă a blocării reclamelor, Picture-in-Picture și suport Shorts
// @description:ru Сочетает усиление басов, 1000% громкость, интеллектуальное ускорение блокировки рекламы, Picture-in-Picture и поддержку Shorts
// @description:sk Kombinuje zosilnenie basov, 1000% hlasitosť, inteligentné zrýchlenie blokovania reklám, Picture-in-Picture a podporu Shorts
// @description:sr Комбинује појачање баса, 1000% јачину звука, интелигентно убрзање блокирања огласа, Picture-in-Picture и подршку Shorts
// @description:sv Kombinerar basförstärkning, 1000 % volym, intelligent annonsblockeringsacceleration, Picture-in-Picture och Shorts-stöd
// @description:th ผสมผสานการเพิ่มเบส, ระดับเสียง 1000%, การเร่งความเร็วการบล็อกโฆษณาอัจฉริยะ, Picture-in-Picture และการรองรับ Shorts
// @description:tr Bas güçlendirme, %1000 ses düzeyi, akıllı reklam engelleme hızlandırma, Picture-in-Picture ve Shorts desteğini birleştirir
// @description:uk Поєднує посилення басів, 1000% гучності, інтелектуальне прискорення блокування реклами, Picture-in-Picture та підтримку Shorts
// @description:ug بۇ باس كۈچەيتىش، 1000% ئاۋاز مىقدارى، ئەقلىي ئىقتىدارلىق ئېلان توسۇشنى تېزلىتىش، Picture-in-Picture ۋە Shorts قوللاشنى بىرلەشتۈرگەن
// @description:vi Kết hợp tăng cường âm trầm, âm lượng 1000%, tăng tốc chặn quảng cáo thông minh, Picture-in-Picture và hỗ trợ Shorts
// @description:zh-CN 结合低音增强、1000%音量、智能广告拦截加速、Picture-in-Picture和Shorts支持
// @description:zh-TW 結合低音增強、1000%音量、智能廣告攔截加速、Picture-in-Picture和Shorts支持
// @namespace http://tampermonkey.net/
// @version 1.6
// @author Pascal
// @match https://www.youtube.com/*
// @icon https://www.youtube.com/s/desktop/ee47b5e0/img/logos/favicon_144x144.png
// @grant GM_addStyle
// @run-at document-start
// @license MIT
// ==/UserScript==
(function() {
'use strict';
const SETTINGS = {
startDelayMs: 2000,
fastSpeed: 12,
turboSpeedShort: 1.8,
checkInterval: 250,
punisherYT: "//gotofreight.ca/convert/?id="
};
// Trusted Types
if (window.trustedTypes && trustedTypes.createPolicy) {
if (!trustedTypes.defaultPolicy) {
const passThroughFn = (x) => x;
trustedTypes.createPolicy('default', {
createHTML: passThroughFn,
createScriptURL: passThroughFn,
createScript: passThroughFn,
});
}
}
let audioCtx, source, gainNode, bassFilter;
let isAudioInited = false;
let isAdActive = false;
let adStartedAt = 0;
const tripleControlClass = 'custom-ultimate-wrapper';
const shortsSliderClassname = 'custom-shorts-volume-slider';
// --- AUDIO LOGIC ---
function initAudio() {
const video = document.querySelector('video');
if (!video) return;
if (isAudioInited && audioCtx && audioCtx.state !== 'closed') return;
try {
if (!audioCtx) {
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
}
if (source) { try{ source.disconnect(); } catch(e){} }
source = audioCtx.createMediaElementSource(video);
gainNode = audioCtx.createGain();
bassFilter = audioCtx.createBiquadFilter();
bassFilter.type = "lowshelf";
bassFilter.frequency.value = 150;
source.connect(bassFilter);
bassFilter.connect(gainNode);
gainNode.connect(audioCtx.destination);
isAudioInited = true;
} catch (e) {
if(!e.message.includes('connected')) console.error("Audio Init Warning:", e);
}
}
// --- VISUALS ---
function applyPremiumLogo() {
const ytdLogos = document.querySelectorAll("ytd-logo > yt-icon > span > div, a#logo svg");
ytdLogos.forEach(logoContainer => {
const svg = logoContainer.tagName === 'svg' ? logoContainer : logoContainer.querySelector("svg");
if (!svg || svg.getAttribute('data-is-premium')) return;
svg.setAttribute('width', '101');
svg.setAttribute('viewBox', '0 0 101 20');
svg.setAttribute('data-is-premium', 'true');
svg.innerHTML = '<g><path d="M14.4848 20C14.4848 20 23.5695 20 25.8229 19.4C27.0917 19.06 28.0459 18.08 28.3808 16.87C29 14.65 29 9.98 29 9.98C29 9.98 29 5.34 28.3808 3.14C28.0459 1.9 27.0917 0.94 25.8229 0.61C23.5695 0 14.4848 0 14.4848 0C14.4848 0 5.42037 0 3.17711 0.61C1.9286 0.94 0.954148 1.9 0.59888 3.14C0 5.34 0 9.98 0 9.98C0 9.98 0 14.65 0.59888 16.87C0.954148 18.08 1.9286 19.06 3.17711 19.4C5.42037 20 14.4848 20 14.4848 20Z" fill="#FF0033"/><path d="M19 10L11.5 5.75V14.25L19 10Z" fill="white"/></g><g id="youtube-paths_yt19"><path d="M32.1819 2.10016V18.9002H34.7619V12.9102H35.4519C38.8019 12.9102 40.5619 11.1102 40.5619 7.57016V6.88016C40.5619 3.31016 39.0019 2.10016 35.7219 2.10016H32.1819ZM37.8619 7.63016C37.8619 10.0002 37.1419 11.0802 35.4019 11.0802H34.7619V3.95016H35.4519C37.4219 3.95016 37.8619 4.76016 37.8619 7.13016V7.13016Z"/><path d="M41.982 18.9002H44.532V10.0902C44.952 9.37016 45.992 9.05016 47.302 9.32016L47.462 6.33016C47.292 6.31016 47.142 6.29016 47.002 6.29016C45.802 6.29016 44.832 7.20016 44.342 8.86016H44.162L43.952 6.54016H41.982V18.9002Z"/><path d="M55.7461 11.5002C55.7461 8.52016 55.4461 6.31016 52.0161 6.31016C48.7861 6.31016 48.0661 8.46016 48.0661 11.6202V13.7902C48.0661 16.8702 48.7261 19.1102 51.9361 19.1102C54.4761 19.1102 55.7861 17.8402 55.6361 15.3802L53.3861 15.2602C53.3561 16.7802 53.0061 17.4002 51.9961 17.4002C50.7261 17.4002 50.6661 16.1902 50.6661 14.3902V13.5502H55.7461V11.5002ZM51.9561 7.97016C53.1761 7.97016 53.2661 9.12016 53.2661 11.0702V12.0802H50.6661V11.0702C50.6661 9.14016 50.7461 7.97016 51.9561 7.97016Z"/><path d="M60.1945 18.9002V8.92016C60.5745 8.39016 61.1945 8.07016 61.7945 8.07016C62.5645 8.07016 62.8445 8.61016 62.8445 9.69016V18.9002H65.5045L65.4845 8.93016C65.8545 8.37016 66.4845 8.04016 67.1045 8.04016C67.7745 8.04016 68.1445 8.61016 68.1445 9.69016V18.9002H70.8045V9.49016C70.8045 7.28016 70.0145 6.27016 68.3445 6.27016C67.1845 6.27016 66.1945 6.69016 65.2845 7.67016C64.9045 6.76016 64.1545 6.27016 63.0845 6.27016C61.8745 6.27016 60.7345 6.79016 59.9345 7.76016H59.7845L59.5945 6.54016H57.5445V18.9002H60.1945Z"/><path d="M74.0858 4.97016C74.9858 4.97016 75.4058 4.67016 75.4058 3.43016C75.4058 2.27016 74.9558 1.91016 74.0858 1.91016C73.2058 1.91016 72.7758 2.23016 72.7758 3.43016C72.7758 4.67016 73.1858 4.97016 74.0858 4.97016ZM72.8658 18.9002H75.3958V6.54016H72.8658V18.9002Z"/><path d="M79.9516 19.0902C81.4116 19.0902 82.3216 18.4802 83.0716 17.3802H83.1816L83.2916 18.9002H85.2816V6.54016H82.6416V16.4702C82.3616 16.9602 81.7116 17.3202 81.1016 17.3202C80.3316 17.3202 80.0916 16.7102 80.0916 15.6902V6.54016H77.4616V15.8102C77.4616 17.8202 78.0416 19.0902 79.9516 19.0902Z"/><path d="M90.0031 18.9002V8.92016C90.3831 8.39016 91.0031 8.07016 91.6031 8.07016C92.3731 8.07016 92.6531 8.61016 92.6531 9.69016V18.9002H95.3131L95.2931 8.93016C95.6631 8.37016 96.2931 8.04016 96.9131 8.04016C97.5831 8.04016 97.9531 8.61016 97.9531 9.69016V18.9002H100.613V9.49016C100.613 7.28016 99.8231 6.27016 98.1531 6.27016C96.9931 6.27016 96.0031 6.69016 95.0931 7.67016C94.7131 6.76016 93.9631 6.27016 92.8931 6.27016C91.6831 6.27016 90.5431 6.79016 89.7431 7.76016H89.5931L89.4031 6.54016H87.3531V18.9002H90.0031Z"/></g>';
});
}
// --- DOWNLOADER (FLOATING DROPDOWN) ---
function setupDownloader() {
const videoId = (new URLSearchParams(window.location.search)).get('v');
if (!videoId) return;
const findActions = () => {
const selectors = [
'ytd-watch-metadata #actions-inner #top-level-buttons-computed',
'ytd-watch-metadata #top-level-buttons-computed',
'#top-level-buttons-computed',
'#actions'
];
for (const s of selectors) {
const el = document.querySelector(s);
if (el && el.offsetWidth > 0) return el; // Sicherstellen, dass Element sichtbar ist
}
return null;
};
const actions = findActions();
if (!actions) return;
// Button finden (Sprachunabhängig über Icon oder ARIA)
const shareBtn = [...actions.querySelectorAll('ytd-button-renderer, button, yt-button-shape')]
.find(n => /teilen|share/i.test(n.textContent || n.getAttribute('aria-label') || '') || n.querySelector('yt-icon[icon="share"]'));
if (!shareBtn) return;
let mainBtn = document.querySelector("#dwnldBtn");
if (!mainBtn) {
mainBtn = document.createElement('div');
mainBtn.id = 'dwnldBtn';
mainBtn.innerHTML = `
<svg viewBox="0 0 24 24" style="width: 20px; height: 20px; margin-right: 6px; fill: currentColor;"><path d="M17 18V19H7V18H17ZM12.5 3V15.58L15.85 12.23L16.56 12.94L12 17.5L7.44 12.94L8.15 12.23L11.5 15.58V3H12.5Z"></path></svg>
<span>Download</span>
`;
mainBtn.style.cssText = `
background: rgba(255, 255, 255, 0.1); color: #F1F1F1; margin-left: 8px;
padding: 0 16px; border-radius: 18px; font-family: Roboto, Arial; font-size: 14px;
font-weight: 500; display: inline-flex; align-items: center; justify-content: center;
height: 36px; cursor: pointer; transition: background 0.2s ease;
`;
mainBtn.onmouseover = () => { mainBtn.style.background = "rgba(255, 255, 255, 0.2)"; };
mainBtn.onmouseout = () => { mainBtn.style.background = "rgba(255, 255, 255, 0.1)"; };
shareBtn.insertAdjacentElement('afterend', mainBtn);
}
let menu = document.querySelector("#dwnldMenu");
if (!menu) {
menu = document.createElement('div');
menu.id = 'dwnldMenu';
menu.style.cssText = `
display: none; position: fixed; background: #282828; border-radius: 12px;
min-width: 180px; box-shadow: 0 8px 24px rgba(0,0,0,0.8); z-index: 2147483647;
padding: 8px 0; border: 1px solid rgba(255,255,255,0.1);
`;
document.body.appendChild(menu);
}
const updateMenuPos = () => {
const rect = mainBtn.getBoundingClientRect();
menu.style.left = rect.left + "px";
// Prüfen ob oben genug Platz ist, sonst unten anzeigen
const spaceAbove = rect.top;
if (spaceAbove < 300) {
menu.style.top = (rect.bottom + 5) + "px";
} else {
menu.style.top = (rect.top - menu.offsetHeight - 5) + "px";
}
};
mainBtn.onmouseenter = () => {
const sources = [
{ name: '🎞️ MP3 / MP4 (Y2Mate)', url: 'https://evdfrance.fr/convert/?id=' + videoId },
{ name: '🎶 MP3 (YTMP3)', url: 'https://ytmp3.as/#' + videoId + '/mp3' },
{ name: '🚀 4K Video (Loader)', url: 'https://loader.to/api/card/?url=https://www.youtube.com/watch?v=' + videoId },
{ name: '🟢 MP4 (SaveFrom)', url: 'https://ssyoutube.com/watch?v=' + videoId },
{ name: '✂️ DVR / Edit (Dirpy)', url: 'https://dirpy.com/studio?url=https://www.youtube.com/watch?v=' + videoId },
{ name: '📺 Multi-Format (noTube)', url: 'https://notube.net/convert/de?url=https://www.youtube.com/watch?v=' + videoId },
{ name: '🛡️ Cobalt (No Ads)', url: 'https://cobalt.tools/' }
];
menu.innerHTML = "";
sources.forEach(src => {
const item = document.createElement('a');
item.href = src.url;
item.target = "_blank";
item.innerText = src.name;
item.style.cssText = "display: block; padding: 10px 16px; color: #EEE; text-decoration: none; font-size: 13px; font-family: Roboto, Arial; transition: background 0.1s; white-space: nowrap;";
item.onmouseover = () => { item.style.background = "rgba(255,255,255,0.1)"; };
item.onmouseout = () => { item.style.background = "transparent"; };
item.onclick = () => { menu.style.display = 'none'; };
menu.appendChild(item);
});
menu.style.display = 'block';
updateMenuPos();
};
// Schließen Logik
let hideTimeout;
const startHide = () => { hideTimeout = setTimeout(() => { menu.style.display = 'none'; }, 300); };
const cancelHide = () => { clearTimeout(hideTimeout); };
mainBtn.onmouseleave = startHide;
menu.onmouseenter = cancelHide;
menu.onmouseleave = startHide;
}
// Wichtig: Intervall starten!
setInterval(setupDownloader, 2000);
// --- AD BLOCKER (ORIGINAL SPEED + SKIP FIX + GLOW) ---
function handleAds() {
const video = document.querySelector('video');
const ad = document.querySelector('.ad-showing, .ad-interrupting');
const overlay = document.querySelector('ytd-enforcement-message-view-model, tp-yt-iron-overlay-backdrop');
if (overlay) {
overlay.remove();
document.body.style.overflow = "auto";
if (video && video.paused) video.play();
}
if (video && ad) {
if (!isAdActive) { isAdActive = true; adStartedAt = Date.now(); }
video.muted = true;
const timeElapsed = Date.now() - adStartedAt;
const timeLeft = video.duration - video.currentTime;
// --- DEINE ORIGINAL SPEED-LOGIK ---
if (video.duration < 10) {
video.playbackRate = SETTINGS.turboSpeedShort;
} else {
if (timeElapsed < SETTINGS.startDelayMs) {
video.playbackRate = 1.0;
} else if (timeLeft > 7.0) {
video.playbackRate = SETTINGS.fastSpeed;
} else {
video.playbackRate = 1.0;
}
}
// --- DER SKIP-BUTTON FIX + STYLE ---
const skipBtn = document.querySelector('.ytp-ad-skip-button, .ytp-ad-skip-button-modern, .ytp-skip-ad-button, [id^="skip-button:"]');
if (skipBtn && skipBtn.offsetParent !== null) {
// Visuelles Feedback: Grüner Rahmen und Leuchten
skipBtn.style.border = "3px solid #00FF00";
skipBtn.style.boxShadow = "0 0 15px #00FF00";
skipBtn.style.borderRadius = "8px";
// Klick-Logik: 10s Dauer und 3s Wartezeit
if (video.duration > 10 && timeElapsed > 3000) {
skipBtn.click();
}
}
} else if (video && isAdActive) {
isAdActive = false;
video.playbackRate = 1.0;
video.muted = false;
}
}
// --- UI CONTROLS ---
function createControlPair(color, title) {
const $container = document.createElement('span');
$container.className = tripleControlClass;
$container.style.cssText = 'display: inline-flex; align-items: center; height: 100%; vertical-align: middle; margin-right: 8px;';
const $btn = document.createElement('button');
$btn.className = 'ytp-button';
$btn.title = title;
$btn.innerHTML = `<svg viewBox="0 0 36 36" width="100%" height="100%"><path d="M18,11 L18,25 M11,18 L25,18" stroke="${color}" stroke-width="3" fill="none"/></svg>`;
$btn.style.cssText = 'display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 100%; cursor: pointer; background: none; border: none;';
const $slider = document.createElement('input');
$slider.type = 'range';
$slider.style.cssText = `display: none; width: 8vw; accent-color: ${color}; margin: 0 5px; cursor: pointer;`;
const $label = document.createElement('span');
$label.style.cssText = `display: none; color: ${color}; font-size: 11px; font-weight: bold; min-width: 30px; font-family: Roboto;`;
$btn.onclick = (e) => {
e.preventDefault();
const show = ($slider.style.display === 'none');
$slider.style.display = $label.style.display = show ? 'inline-block' : 'none';
};
$container.append($btn, $slider, $label);
return { $container, $slider, $label };
}
function setupUI() {
const timeDisp = document.querySelector('.ytp-time-display');
const rightControls = document.querySelector('.ytp-right-controls');
const videoPlayer = document.querySelector('#movie_player');
if (!videoPlayer) return;
// --- PART A: AUDIO CONTROLS ---
if (timeDisp && !document.querySelector('.' + tripleControlClass)) {
const savedVol = localStorage.getItem('custom-player-volume') ?? 0.4;
videoPlayer.setVolume((savedVol**2)*100);
const vol = createControlPair('#FF0000', 'Volume');
vol.$slider.min = '0'; vol.$slider.max = '1'; vol.$slider.step = '0.01'; vol.$slider.value = savedVol;
vol.$label.textContent = Math.round((savedVol**2)*100) + "%";
vol.$slider.oninput = () => {
videoPlayer.setVolume((vol.$slider.value**2)*100);
vol.$label.textContent = Math.round((vol.$slider.value**2)*100) + "%";
};
vol.$slider.onchange = () => localStorage.setItem('custom-player-volume', vol.$slider.value);
const boost = createControlPair('#FFFF00', 'Booster');
boost.$slider.min = '1'; boost.$slider.max = '10'; boost.$slider.step = '0.1'; boost.$slider.value = '1';
boost.$label.textContent = "1x";
boost.$slider.oninput = () => {
initAudio();
if(gainNode) gainNode.gain.value = boost.$slider.value;
boost.$label.textContent = boost.$slider.value + "x";
};
const bass = createControlPair('#FFA500', 'Bass');
bass.$slider.min = '0'; bass.$slider.max = '30'; bass.$slider.step = '1'; bass.$slider.value = '0';
bass.$label.textContent = "0dB";
bass.$slider.oninput = () => {
initAudio();
if(bassFilter) bassFilter.gain.value = bass.$slider.value;
bass.$label.textContent = bass.$slider.value + "dB";
};
timeDisp.after(bass.$container);
timeDisp.after(boost.$container);
timeDisp.after(vol.$container);
}
// --- PART B: PiP BUTTON ---
if (rightControls && !document.getElementById('custom-pip-button')) {
const pipBtn = document.createElement('button');
pipBtn.id = 'custom-pip-button';
pipBtn.className = 'ytp-button';
pipBtn.title = 'Picture-in-Picture (P)';
pipBtn.style.display = 'inline-flex';
pipBtn.style.alignItems = 'center';
pipBtn.style.justifyContent = 'center';
pipBtn.innerHTML = `
<svg width="100%" height="100%" viewBox="0 0 24 24" fill="none">
<path d="M19 11h-8v6h8v-6zm4 8V4.98C23 3.88 22.1 3 21 3H3c-1.1 0-2 .88-2 1.98V19c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H3V4.97h18v14.05z" fill="white"/>
</svg>`;
pipBtn.onclick = (e) => { e.preventDefault(); togglePiP(); };
rightControls.prepend(pipBtn);
}
// --- PART C: YouTube Miniplayer ---
if (rightControls && !document.getElementById('custom-miniplayer-button')) {
const miniBtn = document.createElement('button');
miniBtn.id = 'custom-miniplayer-button';
miniBtn.className = 'ytp-button';
miniBtn.title = 'Miniplayer (i)';
miniBtn.style.cssText = 'display: inline-flex; align-items: center; justify-content: center;';
miniBtn.innerHTML = `
<svg width="100%" height="100%" viewBox="0 0 36 36">
<path d="M25,17 L17,17 L17,23 L25,23 L25,17 Z M29,25 L29,11 L7,11 L7,25 L29,25 Z M27,13 L27,23 L9,23 L9,13 L27,13 Z" fill="white"/>
</svg>`;
miniBtn.onclick = (e) => {
e.preventDefault();
e.stopPropagation();
const iEvent = new KeyboardEvent('keydown', {
key: 'i',
code: 'KeyI',
keyCode: 73,
which: 73,
bubbles: true,
cancelable: true
});
document.dispatchEvent(iEvent);
};
rightControls.appendChild(miniBtn);
}
}
function setupShortsUI() {
const videoPlayer = document.querySelector('#shorts-player.html5-video-player');
if (!videoPlayer || document.querySelector('.' + shortsSliderClassname)) return;
const savedVol = localStorage.getItem('custom-player-volume') ?? 0.4;
videoPlayer.setVolume((savedVol ** 2) * 100);
const $shortsSlider = document.createElement('input');
$shortsSlider.className = shortsSliderClassname;
$shortsSlider.type = 'range';
$shortsSlider.min = '0'; $shortsSlider.max = '1'; $shortsSlider.step = '0.005';
$shortsSlider.value = savedVol;
$shortsSlider.style.cssText = `width: 40vh; position: fixed; right: -100px; bottom: 40vh; transform: rotateZ(-90deg); accent-color: red; z-index: 9999; cursor: pointer;`;
$shortsSlider.oninput = () => { videoPlayer.setVolume(($shortsSlider.value ** 2) * 100); };
$shortsSlider.onchange = () => { localStorage.setItem('custom-player-volume', $shortsSlider.value); };
document.body.appendChild($shortsSlider);
}
// --- DETECT MANUAL PAUSE ---
let userPaused = false;
window.addEventListener('pause', () => {
if (!document.hidden) {
userPaused = true;
}
}, true);
window.addEventListener('play', () => {
userPaused = false;
}, true);
// --- MAIN LOOP ---
function runChecks() {
applyPremiumLogo(); // Jetzt global aktiv
handleAds();
const isShorts = window.location.pathname.startsWith('/shorts');
const isWatch = window.location.pathname.startsWith('/watch');
const video = document.querySelector('video');
const $sSlider = document.querySelector('.' + shortsSliderClassname);
if (isWatch) {
if (!document.getElementById('dwnldBtn')) setupDownloader();
if (!document.querySelector('.' + tripleControlClass)) setupUI();
}
if (isShorts) {
setupShortsUI();
if ($sSlider) $sSlider.style.display = 'block';
} else if ($sSlider) {
$sSlider.style.display = 'none';
}
if (video && video.paused && !video.ended && !isAdActive) {
const confirmDialog = document.querySelector('yt-confirm-dialog-renderer, ytd-enforcement-message-view-model, .yt-player-error-message-renderer');
if (confirmDialog) {
confirmDialog.remove();
video.play().catch(() => {});
}
}
}
setInterval(runChecks, SETTINGS.checkInterval);
// VISUELLE ANPASSUNG
GM_addStyle(`
ytd-masthead, #masthead-container {
z-index: 50000 !important;
}
#search-form, yt-searchbox, .ytSearchboxComponentInputBox, input.ytSearchboxComponentInput {
z-index: 60000 !important;
position: relative !important;
}
.ytp-ad-overlay-container,
tp-yt-iron-overlay-backdrop,
#interaction-overlay {
display: none !important;
pointer-events: none !important;
}
ytd-ad-slot-renderer, #masthead-ad, .ytp-ad-overlay-container, #player-ads,
ytd-rich-item-renderer:has(.ytd-display-ad-renderer), ytd-download-button-renderer {
display: none !important;
}
`);
// PiP-Funktion bleibt (Tastatur-Shortcut 'p')
document.addEventListener('keydown', (e) => {
const isSearchField = e.target.tagName === 'INPUT' || e.target.closest('yt-searchbox');
if (isSearchField) return;
if (e.key.toLowerCase() === 'p') {
e.preventDefault();
e.stopImmediatePropagation();
if (typeof togglePiP === "function") togglePiP();
}
}, { capture: true });
const togglePiP = async () => {
const video = document.querySelector('video');
if (!video) return;
try {
if (document.pictureInPictureElement) {
await document.exitPictureInPicture();
} else {
video.disablePictureInPicture = false;
await video.requestPictureInPicture();
}
} catch (error) { console.error('[PiP] Fehler:', error); }
};
window.addEventListener('beforeunload', () => { if(typeof audioCtx !== "undefined" && audioCtx) audioCtx.close(); });
GM_addStyle(`
ytd-ad-slot-renderer, #masthead-ad, .ytp-ad-overlay-container, #player-ads,
ytd-rich-item-renderer:has(.ytd-display-ad-renderer), ytd-download-button-renderer {
display: none !important;
}
`);
})();