💀 Hide By User v1.0.0

EMPRESS Hide Torrents By Uploader Module (Now Standalone)

当前为 2025-06-23 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         💀 Hide By User v1.0.0
// @namespace    https://empornium.is/
// @version      1.0.0
// @description  EMPRESS Hide Torrents By Uploader Module (Now Standalone)
// @author       serpentGPT
// @match        https://*.empornium.is/*
// @match        https://*.empornium.sx/*
// @match        https://*.empornium.me/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const BLOCK_KEY = 'emp_hidden_uploaders';
    let lastBlocked = null;

    const get = (key) => {
        try {
            return JSON.parse(localStorage.getItem(key) || '[]');
        } catch {
            return [];
        }
    };
    const set = (key, value) => localStorage.setItem(key, JSON.stringify(value));

    function blockUploader(uploaderName) {
        const list = get(BLOCK_KEY);
        if (!list.includes(uploaderName)) {
            list.push(uploaderName);
            set(BLOCK_KEY, list);
            lastBlocked = uploaderName;
            hideTorrentsByUploader();
        }
    }

    function createBlockButton(uploaderName) {
        const btn = document.createElement('button');
        btn.classList.add('empress-btn');
        btn.textContent = '🧑‍🚫';
        btn.title = `Block torrents by ${uploaderName}`;
        btn.onclick = () => blockUploader(uploaderName);
        return btn;
    }

    function injectBlockButtons() {
        document.querySelectorAll('td.user').forEach(td => {
            if (td.dataset.blockInjected) return;
            const a = td.querySelector('a');
            if (!a) return;
            const name = a.textContent.trim();
            td.appendChild(createBlockButton(name));
            td.dataset.blockInjected = 'true';
        });
    }

    function hideTorrentsByUploader() {
        const blocked = get(BLOCK_KEY);
        document.querySelectorAll('tr').forEach(row => {
            const userTd = row.querySelector('td.user');
            if (!userTd) return;
            const a = userTd.querySelector('a');
            if (!a) return;
            const name = a.textContent.trim();
            if (blocked.includes(name)) {
                row.style.display = 'none';
            }
        });
    }

    function showBlockedUsersModal() {
        if (document.getElementById('blocked-users-modal')) return;

        const modal = document.createElement('div');
        modal.id = 'blocked-users-modal';
        modal.style = `
            position: fixed;
            top: 50%; left: 50%;
            transform: translate(-50%, -50%);
            background: #222; color: white;
            padding: 20px; border-radius: 10px;
            box-shadow: 0 0 10px hotpink;
            z-index: 10001;
            min-width: 300px;
        `;

        const close = document.createElement('div');
        close.textContent = '✖';
        close.style = 'float: right; cursor: pointer; color: hotpink; font-weight: bold;';
        close.onclick = () => modal.remove();

        const title = document.createElement('h3');
        title.textContent = 'Blocked Users';
        title.style = 'color: hotpink; margin-top: 0;';

        const textarea = document.createElement('textarea');
        textarea.value = get(BLOCK_KEY).join('\n');
        textarea.style = 'width:100%; height:120px; background:#111; color:white; border:1px solid hotpink; margin:10px 0;';

        const save = document.createElement('button');
        save.textContent = 'Save';
        save.style = 'background:hotpink; color:white; border:none; padding:6px 12px; cursor:pointer;';
        save.onclick = () => {
            const cleaned = textarea.value.split('\n').map(x => x.trim()).filter(x => x);
            set(BLOCK_KEY, cleaned);
            modal.remove();
            hideTorrentsByUploader();
        };

        modal.appendChild(close);
        modal.appendChild(title);
        modal.appendChild(textarea);
        modal.appendChild(save);
        document.body.appendChild(modal);
    }

    function addUserBarButton() {
        const wait = setInterval(() => {
            const stats = document.querySelector('#major_stats');
            if (!stats || document.getElementById('hide-user-btn')) return;

            clearInterval(wait);

            const ul = document.createElement('ul');
            ul.style.display = 'inline-block';
            const li = document.createElement('li');
            li.id = 'hide-user-btn';

            const a = document.createElement('a');
            a.href = '#';
            a.textContent = '🧑‍🚫 Blocked Users';
            a.onclick = (e) => {
                e.preventDefault();
                showBlockedUsersModal();
            };

            li.appendChild(a);
            ul.appendChild(li);
            stats.prepend(ul);
        }, 1000);
    }

    window.addEventListener('load', () => {
        injectBlockButtons();
        hideTorrentsByUploader();
        setInterval(() => {
            injectBlockButtons();
            hideTorrentsByUploader();
        }, 3000);
        addUserBarButton();
    });
})();