Top.Mail.Ru
Ответы

Вам помочь решил как вернуть старый мэйл ру ответы

Скачайте ViolentMonkey и пишите этот код

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
// ==UserScript==
// @name         Вопросы + авторы + время + аватар
// @namespace    https://example.com/
// @version      0.92
// @description  Список вопросов с ником, временем и аватаром (исключая тело поста)
// @match        https://otvet.mail.ru/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const boxId = 'custom-question-box';

    // Создаёт/возвращает окно с кнопками и заголовком
    function ensureUI() {
        let box = document.getElementById(boxId);
        if (box) return box;

        box = document.createElement('div');
        box.id = boxId;
        box.style = `
            position: fixed;
            top: 10px;
            right: 10px;
            width: 400px;
            max-height: 90vh;
            overflow-y: auto;
            background: white;
            border: 1px solid black;
            padding: 0px;
            z-index: 9999;
            font-family: sans-serif;
            font-size: 14px;
            box-shadow: 0 0 10px rgba(0,0,0,0.3);
        `;

        const header = document.createElement('div');
        header.style = `
            position: sticky;
            top: 0;
            background: #eee;
            padding: 5px 10px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid #ccc;
            font-weight: bold;
            z-index: 10;
        `;

        const title = document.createElement('span');
        title.textContent = '🔗 Ссылки';
        header.appendChild(title);

        const controls = document.createElement('div');
        controls.style = `
            display: flex;
            gap: 5px;
        `;

        function makeBtn(label, title, onClick) {
            const btn = document.createElement('button');
            btn.textContent = label;
            btn.title = title;
            btn.style = `
                width: 24px;
                height: 24px;
                padding: 0;
                border: none;
                background: #ccc;
                cursor: pointer;
                border-radius: 3px;
                font-size: 12px;
                font-weight: bold;
            `;
            btn.onclick = onClick;
            return btn;
        }

        const defaultSize = { width: '400px', height: '', top: '10px', right: '10px' };

        controls.appendChild(makeBtn('⟳', 'Обновить', () => refreshBoxContent()));
        controls.appendChild(makeBtn('X', 'Закрыть', () => box.remove()));
        controls.appendChild(makeBtn('-', 'Свернуть', () => {
            box.style.height = '30px';
            box.style.overflow = 'hidden';
        }));
        controls.appendChild(makeBtn('R', 'Восстановить', () => {
            box.style.width = defaultSize.width;
            box.style.height = defaultSize.height;
            box.style.top = defaultSize.top;
            box.style.right = defaultSize.right;
            box.style.overflow = 'auto';
        }));

        controls.appendChild(makeBtn('+', 'На весь экран', () => {
            box.style.top = '0';
            box.style.right = '0';
            box.style.width = '100vw';
            box.style.height = '100vh';
            box.style.overflow = 'auto';
        }));

        header.appendChild(controls);
        box.appendChild(header);

        document.body.appendChild(box);
        return box;
    }

    // Находит время поста рядом с ссылкой
    function findPostTime(link) {
        let el = link;
        for (let i = 0; i < 5; i++) {
            el = el.parentElement;
            if (!el) break;
            const timeEl = el.querySelector('._text_1o2qj_1');
            if (timeEl) return timeEl.textContent.trim();
        }
        return '—';
    }

    // Находит ник и аватар пользователя рядом с ссылкой
    function findUserInfo(link) {
        let el = link;
        for (let i = 0; i < 5; i++) {
            el = el.parentElement;
            if (!el) break;
            const profileLink = el.querySelector('a[href^="/profile/"]');
            if (profileLink) {
                const m = profileLink.href.match(/\/profile\/([^\/\?]+)/);
                if (m && m[1]) {
                    const img = el.querySelector('a._ImageBase_w8ijr_1 img');
                    const avatar = img ? img.src : null;
                    return { nickname: m[1], avatar };
                }
            }
        }
        return null;
    }

    // Обрабатывает новые ссылки и добавляет в окно
    function processNewQuestions() {
        const contentDiv = document.getElementById(boxId);
        if (!contentDiv) return;

        const questionLinks = Array.from(document.querySelectorAll('a[href^="/question/"]:not([data-processed])'))
            .filter(link => !link.classList.contains('_noUnderline_1xeik_9')); // исключаем тело поста

        questionLinks.forEach(link => {
            const userInfo = findUserInfo(link);
            if (!userInfo) {
                link.setAttribute('data-processed', '1');
                return;
            }

            link.setAttribute('data-processed', '1');

            const href = link.href;
            const title = link.textContent.trim();
            const postTime = findPostTime(link);

            const entry = document.createElement('div');
            entry.style = 'margin-bottom: 10px; word-break: break-word; display: flex; align-items: center; gap: 8px;';

            let avatarHTML = '';
            if (userInfo.avatar) {
                avatarHTML = `<img src="${userInfo.avatar}" alt="Аватар" style="width:32px; height:32px; border-radius:50%; object-fit:cover;">`;
            }

            entry.innerHTML = `
                ${avatarHTML}
                <div>
                    <b>${userInfo.nickname}</b> [${postTime}]: <a href="${href}" target="_blank" rel="noopener">${title}</a>
                </div>
            `;

            contentDiv.appendChild(entry);
        });
    }

    // Новая функция полностью обновляет содержимое окна,
    // очищает старые записи и сбрасывает пометки data-processed,
    // чтобы заново обработать все ссылки на странице.
    function refreshBoxContent() {
        const box = ensureUI();

        // Удаляем все записи, кроме заголовка (первый элемент - header)
        while (box.children.length > 1) {
            box.removeChild(box.lastChild);
        }

        // Сбрасываем обработанные метки, чтобы заново обработать ссылки
        document.querySelectorAll('a[href^="/question/"][data-processed]').forEach(link => {
            link.removeAttribute('data-processed');
        });

        // Добавляем заново
        processNewQuestions();
    }

    // Запускает UI и наблюдатель мутаций для автоматического обновления
    function startObserver() {
        if (location.pathname.includes('/question/')) return; // не показываем окно на страницах вопроса

        ensureUI();
        processNewQuestions();

        const observer = new MutationObserver(() => {
            processNewQuestions();
        });

        observer.observe(document.body, {
            childList: true,
            subtree: true
        });
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', startObserver);
    } else {
        startObserver();
    }
})();
По дате
По Рейтингу
Аватар пользователя
Просветленный
3нед

сделай расширение для браузеров.

Аватар пользователя
Мыслитель
3нед

спасибо

Аватар пользователя
Знаток
3нед

Переиграл и уничтожил Рианочку.

Аватар пользователя
Высший разум
3нед

Это работает?