VK Blur Exterminator

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==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 });
    }
})();