Открыть меню
Переключить меню настроек
Открыть персональное меню
Вы не представились системе
Ваш IP-адрес будет виден всем, если вы внесёте какие-либо изменения.

MediaWiki:Test.js: различия между версиями

Страница интерфейса MediaWiki
Нет описания правки
Метка: отменено
Нет описания правки
 
(не показано 26 промежуточных версий этого же участника)
Строка 1: Строка 1:
if (mw.config.get('wgPageName') === 'Участник:Dantes') {
(function() {  
if (mw.config.get('wgPageName') === 'Название_Страницы') {
    if (typeof mw === 'undefined' || !window.document) return;
 
      
     var colors = ['#ff0000', '#00ff00', '#0000ff', '#ffff00', '#ff00ff', '#00ffff', '#ffffff', '#ff8000'];
     function initCollapse() {
     var emojis = ['💥', '🔥', '🎉', '👾', '💀', '🤡', '👻', '🌈', '🚀', '💩', '🍕', '🦄', '😱', '🙀', '💫', '⭐', '🌀'];
        var headings = document.querySelectorAll('.chem-heading');  
 
        var hi = 0;  
    var chaosText = document.createElement('div');
        var len = headings.length;  
    chaosText.className = 'chaos-text';
        for (; hi < len; hi++) {
    chaosText.textContent = 'ХАОС!';
            (function(node) {  
    chaosText.style.position = 'fixed';
                if (node.getAttribute('data-chem-attached')) return;  
    chaosText.style.top = '50%';
                node.setAttribute('data-chem-attached', '1');  
    chaosText.style.left = '50%';
                node.style.cursor = 'pointer';  
    chaosText.style.transform = 'translate(-50%, -50%)';
                node.addEventListener('click', function() {
    chaosText.style.fontSize = '10vw';
                    var kind = node.getAttribute('data-kind') || '';  
    chaosText.style.fontWeight = '900';
                    var wrapper = findWrapper(node, kind);  
    chaosText.style.color = '#ff0000';
                    if (!wrapper) return;  
    chaosText.style.textAlign = 'center';
                    var btn = node.querySelector('.collapse-btn');  
    chaosText.style.zIndex = '1000';
                   
    chaosText.style.textShadow = '0 0 20px #ffff00, 0 0 30px #ff00ff';
                    if (wrapper.classList.contains('collapsed')) {  
    document.body.appendChild(chaosText);
                        wrapper.classList.remove('collapsed');  
 
                        wrapper.classList.add('expanded');  
    function createEmojiSprite() {
                        wrapper.style.maxHeight = wrapper.scrollHeight + 'px';  
        var emoji = document.createElement('div');
                        if (btn) btn.textContent = 'свернуть';  
        emoji.className = 'emoji';
                        var cleanup = function() {  
        emoji.textContent = emojis[Math.floor(Math.random() * emojis.length)];
                            wrapper.style.maxHeight = '';  
        emoji.style.position = 'absolute';
                            wrapper.removeEventListener('transitionend', cleanup);  
        emoji.style.pointerEvents = 'none';
                        };  
        emoji.style.userSelect = 'none';
                        wrapper.addEventListener('transitionend', cleanup);  
        emoji.style.fontSize = Math.random() * 60 + 20 + 'px';
                    } else {  
        emoji.style.color = colors[Math.floor(Math.random() * colors.length)];
                        var currentHeight = wrapper.scrollHeight;  
        emoji.style.left = Math.random() * window.innerWidth + 'px';
                        wrapper.style.maxHeight = currentHeight + 'px';  
        emoji.style.top = Math.random() * window.innerHeight + 'px';
                        wrapper.offsetHeight;  
        document.body.appendChild(emoji);
                        wrapper.classList.remove('expanded');  
 
                        wrapper.classList.add('collapsed');  
        var x = parseFloat(emoji.style.left);
                        wrapper.style.maxHeight = '0px';  
        var y = parseFloat(emoji.style.top);
                        if (btn) btn.textContent = 'развернуть';  
        var xSpeed = (Math.random() - 0.5) * 10;
                    }
        var ySpeed = (Math.random() - 0.5) * 10;
                });  
        var rotation = 0;
            })(headings[hi]);  
        var rotationSpeed = (Math.random() - 0.5) * 20;
         }
 
    }
        function move() {
   
            x += xSpeed;
    function findWrapper(node, kind) {
            y += ySpeed;
         var parent = node.parentNode;  
            rotation += rotationSpeed;
         if (!parent) return null;  
 
         var wrappers = parent.querySelectorAll('.collapsible');  
            if (x <= 0 || x >= window.innerWidth - 50) xSpeed = -xSpeed * 1.1;
         var wi = 0;  
            if (y <= 0 || y >= window.innerHeight - 50) ySpeed = -ySpeed * 1.1;
         var wlen = wrappers.length;  
 
         for (; wi < wlen; wi++) {
            emoji.style.left = x + 'px';
             if (wrappers[wi].getAttribute('data-kind') === kind) {
            emoji.style.top = y + 'px';
                return wrappers[wi];  
            emoji.style.transform = 'rotate(' + rotation + 'deg)';
             }
 
         }  
            requestAnimationFrame(move);
         return null;  
        }
     }  
        move();
      
    }
     if (document.readyState === 'complete' || document.readyState === 'interactive') {
 
         initCollapse();  
    function flickerBackground() {
     } else {
        document.body.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
        document.addEventListener('DOMContentLoaded', initCollapse);  
        setTimeout(flickerBackground, Math.random() * 200);
    }  
    }
})();
 
    function changeText() {
        var texts = ['ХАОС!', 'БЕЗУМИЕ!', 'АААА!', 'ПОМОГИ!', 'СТОП!', 'SOS!', '🎪 ЦИРК! 🎪'];
        chaosText.textContent = texts[Math.floor(Math.random() * texts.length)];
        chaosText.style.color = colors[Math.floor(Math.random() * colors.length)];
        setTimeout(changeText, Math.random() * 500);
    }
 
    function createImageSprite() {
        var img = document.createElement('div');
        img.className = 'sprite';
        img.style.position = 'absolute';
        img.style.pointerEvents = 'none';
        img.style.userSelect = 'none';
        img.style.width = Math.random() * 100 + 50 + 'px';
        img.style.height = Math.random() * 100 + 50 + 'px';
        img.style.backgroundColor = colors[Math.floor(Math.random() * colors.length)];
        img.style.borderRadius = Math.random() > 0.5 ? '50%' : '0';
        img.style.left = Math.random() * window.innerWidth + 'px';
        img.style.top = Math.random() * window.innerHeight + 'px';
         img.style.opacity = Math.random() * 0.7 + 0.3;
        document.body.appendChild(img);
 
        var x = parseFloat(img.style.left);
         var y = parseFloat(img.style.top);
         var xSpeed = (Math.random() - 0.5) * 8;
         var ySpeed = (Math.random() - 0.5) * 8;
         var scale = 1;
         var scaleSpeed = (Math.random() - 0.5) * 0.1;
 
         function move() {
            x += xSpeed;
            y += ySpeed;
            scale += scaleSpeed;
 
             if (x <= 0 || x >= window.innerWidth - 100) xSpeed = -xSpeed * 1.05;
            if (y <= 0 || y >= window.innerHeight - 100) ySpeed = -ySpeed * 1.05;
            if (scale <= 0.3 || scale >= 2) scaleSpeed = -scaleSpeed;
 
            img.style.left = x + 'px';
             img.style.top = y + 'px';
            img.style.transform = 'scale(' + scale + ')';
            requestAnimationFrame(move);
         }
         move();
     }
 
     setInterval(createEmojiSprite, 100);
     setInterval(createImageSprite, 300);
    flickerBackground();
    changeText();
 
    function shakePage() {
        document.body.style.transform = 'translate(' + (Math.random() * 20 - 10) + 'px,' + (Math.random() * 20 - 10) + 'px)';
         setTimeout(shakePage, 50);
     }
    shakePage();
 
    document.body.addEventListener('click', function() {
        for (var i = 0; i < 10; i++) {
            createEmojiSprite();
            createImageSprite();
        }
    });
 
    window.addEventListener('resize', function() {
        for (var i = 0; i < 5; i++) createEmojiSprite();
    });
}
}

