MinimalisticThreadLOLZ

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

คุณจะต้องติดตั้งส่วนขยาย เช่น 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         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);
        });
    }
})();