Enhance Media Content

Preset all thumbnails and images to 3D+HDR and videos to 4k 60fps VP9+HDR

目前為 2024-07-18 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Enhance Media Content
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  Preset all thumbnails and images to 3D+HDR and videos to 4k 60fps 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, .thumbnail');
        images.forEach(img => {
            img.style.filter = 'brightness(1.2) contrast(1.1) saturate(1.0)';
            img.style.transform = 'perspective(2000px) rotateY(10deg)';
        });
    }

    // Apply video settings for 4K 60fps VP9+HDR
    function applyVideoSettings() {
        const videos = document.querySelectorAll('video');
        videos.forEach(video => {
            video.addEventListener('loadedmetadata', () => {
                try {
                    video.playbackQuality = {
                        resolution: '2160p',
                        framerate: 60,
                        codec: 'vp9',
                        dynamicRange: 'hdr'
                    };
                    console.log('Applied 4K 60fps 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();
})();