MinimalisticThreadLOLZ

Удаляет лишнее из списка тем + добавляет нормальный предпросмотр

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         MinimalisticThreadLOLZ
// @namespace    llimonix/LZT
// @version      1.3
// @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
// @require      https://code.jquery.com/jquery-3.7.1.min.js
// ==/UserScript==

(function() {
    const win = typeof unsafeWindow !== 'undefined' ? unsafeWindow : window;

    function waitForXenForo() {
        if (!win.XenForo) {
            setTimeout(waitForXenForo, 50);
            return;
        }

        const XenForo = win.XenForo;

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

        XenForo.MinimalisticThreadPreview = function($el) {
            let previewUrl = $el.find('.threadHeaderMain h3 a').attr('href');
            if (!previewUrl) return;
            if (!parseInt(XenForo._enableOverlays)) return;
            $el.find('[title]').addBack().attr('title', '');
            let loaded = false;
            tippy($el[0], {
                touch: false,
                interactive: false,
                arrow: true,
                theme: 'popup PreviewTooltip',
                animation: 'shift-toward',
                distance: 5,
                appendTo: document.body,
                delay: [300, 0],
                maxWidth: 400,
                placement: 'top-start',
                flipOnUpdate: true,
                content: '',
                onShow(instance) {
                    if (window.lastScrollTime && Date.now() < window.lastScrollTime + 500) {
                        clearTimeout(XenForo._ShowPreviewTimeout);
                        XenForo._ShowPreviewTimeout = setTimeout(() => {
                            if (!(window.lastScrollTime && Date.now() < window.lastScrollTime + 500)) {
                                $el[0]._tippy.show();
                            }
                        }, 700);
                        return false;
                    }
                    if (XenForo._ActivePreviewTooltip && XenForo._ActivePreviewTooltip !== instance) {
                        XenForo._ActivePreviewTooltip.hide();
                    }
                    if (!loaded) {
                        XenForo.ajax(previewUrl + 'preview', {}, ajaxData => {
                            loaded = true;
                            instance.setContent(ajaxData.templateHtml);
                            if ($el.is(':hover')) {
                                instance.show();
                                XenForo._ActivePreviewTooltip = instance;
                            }
                        });
                        return false;
                    }
                    XenForo._ActivePreviewTooltip = instance;
                    return true;
                }
            });
        };

        function processThread(thread) {
            minimalisticThread(thread);
            XenForo.MinimalisticThreadPreview($(thread));
        }

        $('.discussionListMainPage .discussionListItem').each(function () {
            processThread(this);
        });

        const originalActivate = XenForo.activate;
        XenForo.activate = function($content) {
            const result = originalActivate.apply(this, arguments);
            $($content).each(function(){
                if (this.nodeType !== 1) return;
                $(this).find('.discussionListItem').each(processThread);
                if (this.classList.contains('discussionListItem')) processThread(this);
            });
            return result;
        };
    }

    waitForXenForo();
})();