Enhance Media Content

Preset all thumbnails and images to 3D+HDR and videos to 1080p 144fps VP9+HDR

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Enhance Media Content
// @namespace    http://tampermonkey.net/
// @version      4.1
// @description  Preset all thumbnails and images to 3D+HDR and videos to 1080p 144fps VP9+HDR
// @author       Tae
// @match        *://*/*
// @grant        GM_addStyle
// @grant        GM_xmlhttpRequest
// @grant        GM_openInTab
// ==/UserScript==

(function() {
    'use strict';

    // Apply styles to images and thumbnails for 3D+HDR effect
    function applyImageStyles() {
        const images = document.querySelectorAll('img:not([src*="ad"]), .thumbnail:not([src*="ad"])');
        images.forEach(img => {
            img.style.filter = 'brightness(1.1) contrast(1.1) saturate(0.5)';
            img.style.transform = 'perspective(1000px) rotateY(15deg)';
        });
    }

    // Apply video settings for 144fps VP9+HDR
    function applyVideoSettings() {
        const videos = document.querySelectorAll('video:not([src*="ad"])');
        videos.forEach(video => {
            video.addEventListener('loadedmetadata', () => {
                try {
                    video.playbackQuality = {
                        resolution: '1080p',
                        framerate: 144,
                        codec: 'vp9',
                        dynamicRange: 'hdr'
                    };
                    console.log('Applied 144fps VP9+HDR settings to video:', video);
                } catch (error) {
                    console.error('Failed to apply video settings:', error);
                }
            });
        });
    }

    // Observer to detect new images and videos added dynamically
    function observeMutations() {
        const observer = new MutationObserver(mutations => {
            mutations.forEach(mutation => {
                if (mutation.addedNodes.length) {
                    applyImageStyles();
                    applyVideoSettings();
                }
            });
        });

        observer.observe(document.body, {
            childList: true,
            subtree: true
        });
    }

    // Initial application of styles and settings
    applyImageStyles();
    applyVideoSettings();
    observeMutations();
})();