VK Blur Remover

Removes blur, overlays, and auto play vkontakte videos.

目前为 2025-01-08 提交的版本。查看 最新版本

// ==UserScript==
// @name         VK Blur Remover
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Removes blur, overlays, and auto play vkontakte videos.
// @author       1axx
// @license      MIT
// @icon         https://www.google.com/s2/favicons?sz=64&domain=vk.com
// @match        https://vk.com/*
// @match        https://vkvideo.ru/*
// @match        *://vk.com/*
// @match        *://vk.ru/*
// @match        *://*.vk.com/*
// @match        *://*.vk.ru/*
// @match        *://*.vk-cdn.com/*
// @match        *://*.vk-cdn.net/*
// @match        *://*.mycdn.me/*
// @match        *://*.userapi.com/*
// @match        *://*.vkuseraudio.net/*
// @match        *://*.vkuseraudio.ru/*
// @match        *://*.vkuservideo.net/*
// @match        *://*.vkuser.net/*
// @match        *://*.pladform.ru/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // Keywords to check
    const keywords = ['age-restricted', 'blurred', 'restriction', 'video', 'restricted'];

    // Function to dynamically check and hide/remove based on content and attributes
    function processElements() {
        // Select all elements in the document
        const allElements = document.querySelectorAll('*');

        allElements.forEach(element => {
            let shouldRemove = false;
            let elementText = element.innerText || ''; // Get text inside the element
            let elementAttributes = Array.from(element.attributes); // Get attributes of the element

            // Check if element has text matching any keywords
            const lowerCaseText = elementText.toLowerCase();
            keywords.forEach(keyword => {
                if (lowerCaseText.includes(keyword)) {
                    shouldRemove = true;
                }
            });

            // Check if element's attributes contain any keywords (like titles, alt, etc.)
            elementAttributes.forEach(attr => {
                if (attr.value.toLowerCase().includes('blur') || attr.value.toLowerCase().includes('restriction')) {
                    shouldRemove = true;
                }
            });

            // If the element has specific content that matches the keywords, remove or hide it
            if (shouldRemove) {
                // Handle SVG icons with unwanted classes
                if (element.classList.contains('vkuiIcon--hide_outline_28')) {
                    element.remove(); 
                }
                // Handle blurred preview images
                else if (element.classList.contains('vkitVideoCardPreviewImage__imgBlurred--GNE6S')) {
                    element.style.filter = 'none'; // Remove blur effect
                    element.style.opacity = '1'; // Ensure full visibility
                }
                // Handle age-restricted overlay and other similar elements
                else if (element.classList.contains('vkitVideoCardRestrictionOverlay__restriction--EP1HY') ||
                         element.classList.contains('vkitVideoCardRestrictionOverlay__restrictionLayoutLight--IPSP6') ||
                         element.classList.contains('vkitOverlay__root--AjJAj') ||
                         element.classList.contains('vkitVideoCardRestrictionOverlay__title--qz1zh')) {
                    element.style.display = 'none'; // Hide the overlay completely
                    element.style.pointerEvents = 'none'; 
                }
            }

            
            if (element.classList.contains('VideoRestriction__button')) {
                element.click();
                console.log('Auto-clicked the "Look" button');
            }
        });
    }

    // Wait 
    window.addEventListener('load', function() {
        // Observe changes to the DOM and apply fixes dynamically
        const observer = new MutationObserver(processElements);
        observer.observe(document.body, { childList: true, subtree: true });
        processElements(); // Initial run to process existing content
    });
})();