Unlock photo

Unlock photo ayaznal.ru

// ==UserScript==
// @name         Unlock photo
// @namespace    http://tampermonkey.net/
// @version      0.5
// @description  Unlock photo ayaznal.ru
// @author       Vierta
// @match        https://ayaznal.ru/photo/*
// @match        https://youtik.ru/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=ayaznal.com
// @grant        none
// @license      MIT
// ==/UserScript==
(function() {
    'use strict';

    function processVipPhotos() {
        var vipPhotos = document.querySelectorAll('.pass_view_photos');
        vipPhotos.forEach(function(vipPhoto) {
            vipPhoto.classList.remove('pass_view_photos');
            vipPhoto.classList.add('h-photo-mtr');

            var sibling = vipPhoto.nextElementSibling;
            if (sibling && sibling.classList.contains('pass_view_photon')) {
                sibling.remove();
            }

            var vipSpan = vipPhoto.querySelector('span.vip');
            if (vipSpan) {
                vipSpan.remove();
            }

            var links = vipPhoto.querySelectorAll('a');
            links.forEach(function(link) {
                if (link.classList.contains('ulightbox')) {
                    link.classList.remove('ulightbox');
                    link.classList.add('hb-section', 'ulightbox');
                }

                var img = link.querySelector('img');
                if (img) {
                    img.src = img.src.replace('/1/', '/2/').replace(/\?.*$/, '');
                    link.href = link.href.replace('/1/', '/2/').replace(/\?.*$/, '');
                }
            });
        });
    }

    processVipPhotos();

    var moreBtn = document.getElementById('moreBtn');
    if (moreBtn) {
        moreBtn.addEventListener('click', function() {
            setTimeout(processVipPhotos, 1000);
        });
    }
})();