VK Blur Exterminator

Removes blur layers and age-restriction overlays, fills blank thumbnail previews on VK.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        VK Blur Exterminator
// @namespace   Violentmonkey Scripts
// @version     1.1.0
// @license     MIT
// @match       https://m.vkvideo.ru/*
// @match       https://www.vkvideo.ru/*
// @match       https://vkvideo.ru/*
// @grant       none
// @run-at      document-start
// @author      tarangogo
// @description Removes blur layers and age-restriction overlays, fills blank thumbnail previews on VK.
// ==/UserScript==
(function () {
    'use strict';

    /* ── CSS ── */
    const style = document.createElement('style');
    style.textContent = `
        [class*="VideoCardRestrictionOverlay"],
        [class*="VideoPreviewOverlay"],
        [class*="RestrictionOverlay"],
        [class*="AgeRestriction"],
        [class*="adult_warning"] {
            display: none !important;
        }
        [class*="VideoCard"] img,
        [class*="VideoCard"] video,
        [class*="videoCard"] img,
        [class*="videoCard"] video {
            filter: none !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }
        [style*="blur"] {
            filter: none !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }
        /* Force preview image containers to be visible */
        [class*="VideoCardPreviewImage__container"] {
            opacity: 1 !important;
            visibility: visible !important;
            display: block !important;
        }
    `;

    const injectStyle = () => {
        (document.head || document.documentElement).appendChild(style);
    };

    if (document.head) {
        injectStyle();
    } else {
        new MutationObserver((_, obs) => {
            if (document.head) {
                injectStyle();
                obs.disconnect();
            }
        }).observe(document.documentElement, { childList: true });
    }

    /* ── JS ── */
    const OVERLAY_PATTERNS = [
        'VideoCardRestrictionOverlay',
        'VideoPreviewOverlay',
        'RestrictionOverlay',
        'AgeRestriction',
        'adult_warning',
        'hide_outline_28',
    ];

    const removeOverlays = () => {
        OVERLAY_PATTERNS.forEach(pattern => {
            document.querySelectorAll(`[class*="${pattern}"]`).forEach(el => {
                const tag = el.tagName.toLowerCase();
                if (!['img', 'video', 'source'].includes(tag)) {
                    el.remove();
                }
            });
        });

        // Auto-click age-confirmation buttons
        document.querySelectorAll(
            'button[class*="confirm"], button[class*="Adult"], button[class*="adult"], button[class*="Confirm"]'
        ).forEach(btn => {
            if (btn.offsetParent !== null) btn.click();
        });

        // Strip inline blur styles
        document.querySelectorAll('[style*="blur"], [style*="filter"]').forEach(el => {
            el.style.removeProperty('filter');
            el.style.removeProperty('backdrop-filter');
            el.style.removeProperty('-webkit-backdrop-filter');
        });

        // Fix missing containerVisible class on preview image containers
        document.querySelectorAll('[class*="VideoCardPreviewImage__container"]').forEach(el => {
            const hasVisible = [...el.classList].some(c => c.includes('containerVisible'));
            if (!hasVisible) {
                const visibleEl = document.querySelector('[class*="containerVisible"]');
                if (visibleEl) {
                    const visibleClass = [...visibleEl.classList].find(c => c.includes('containerVisible'));
                    if (visibleClass) el.classList.add(visibleClass);
                } else {
                    el.style.opacity = '1';
                    el.style.visibility = 'visible';
                }
            }
        });
    };

    const start = () => {
        removeOverlays();
        new MutationObserver(removeOverlays).observe(document.body, {
            childList: true,
            subtree: true,
        });
    };

    if (document.body) {
        start();
    } else {
        document.addEventListener('DOMContentLoaded', start, { once: true });
    }
})();