YouTube Pr

YouTube Premium'

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

Advertisement:

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

Advertisement:

// ==UserScript==
// @name         YouTube Pr
// @namespace    http://tampermonkey.net/
// @version      19.8
// @description  YouTube Premium'
// @author       Mustafa Hakan
// @match        *://*.youtube.com/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

(function () {
    'use strict';
    const LANG = localStorage.getItem('yt-lang') || 'tr';
    const THEME = localStorage.getItem('yt-theme') || 'Koyu Mavi';
    const TEXT = {
        tr: {
            title: 'ARKA PLAN RENK SEÇ',
            lang: 'TR',
            premium: 'Premium',
            loop: 'Döngü',
            default: 'Varsayılan (Siyah)',
            colors: {
                'Koyu Mavi': 'Koyu Mavi', 'Koyu Gri': 'Koyu Gri',
                'Koyu Yeşil': 'Koyu Yeşil', 'Koyu Mor': 'Koyu Mor',
                'Koyu Kahve': 'Koyu Kahve', 'Koyu Bordo': 'Koyu Bordo',
                'Gece Mavisi': 'Gece Mavisi', 'Kömür': 'Kömür',
                'Lacivert': 'Lacivert', 'Zeytin': 'Zeytin'
            }
        },
        en: {
            title: 'BACKGROUND COLOR',
            lang: 'EN',
            premium: 'Premium',
            loop: 'Loop',
            default: 'Default (Black)',
            colors: {
                'Koyu Mavi': 'Dark Blue', 'Koyu Gri': 'Dark Gray',
                'Koyu Yeşil': 'Dark Green', 'Koyu Mor': 'Dark Purple',
                'Koyu Kahve': 'Dark Brown', 'Koyu Bordo': 'Dark Burgundy',
                'Gece Mavisi': 'Night Blue', 'Kömür': 'Charcoal',
                'Lacivert': 'Navy', 'Zeytin': 'Olive'
            }
        }
    };
    const THEMES = {
        'Koyu Mavi': '#1a2430',
        'Koyu Gri': '#282828',
        'Koyu Yeşil': '#1a2a1a',
        'Koyu Mor': '#241a2a',
        'Koyu Kahve': '#2a1f1a',
        'Koyu Bordo': '#2a1a1a',
        'Gece Mavisi': '#0f1a2a',
        'Kömür': '#1a1a1a',
        'Lacivert': '#141a2a',
        'Zeytin': '#1f2a1a'
    };
    const SNOOPY_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="28" height="28">
      <path d="M12 4C8 4 5 7 5 11C5 13.5 6.5 15.5 8 16.5V19C8 19.5 8.5 20 9 20H15C15.5 20 16 19.5 16 19V16.5C17.5 15.5 19 13.5 19 11C19 7 16 4 12 4Z" fill="#FFFFFF" stroke="#000000" stroke-width="1.5" stroke-linejoin="round"/>
      <path d="M4 9C3 11 3 14 4.5 15.5C5.5 16.5 7 16 7 14C7 11.5 6 9 4 9Z" fill="#000000"/>
      <circle cx="10" cy="10" r="1" fill="#000000"/>
      <circle cx="14" cy="10" r="1" fill="#000000"/>
      <path d="M11 12C11 13 13 13 13 12" stroke="#000000" stroke-width="1" fill="none" stroke-linecap="round"/>
      <ellipse cx="12" cy="14" rx="2" ry="1.2" fill="#000000"/>
    </svg>`;
    function setTheme(themeName) {
        localStorage.setItem('yt-theme', themeName);
        if (themeName === 'Varsayılan' || themeName === 'Default') {
            let s = document.getElementById('yt-style');
            if (s) s.remove();
            return;
        }
        const color = THEMES[themeName];
        if (!color) return;
        let s = document.getElementById('yt-style');
        if (!s) {
            s = document.createElement('style');
            s.id = 'yt-style';
            document.head.appendChild(s);
        }
        const textColor = (themeName === 'Beyaz') ? '#111' : '#ffffff';
        s.textContent = `
            html, body, ytd-app, #content, #page-manager, ytd-browse, ytd-watch-flexy,
            ytd-two-column-browse-results-renderer, #primary, #secondary {
                background-color: ${color} !important;
                background-image: none !important;
            }
            #yt-label {
                border: none !important;
                background: transparent !important;
                color: ${textColor} !important;
                padding: 0 4px !important;
                box-shadow: none !important;
                text-shadow: 0 0 8px rgba(0,0,0,0.9) !important;
                font-weight: 600 !important;
                cursor: pointer;
                margin-left: 6px;
                font-size: 13px !important;
                opacity: 0.9;
            }
            #yt-label:hover { opacity: 0.5; text-decoration: underline; }
            #yt-loop.active { opacity: 0.5 !important; filter: none !important; }
        `;
    }
    function injectSnoopyHead() {
        if (document.getElementById('yt-snoopy-head')) return;
        const progress = document.querySelector('.ytp-progress-bar');
        if (!progress) return;
        const div = document.createElement('div');
        div.id = 'yt-snoopy-head';
        div.innerHTML = SNOOPY_SVG;
        div.style.cssText = `
            position: absolute;
            top: -20px;
            left: 50%;
            transform: translateX(-50%);
            pointer-events: none;
            z-index: 9999;
            filter: drop-shadow(0 3px 6px rgba(0,0,0,0.8));
            width: 28px;
            height: 28px;
        `;
        progress.style.overflow = 'visible';
        progress.appendChild(div);
    }
    function addLoop() {
        if (document.getElementById('yt-loop')) return;
        const ctrl = document.querySelector('.ytp-right-controls');
        if (!ctrl) return;
        const btn = document.createElement('button');
        btn.id = 'yt-loop';
        btn.className = 'ytp-button';
        btn.title = TEXT[LANG].loop;
        btn.innerHTML = `<svg viewBox="0 0 36 36" width="36" height="36">
            <path d="M10 25v-7h2v5h12V12H12v5h-2V10h16v15H10z" fill="#fff"/>
            <path d="M26 9l3 3-3 3" stroke="#fff" stroke-width="2" fill="none" stroke-linecap="round"/>
        </svg>`;
        btn.style.opacity = '0.5';
        btn.onclick = function () {
            const v = document.querySelector('video');
            if (v) { v.loop = !v.loop; btn.classList.toggle('active', v.loop); }
        };
        ctrl.prepend(btn);
    }
    function openPanel() {
        let p = document.getElementById('yt-panel');
        if (p) { p.remove(); return; }
        const activeTheme = localStorage.getItem('yt-theme') || 'Koyu Mavi';
        p = document.createElement('div');
        p.id = 'yt-panel';
        p.style.cssText = 'position:fixed;top:68px;right:18px;background:#1a1a22;border:2px solid #2e2e3a;border-radius:20px;padding:18px 16px 14px;z-index:2147483647;min-width:200px;font-family:sans-serif;box-shadow:0 8px 32px rgba(0,0,0,0.55);';
        const title = document.createElement('div');
        title.textContent = TEXT[LANG].title;
        title.style.cssText = 'color:#6060a0;font-size:10px;font-weight:900;text-align:center;margin-bottom:12px;text-transform:uppercase;';
        p.appendChild(title);
        const grid = document.createElement('div');
        grid.style.cssText = 'display:grid;grid-template-columns:1fr 1fr;gap:6px;';
        const defaultCard = document.createElement('div');
        const isDefaultActive = (activeTheme === 'Varsayılan' || activeTheme === 'Default' || !THEMES[activeTheme]);
        defaultCard.style.cssText = `display:flex;align-items:center;justify-content:center;padding:10px;cursor:pointer;border-radius:10px;border:2px solid ${isDefaultActive ? '#fff' : '#2e2e3a'};background:${isDefaultActive ? '#ffffff20' : '#22222e'};grid-column: span 2;font-size:12px;font-weight:700;color:${isDefaultActive ? '#fff' : '#888'};`;
        defaultCard.textContent = TEXT[LANG].default;
        defaultCard.onclick = () => { setTheme('Varsayılan'); p.remove(); };
        grid.appendChild(defaultCard);
        const colorNames = TEXT[LANG].colors;
        Object.entries(THEMES).forEach(([key, hex]) => {
            const displayName = colorNames[key] || key;
            const isActive = key === activeTheme;
            const card = document.createElement('div');
            card.style.cssText = `display:flex;align-items:center;gap:8px;padding:8px 10px;cursor:pointer;border-radius:10px;border:2px solid ${isActive ? hex : '#2e2e3a'};background:${isActive ? hex + '40' : '#22222e'};`;
            const dot = document.createElement('span');
            dot.style.cssText = `width:16px;height:16px;border-radius:50%;background:${hex};border:1px solid #444;flex-shrink:0;`;
            const lbl = document.createElement('span');
            lbl.textContent = displayName;
            lbl.style.cssText = `font-size:11px;font-weight:700;color:${isActive ? '#fff' : '#aaa'};`;
            card.appendChild(dot);
            card.appendChild(lbl);
            card.onclick = () => { setTheme(key); p.remove(); };
            grid.appendChild(card);
        });
        p.appendChild(grid);
        const hr = document.createElement('div');
        hr.style.cssText = 'border-top:1.5px solid #2e2e3a;margin:12px 0 10px;';
        p.appendChild(hr);
        const langBtn = document.createElement('div');
        langBtn.textContent = TEXT[LANG].lang;
        langBtn.style.cssText = 'cursor:pointer;background:#58CC02;color:#fff;padding:9px;border-radius:12px;text-align:center;font-size:13px;font-weight:800;border-bottom:3px solid #3a9900;';
        langBtn.onclick = () => {
            localStorage.setItem('yt-lang', LANG === 'tr' ? 'en' : 'tr');
            location.reload();
        };
        p.appendChild(langBtn);
        const hint = document.createElement('div');
        hint.textContent = 'Ctrl + Shift + D';
        hint.style.cssText = 'text-align:center;color:#3a3a58;font-size:10px;font-weight:700;margin-top:9px;';
        p.appendChild(hint);
        document.body.appendChild(p);
        setTimeout(() => {
            document.addEventListener('mousedown', function close(e) {
                if (!p.contains(e.target) && e.target.id !== 'yt-label') {
                    p.remove();
                    document.removeEventListener('mousedown', close);
                }
            });
        }, 10);
    }
    document.addEventListener('keydown', function (e) {
        if (e.ctrlKey && e.shiftKey && e.key === 'D') {
            e.preventDefault();
            openPanel();
        }
    });
    function addLabel() {
        if (document.getElementById('yt-label')) return;
        const logo = document.querySelector('#logo');
        if (!logo) return;
        const label = document.createElement('span');
        label.id = 'yt-label';
        label.textContent = TEXT[LANG].premium;
        label.title = 'Ctrl+Shift+D — Tema Paneli';
        label.onclick = function (e) { e.stopPropagation(); openPanel(); };
        logo.parentNode.insertBefore(label, logo.nextSibling);
    }
    function cleanAds() {
        document.querySelectorAll('ytd-ad-slot-renderer,#masthead-ad,.ytd-ad-slot-renderer,ytd-display-ad-renderer,ytd-promoted-sparkles-web-renderer').forEach(el => el.remove());
        const skipBtn = document.querySelector('.ytp-ad-skip-button,.ytp-skip-ad-button');
        if (skipBtn) skipBtn.click();
    }
    function init() {
        setTheme(THEME);
        addLabel();
        addLoop();
        cleanAds();
        injectSnoopyHead();
    }
    setTimeout(init, 1500);
    setInterval(() => {
        injectSnoopyHead();
        addLabel();
        addLoop();
        cleanAds();
    }, 1000);
    new MutationObserver(() => {
        setTimeout(() => {
            injectSnoopyHead();
            addLabel();
            addLoop();
        }, 300);
    }).observe(document.body, { childList: true, subtree: true });
})();