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

нема опису редагування
Немає опису редагування
Немає опису редагування
Рядок 76: Рядок 76:


// Profile icons - grayscale if no URL, clickable if has URL
// Profile icons - grayscale if no URL, clickable if has URL
document.querySelectorAll('.profile-icon').forEach(function(icon) {
$(document).ready(function() {
    var url = icon.getAttribute('data-url');
    $('.profile-icon').each(function() {
    if (url && url.trim() !== '') {
        var icon = $(this);
        icon.style.cursor = 'pointer';
        var url = icon.attr('data-url');
        icon.addEventListener('click', function() {
        if (url && url.trim() !== '') {
            window.open(url, '_blank');
            icon.css('cursor', 'pointer');
        });
            icon.on('click', function() {
        icon.addEventListener('mouseenter', function() {
                window.open(url, '_blank');
            icon.style.background = '#444';
            });
        });
            icon.on('mouseenter', function() {
        icon.addEventListener('mouseleave', function() {
                icon.css('background', '#444');
            icon.style.background = '#333';
            });
        });
            icon.on('mouseleave', function() {
    } else {
                icon.css('background', '#333');
        icon.style.opacity = '0.3';
            });
        icon.style.filter = 'grayscale(100%)';
        } else {
        icon.style.cursor = 'default';
            icon.css({
     }
                'opacity': '0.3',
                'filter': 'grayscale(100%)',
                '-webkit-filter': 'grayscale(100%)',
                'cursor': 'default'
            });
        }
     });
});
});