MediaWiki:Common.js: відмінності між версіями

нема опису редагування
Немає опису редагування
Немає опису редагування
Рядок 1195: Рядок 1195:
     fixProfileIcons();
     fixProfileIcons();
     setTimeout(fixProfileIcons, 300);
     setTimeout(fixProfileIcons, 300);
});
// ── Додати в кінець Common.js ──
// 2. PROFILE ICONS — розгортаємо <p> яку MediaWiki додає всередину
$(function () {
    function fixProfileGrid() {
        $('.profile-links-icons').each(function () {
            var $wrap = $(this);
            // Якщо всередині є <p> — переносимо її дітей прямо в grid
            var $p = $wrap.find('> p');
            if ($p.length) {
                $p.children().appendTo($wrap);
                $p.remove();
            }
            // Примусово задаємо grid
            $wrap.css({
                'display': 'grid',
                'grid-template-columns': 'repeat(4, 1fr)',
                'gap': '0'
            });
            // Розміри іконок
            $wrap.find('.profile-icon').css({
                'display': 'flex',
                'align-items': 'center',
                'justify-content': 'center',
                'padding': '13px 4px',
                'float': 'none',
                'width': 'auto',
                'min-width': '0',
                'overflow': 'hidden',
                'border-right': '1px solid rgba(255,255,255,0.06)'
            });
            $wrap.find('.profile-icon:last-child').css('border-right', 'none');
            // Фіксуємо розміри картинок
            $wrap.find('.profile-icon img, .profile-icon .mw-file-element').css({
                'width': '22px',
                'height': '22px',
                'max-width': '22px',
                'object-fit': 'contain',
                'display': 'block'
            });
            // Обгортки від MediaWiki
            $wrap.find('.profile-icon span, .profile-icon .mw-default-size').css({
                'display': 'flex',
                'align-items': 'center',
                'justify-content': 'center',
                'line-height': '0'
            });
        });
    }
    fixProfileGrid();
    setTimeout(fixProfileGrid, 400);
});
});