VK.com Image Unblur

Remove blur effects from thumbnails on vk.com

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         VK.com Image Unblur
// @namespace    https://github.com/goawaylovestrike
// @version      2.3
// @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 unblurContent() {
        // Remove blur from videoplayers
        document.querySelectorAll('.videoplayer').forEach(player => {
            player.className = player.className.replace('videoplayer--blur', '').trim();
        });

        // Remove age restriction elements
        document.querySelectorAll('.VideoRestriction__icon, .VideoRestriction__title, .VideoRestriction__text').forEach(el => el.remove());

        // Replace Watch with play button
        document.querySelectorAll('.VideoRestriction__button').forEach(button => {
            if (button.textContent === 'Watch') button.textContent = '▶';
        });

        // Remove blur from images
        document.querySelectorAll('img[class*="imgBlurred"]').forEach(img => {
            img.className = img.className.replace(/imgBlurred[^ ]*/g, '').trim();
        });

        // Remove hide icons
        document.querySelectorAll('svg.vkuiIcon--hide_outline_24, g path[d*="M0 0h28v28H0z"]').forEach(el => {
            el.closest('svg, g')?.remove();
        });
    }

    // Run immediately and watch for changes
    unblurContent();
    new MutationObserver(unblurContent).observe(document.body, { childList: true, subtree: true });
})();