MinimalisticThreadLOLZ

Удаляет ненужную информацию с списка тем и добавляет предпросмотр!

// ==UserScript==
// @name         MinimalisticThreadLOLZ
// @namespace    llimonix/LZT
// @version      1
// @description  Удаляет ненужную информацию с списка тем и добавляет предпросмотр!
// @author       llimonix
// @match        https://lolz.live/*
// @match        https://zelenka.guru/*
// @icon         https://ibb.org.ru/images/2024/09/13/eye.png
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    function is_scrolling() {
        return window.lastScrollTime && Date.now() < window.lastScrollTime + 500
    }

    XenForo.MinimalisticThreadPreview = function($el){
        var previewUrl;

        if (!parseInt(XenForo._enableOverlays)) {
            return;
        }

        if (!(previewUrl = $($el).find('.threadHeaderMain a').attr('href'))) {
            console.warn('Preview tooltip has no preview: %o', $el);
            return;
        }

        $el.find('[title]').andSelf().attr('title', '');
        var loaded = false;

        tippy($el.get(), {
            touch: false,
            interactive: false,
            arrow: true,
            theme: 'popup PreviewTooltip',
            animation: 'shift-toward',
            distance: 5,
            appendTo: $el[0] || document.body,
            delay: [300, 0],
            maxWidth: 400,
            placement: 'top-start',
            flipOnUpdate: true,
            content: '',
            popperOptions: {
                modifiers: {
                    computeStyle: {
                        gpuAcceleration: false
                    }
                }
            },
            onShow(instance) {

                if (is_scrolling()) {
                    clearTimeout(XenForo._ShowPreviewTimeout);
                    XenForo._ShowPreviewTimeout = setTimeout(function () {
                        console.log('check scroll', is_scrolling());
                        if (!is_scrolling()) {
                            console.log('trigger hover', $el[0]._tippy);
                            $el[0]._tippy.show();
                        }
                    }, 700);

                    return false;
                }

                if (XenForo._ActivePreviewTooltip && XenForo._ActivePreviewTooltip !== instance) {
                    XenForo._ActivePreviewTooltip.hide();
                }

                if (!loaded) {
                    XenForo.ajax(previewUrl + 'preview', {}, function (ajaxData) {
                        loaded = true;
                        instance.setContent(ajaxData.templateHtml);
                        loaded = true;
                        if ($el.is(':hover')) {
                            instance.show();
                            XenForo._ActivePreviewTooltip = instance;
                            return true;
                        }
                        return true;
                    });

                    return false;
                }

                return true;
            },
        })
    }

    function minimalisticThread(thread) {
        // $(thread).find('.threadInfo').remove(); // Удалить симпатии и комментарии
        $(thread).find('.threadLastPost').remove(); // Удалить последний комментарий
        // $(thread).find('.threadSeperator').remove(); // Удалить разделитель
        $(thread).find('.threadMessage.bbCodeQuote.noQuote').remove(); // Удалить текст темы
    }

    const observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            mutation.addedNodes.forEach(function(node) {
                if (node.nodeType === 1 && $(node).hasClass('discussionListItem')) {
                    minimalisticThread(node);
                    $('.discussionListMainPage .discussionListItem').each(function(){
                        XenForo.MinimalisticThreadPreview($(node));
                    })
                }
            });
        });
    });

    const threadlist = $('.discussionListMainPage .discussionListItem');
    if (threadlist.length > 0) {
        observer.observe(document.querySelector('.discussionListMainPage'), { childList: true, subtree: true });

        threadlist.each(function() {
            $('.discussionListMainPage .discussionListItem').each(function(){
                XenForo.MinimalisticThreadPreview($(this));
            })
            minimalisticThread(this);
        });
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址