Текущая версия от 13:10, 4 апреля 2026

(function() { 
    if (typeof mw === 'undefined' || !window.document) return; 
    
    function initCollapse() { 
        var headings = document.querySelectorAll('.chem-heading'); 
        var hi = 0; 
        var len = headings.length; 
        for (; hi < len; hi++) { 
            (function(node) { 
                if (node.getAttribute('data-chem-attached')) return; 
                node.setAttribute('data-chem-attached', '1'); 
                node.style.cursor = 'pointer'; 
                node.addEventListener('click', function() { 
                    var kind = node.getAttribute('data-kind') || ''; 
                    var wrapper = findWrapper(node, kind); 
                    if (!wrapper) return; 
                    var btn = node.querySelector('.collapse-btn'); 
                    
                    if (wrapper.classList.contains('collapsed')) { 
                        wrapper.classList.remove('collapsed'); 
                        wrapper.classList.add('expanded'); 
                        wrapper.style.maxHeight = wrapper.scrollHeight + 'px'; 
                        if (btn) btn.textContent = 'свернуть'; 
                        var cleanup = function() { 
                            wrapper.style.maxHeight = ''; 
                            wrapper.removeEventListener('transitionend', cleanup); 
                        }; 
                        wrapper.addEventListener('transitionend', cleanup); 
                    } else { 
                        var currentHeight = wrapper.scrollHeight; 
                        wrapper.style.maxHeight = currentHeight + 'px'; 
                        wrapper.offsetHeight; 
                        wrapper.classList.remove('expanded'); 
                        wrapper.classList.add('collapsed'); 
                        wrapper.style.maxHeight = '0px'; 
                        if (btn) btn.textContent = 'развернуть'; 
                    } 
                }); 
            })(headings[hi]); 
        } 
    } 
    
    function findWrapper(node, kind) { 
        var parent = node.parentNode; 
        if (!parent) return null; 
        var wrappers = parent.querySelectorAll('.collapsible'); 
        var wi = 0; 
        var wlen = wrappers.length; 
        for (; wi < wlen; wi++) { 
            if (wrappers[wi].getAttribute('data-kind') === kind) { 
                return wrappers[wi]; 
            } 
        } 
        return null; 
    } 
    
    if (document.readyState === 'complete' || document.readyState === 'interactive') { 
        initCollapse(); 
    } else { 
        document.addEventListener('DOMContentLoaded', initCollapse); 
    } 
})();