LZT Reviews Report Helper

this.account.delete();

安裝腳本?
作者推薦腳本

您可能也會喜歡 LZT Anti Hide

安裝腳本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         LZT Reviews Report Helper
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  this.account.delete();
// @author       @Aisan
// @match        https://lolz.live/threads/*
// @match        https://lolz.guru/threads/*
// @match        https://zelenka.guru/threads/*
// @grant window.close
// @icon         https://nztcdn.com/avatar/l/1724225284/3498309.webp
// @license MIT
// ==/UserScript==

const NEW_RULES_TIMESTAMP = 1693515600;
const SHOW_FIRST_POST = false;
const FOR_FREE_TEXTS = [
    'отзыв',
    'бесплатно',
    'free',
    'transaction',
    'tronscan',
];
const CURRENT_TIMESTAMP = parseInt(Date.now() / 1000);
const MAX_AGE = 60 * 60 * 24 * 9.8;

(function() {
    'use strict';

    function alreadyReported(element) {
        const warning = element.querySelector('.message_warning_message_block');
        return !!warning;
    }

    function isOlderThanTenDays(element) {
        const dateTimeElement = element.querySelector('span.DateTime');
        if (dateTimeElement) {
            const timestamp = parseInt(dateTimeElement.getAttribute('data-time'), 10);
            return timestamp < CURRENT_TIMESTAMP - MAX_AGE;
        }
        return false;
    }

    function hasTwoOrMoreImages(element) {
        const images = element.querySelectorAll('img.bbCodeImage');
        return images.length >= 2;
    }

    function containsHiddenContent(element) {
        const blockquote = element.querySelector('blockquote.hideContainer');
        return blockquote && blockquote.textContent.includes('Скрытый контент для команды форума.');
    }

    function containsForFree(element) {
        const article = element.querySelector('article');
        if (!article) return false;
        const innerText = article.textContent.toLowerCase();
        return FOR_FREE_TEXTS.some(text => innerText.includes(text));
    }

    function isOlderThanNewRules(element) {
        const dateTimeElement = element.querySelector('span.DateTime');
        if (dateTimeElement) {
            const timestamp = parseInt(dateTimeElement.getAttribute('data-time'), 10);
            return timestamp < NEW_RULES_TIMESTAMP;
        }
        return false;
    }

    function deleteGoodReviews() {
        const first_post = document.querySelector('li.message.firstPost');
        if (first_post && !SHOW_FIRST_POST) first_post.remove();
        const query = 'li.message:not(.firstPost)';
        const messages = document.querySelectorAll(query);
        messages.forEach(message => {
            if (hasTwoOrMoreImages(message)) message.remove();
            if (containsHiddenContent(message)) message.remove();
            if (containsForFree(message)) message.remove();
            if (alreadyReported(message)) message.remove();
            if (isOlderThanTenDays(message)) message.remove();
            else if (isOlderThanNewRules(message)) message.remove();
        });

        const remaining_messages = document.querySelectorAll(query);
        if (remaining_messages.length === 0) {
            goToNextPage();
        }
    }

    function goToNextPage() {
        const pageNavLinks = document.querySelectorAll('.pageNavLinkGroup nav a');
        if (pageNavLinks.length > 0) {
            const lastPageNumber = parseInt(pageNavLinks[pageNavLinks.length - 1].textContent, 10);
            const currentUrl = window.location.href;
            const currentPageMatch = currentUrl.match(/\/page-(\d+)/);
            let nextPageNumber = 2;
            if (currentPageMatch) {
                const currentPageNumber = parseInt(currentPageMatch[1], 10);
                if (currentPageNumber >= lastPageNumber) {
                    window.close();
                    return;
                }
                nextPageNumber = currentPageNumber + 1;
                window.location.href = currentUrl.replace(/\/page-\d+/, `/page-${nextPageNumber}`);
            } else {
                window.location.href = `${currentUrl}page-${nextPageNumber}`;
            }
        }
        else {
            window.close();
            return;
        }
    }

    setInterval(() => {
        deleteGoodReviews();
    }, 500)
})();