// ==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, and Shorts support.
// @description:ar يجمع بين تعزيز الباس، صوت 1000%، تسريع حظر الإعلانات الذكي، ودعم الشورتس.
// @description:be Комбінуе bass boost, гучнасць 1000%, інтэлектуальнае прыцягненне блякавання рэкламы і падтрымку Shorts.
// @description:bg Комбинира бас буст, 1000% сила, интелигентно ускоряване на блокиране на реклами и поддръжка на Shorts.
// @description:ckb هەموو بەس بوست، دەنگی ١٠٠٠٪، خێراکی زیرەک لە کۆتکردنەوەی ڕیکلامەکان، و پشتگیری Shorts.
// @description:cs Kombinuje basový posilovač, 1000% hlasitost, inteligentní urychlení blokování reklam a podporu Shorts.
// @description:da Kombinerer bas boost, 1000% volumen, intelligent annonceringsblokering og Shorts-understøttelse.
// @description:de Kombiniert Bass-Boost, 1000% Lautstärke, intelligente Ad-Block-Beschleunigung und Shorts-Unterstützung.
// @description:el Συνδυάζει ενίσχυση μπάσων, ένταση 1000%, έξυπνη επιτάχυνση μπλοκ διαφημίσεων και υποστήριξη Shorts.
// @description:en Combines bass boost, 1000% volume, intelligent ad-block speedup, and Shorts support.
// @description:eo Kombinas bass-plifortigo, 1000% sono, inteligenta reklamŝildo-akcelo, kaj Shorts subteno.
// @description:es Combina refuerzo de graves, volumen 1000%, aceleración inteligente de bloqueo de anuncios y soporte Shorts.
// @description:es-419 Combina refuerzo de graves, volumen 1000%, aceleración inteligente de bloqueo de anuncios y soporte Shorts.
// @description:fi Yhdistää bass boostin, 1000% äänenvoimakkuuden, älykkään mainosesto-nopeuden ja Shorts-tuen.
// @description:fr Combine boost de basse, volume 1000%, accélération intelligente de blocage de pubs et support Shorts.
// @description:fr-CA Combine boost de basse, volume 1000%, accélération intelligente de blocage de pubs et support Shorts.
// @description:he משלב הגברת באס, עוצמת קול של 1000%, האצת חסימת פרסומות חכמה ותמיכה ב-Shorts.
// @description:hr Kombinira pojačanje basa, 1000% volumen, inteligentno ubrzanje blokiranja oglasa i podršku za Shorts.
// @description:hu Kombinálja a basszuskiemelést, az 1000%-os hangerőt, az intelligens hirdetésblokkoló-gyorsítást és a Shorts támogatást.
// @description:id Menggabungkan peningkatan bass, volume 1000%, akselerasi blokir iklan cerdas, dan dukungan Shorts.
// @description:it Combina bass boost, volume al 1000%, accelerazione intelligente del blocco degli annunci e supporto per i Shorts.
// @description:ja ベースブースト、1000%ボリューム、インテリジェントな広告ブロック加速、Shortsサポートを組み合わせたもの。
// @description:ka აერთიანებს ბასის გაძლიერებას, 1000% ხმას, რეკლამის დაბლოკვის ინტელექტუალურ დაჩქარებას და Shorts მხარდაჭერას.
// @description:ko 베이스 부스트, 1000% 볼륨, 지능형 광고 차단 가속 및 Shorts 지원을 결합합니다.
// @description:mr बास बूस्ट, 1000% आवाज, इंटेलिजेंट जाहिरात-ब्लॉक प्रवेग आणि शॉर्ट्स सपोर्ट एकत्र करते.
// @description:nb Kombinerer bassboost, 1000 % volum, intelligent annonseblokkeringsakselerasjon og Shorts-støtte.
// @description:nl Combineert bass boost, 1000% volume, intelligente advertentieblokkeringversnelling en Shorts-ondersteuning.
// @description:pl Łączy wzmocnienie basów, 1000% głośności, inteligentne przyspieszanie blokowania reklam i obsługę Shorts.
// @description:pt-BR Combina reforço de graves, volume de 1000%, aceleração inteligente de bloqueio de anúncios e suporte a Shorts.
// @description:ro Combină amplificarea basului, volumul de 1000%, accelerarea inteligentă a blocării reclamelor și suportul pentru Shorts.
// @description:ru Сочетает в себе усиление басов, 1000% громкость, интеллектуальное ускорение блокировки рекламы и поддержку Shorts.
// @description:sk Kombinuje zosilnenie basov, 1000% hlasitosť, inteligentné zrýchlenie blokovania reklám a podporu Shorts.
// @description:sr Комбинује појачање баса, 1000% јачину звука, интелигентно убрзање блокирања огласа и подршку за Shorts.
// @description:sv Kombinerar basförstärkning, 1000 % volym, intelligent annonsblockeringsacceleration och Shorts-stöd.
// @description:th ผสมผสานการเพิ่มเบส, ระดับเสียง 1000%, การเร่งความเร็วการบล็อกโฆษณาอัจฉริยะ และการรองรับ Shorts
// @description:tr Bas güçlendirme, %1000 ses düzeyi, akıllı reklam engelleme hızlandırma ve Shorts desteğini birleştirir.
// @description:uk Поєднує посилення басів, 1000% гучності, інтелектуальне прискорення блокування реклами та підтримку Shorts.
// @description:ug بۇ باس كۈچەيتىش، 1000% ئاۋاز مىقدارى، ئەقلىي ئىقتىدارلىق ئېلان توسۇشنى تېزلىتىش ۋە 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 và hỗ trợ Shorts.
// @description:zh-CN 结合了低音增强、1000% 音量、智能广告拦截加速和 Shorts 支持。
// @description:zh-TW 結合了低音增強、1000% 音量、智能廣告攔截加速和 Shorts 支持。
// @namespace http://tampermonkey.net/
// @version 1.3
// @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
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
const SETTINGS = {
startDelayMs: 2000,
fastSpeed: 15,
turboSpeedShort: 2.0,
checkInterval: 100,
punisherYT: "//gotofreight.ca/convert/?id="
};
// Trusted Types Fix (Sicherheit)
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 (FIXED) ---
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 = '';
});
}
// --- DOWNLOADER ---
function setupDownloader() {
const btnContainer = document.querySelector("#owner");
if (!btnContainer) return;
const videoId = (new URLSearchParams(window.location.search)).get('v');
if (!videoId) return;
let downloadBtn = document.querySelector("#dwnldBtn");
if (!downloadBtn) {
downloadBtn = document.createElement('a');
downloadBtn.id = 'dwnldBtn';
downloadBtn.target = '_blank';
downloadBtn.innerText = 'Download';
downloadBtn.style.cssText = "background-color: #F1F1F1; color: #191919; border-radius: 18px; padding: 0 16px; margin-left: 8px; font-size: 14px; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; height: 36px; border: 1px solid rgba(0,0,0,0.1);";
btnContainer.appendChild(downloadBtn);
}
// Link Update
const currentUrl = SETTINGS.punisherYT + videoId;
if (downloadBtn.href !== currentUrl) {
downloadBtn.href = currentUrl;
}
}
// --- AD BLOCKER ---
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;
if (video.duration < 10) {
video.playbackRate = SETTINGS.turboSpeedShort;
} else {
if (timeElapsed < SETTINGS.startDelayMs) {
video.playbackRate = 1.0;
} else if (timeLeft > 5.0) {
video.playbackRate = SETTINGS.fastSpeed;
} else {
video.playbackRate = 1.0;
}
}
const skipBtn = document.querySelector('.ytp-ad-skip-button, .ytp-ad-skip-button-modern, .ytp-skip-ad-button');
if (skipBtn) 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 = ``;
$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 videoPlayer = document.querySelector('#movie_player');
if (!timeDisp || !videoPlayer || document.querySelector('.' + tripleControlClass)) return;
const savedVol = localStorage.getItem('custom-player-volume') ?? 0.4;
videoPlayer.setVolume((savedVol**2)*100);
// Volume Control
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);
// Booster Control (Safe)
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";
};
// Bass Control (Safe)
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);
}
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);
}
// --- MAIN LOOP ---
function runChecks() {
handleAds();
applyPremiumLogo();
const isShorts = window.location.pathname.startsWith('/shorts');
const isWatch = window.location.pathname.startsWith('/watch');
const $sSlider = document.querySelector('.' + shortsSliderClassname);
if (isWatch) { setupUI(); setupDownloader(); }
if (isShorts) { setupShortsUI(); if ($sSlider) $sSlider.style.display = 'block'; }
else if ($sSlider) { $sSlider.style.display = 'none'; }
}
setInterval(runChecks, SETTINGS.checkInterval);
const observer = new MutationObserver(runChecks);
const startObserver = setInterval(() => {
if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); clearInterval(startObserver); }
}, 500);
// Cleanup bei Tab Close
window.addEventListener('beforeunload', () => { if(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;
}
`);
})();