VK.com Image Unblur

Remove blur effects from thumbnails on vk.com

目前為 2025-08-26 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         VK.com Image Unblur
// @namespace    https://github.com/goawaylovestrike
// @version      1.1
// @description  Remove blur effects from thumbnails on vk.com
// @author       GoAwayLoveStrike
// @icon         https://raw.githubusercontent.com/goawaylovestrike/Userscripts/refs/heads/main/vk-image-unblur/vk-image-unblur.png
// @match        https://vk.com/*
// @match        https://vkvideo.ru/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to remove blur from images
    function removeBlur() {
        // Find all images with blur classes
        const blurredImages = document.querySelectorAll('img[class*="imgBlurred"], img[class*="blur"]');
        
        blurredImages.forEach(img => {
            // Remove blur-related classes
            img.className = img.className.replace(/imgBlurred[^\s]*/g, '');
            img.className = img.className.replace(/blur[^\s]*/g, '');
            
            // Apply unblur styles
            img.style.filter = 'none';
            img.style.webkitFilter = 'none';
            img.style.transform = 'none';
            img.style.transition = 'none';
        });
    }

    // Function to handle video player restrictions and controls
    function handleVideoPlayer() {
        // Remove blur class from video player
        const videoPlayer = document.querySelector('.videoplayer--blur');
        if (videoPlayer) {
            videoPlayer.classList.remove('videoplayer--blur');
        }
        
        // Remove restriction class from video player
        const restrictedPlayer = document.querySelector('.videoplayer--hasRestriction');
        if (restrictedPlayer) {
            restrictedPlayer.classList.remove('videoplayer--hasRestriction');
        }
        
        // Show video controls
        const videoControls = document.querySelector('.videoplayer_controls');
        if (videoControls) {
            videoControls.classList.remove('unshown');
            videoControls.style.opacity = '1';
            videoControls.style.visibility = 'visible';
        }
        
        // Show all control items
        const controlItems = document.querySelectorAll('.videoplayer_controls_item');
        controlItems.forEach(item => {
            item.style.opacity = '1';
            item.style.visibility = 'visible';
        });
        
        // Pause video if it's playing (to prevent auto-play after restriction bypass)
        const video = document.querySelector('video');
        if (video && !video.paused) {
            video.pause();
        }
        
        // Ensure video starts paused
        if (video) {
            video.pause();
            // Remove any autoplay attributes
            video.removeAttribute('autoplay');
            video.removeAttribute('muted');
        }
    }

    // Function to add CSS to prevent blur
    function addUnblurCSS() {
        const style = document.createElement('style');
        style.textContent = `
            /* Remove blur from all images */
            img[class*="imgBlurred"],
            img[class*="blur"] {
                filter: none !important;
                webkit-filter: none !important;
                transform: none !important;
                transition: none !important;
            }
            
            /* Remove blur from video preview images specifically */
            .vkitVideoCardPreviewImage__imgBlurred--uTIvm,
            .vkitVideoCardPreviewImage__imgBlurredSizeS--0ck4C {
                filter: none !important;
                webkit-filter: none !important;
                transform: none !important;
                transition: none !important;
            }
            
            /* Override any blur effects */
            *[class*="blur"] {
                filter: none !important;
                webkit-filter: none !important;
            }
            
            /* Remove blur from video player */
            .videoplayer--blur {
                filter: none !important;
                webkit-filter: none !important;
            }
            
            /* Remove blur from video thumbnails */
            .videoplayer_thumb_blur {
                display: none !important;
            }
            
            /* Remove blur from video restriction overlay */
            .VideoRestriction--blur {
                filter: none !important;
                webkit-filter: none !important;
            }
            
            /* Remove blur from video preview images */
            .videoplayer_thumb {
                filter: none !important;
                webkit-filter: none !important;
            }
            
            /* Remove blur from video card preview images */
            .vkitVideoCardPreviewImage__img--Rk6St {
                filter: none !important;
                webkit-filter: none !important;
                transform: none !important;
                transition: none !important;
            }
            
            /* Hide age restriction overlay completely */
            .VideoRestriction {
                display: none !important;
            }
            
            /* Remove age restriction state from video player */
            .videoplayer--hasRestriction {
                /* Remove the restriction class behavior */
            }
            
            /* Show video player controls by default */
            .videoplayer_controls {
                opacity: 1 !important;
                visibility: visible !important;
            }
            
            /* Remove the 'unshown' class that hides controls */
            .videoplayer_controls.unshown {
                opacity: 1 !important;
                visibility: visible !important;
            }
            
            /* Ensure controls are always visible */
            .videoplayer_controls_item {
                opacity: 1 !important;
                visibility: visible !important;
            }
            
            /* Hide the restriction/hide icons */
            .vkuiIcon--hide_outline_24,
            .vkuiIcon--hide_outline_28,
            svg[class*="hide_outline"] {
                display: none !important;
            }
            
            /* Hide restriction overlays on video cards */
            .vkitVideoCardRestrictionOverlay__restriction--fAC7b {
                display: none !important;
            }
        `;
        document.head.appendChild(style);
    }

    // Run immediately
    removeBlur();
    addUnblurCSS();
    handleVideoPlayer();

    // Set up observer to handle dynamically loaded content
    const observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if (mutation.type === 'childList') {
                removeBlur();
                handleVideoPlayer();
            }
        });
    });

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

    // Also run periodically to catch any missed elements
    setInterval(() => {
        removeBlur();
        handleVideoPlayer();
    }, 2000);

    console.log('VK.com Image Unblur script loaded successfully!');
})();