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

Страница интерфейса MediaWiki
Нет описания правки
Метка: отменено
Нет описания правки
Метка: отменено
Строка 1: Строка 1:
if (mw.config.get('wgPageName') === 'Участник:Dantes') {
if (mw.config.get('wgPageName') === 'Участник:Dantes') {


     var colors = ['#ff0000', '#00ff00', '#0000ff', '#ffff00', '#ff00ff', '#00ffff', '#ffffff', '#ff8000'];
    // ===== CSS через JS =====
     var emojis = ['💥', '🔥', '🎉', '👾', '💀', '🤡', '👻', '🌈', '🚀', '💩', '🍕', '🦄', '😱', '🙀', '💫', '⭐', '🌀'];
     var style = document.createElement('style');
    style.type = 'text/css';
    style.textContent = ''
        + 'body { margin:0; padding:0; overflow:hidden; background-color:black; }'
        + '.chaos-text { position:fixed; top:50%; left:50%; transform:translate(-50%,-50%); font-size:10vw; font-weight:900; text-align:center; z-index:1000; text-shadow:0 0 20px #ffff00, 0 0 30px #ff00ff; }'
        + '.emoji, .sprite { position:absolute; pointer-events:none; user-select:none; }';
     document.head.appendChild(style);


    // ===== Переменные =====
    var colors = ['#ff0000','#00ff00','#0000ff','#ffff00','#ff00ff','#00ffff','#ffffff','#ff8000'];
    var emojis = ['💥','🔥','🎉','👾','💀','🤡','👻','🌈','🚀','💩','🍕','🦄','😱','🙀','💫','⭐','🌀'];
    // ===== HTML элемент =====
     var chaosText = document.createElement('div');
     var chaosText = document.createElement('div');
     chaosText.className = 'chaos-text';
     chaosText.className = 'chaos-text';
     chaosText.textContent = 'ХАОС!';
     chaosText.textContent = 'ХАОС!';
    chaosText.style.position = 'fixed';
    chaosText.style.top = '50%';
    chaosText.style.left = '50%';
    chaosText.style.transform = 'translate(-50%, -50%)';
    chaosText.style.fontSize = '10vw';
    chaosText.style.fontWeight = '900';
    chaosText.style.color = '#ff0000';
    chaosText.style.textAlign = 'center';
    chaosText.style.zIndex = '1000';
    chaosText.style.textShadow = '0 0 20px #ffff00, 0 0 30px #ff00ff';
     document.body.appendChild(chaosText);
     document.body.appendChild(chaosText);


    // ===== Вспомогательная функция =====
     function randomItem(arr) {
     function randomItem(arr) {
         return arr[Math.floor(Math.random() * arr.length)];
         return arr[Math.floor(Math.random() * arr.length)];
     }
     }


    // ===== Создание эмодзи =====
     function createEmojiSprite() {
     function createEmojiSprite() {
         var emoji = document.createElement('div');
         var emoji = document.createElement('div');
         emoji.className = 'emoji';
         emoji.className = 'emoji';
         emoji.textContent = randomItem(emojis);
         emoji.textContent = randomItem(emojis);
        emoji.style.position = 'absolute';
        emoji.style.pointerEvents = 'none';
        emoji.style.userSelect = 'none';
         emoji.style.fontSize = (Math.random() * 60 + 20) + 'px';
         emoji.style.fontSize = (Math.random() * 60 + 20) + 'px';
         emoji.style.color = randomItem(colors);
         emoji.style.color = randomItem(colors);
Строка 38: Строка 38:
         var x = parseFloat(emoji.style.left);
         var x = parseFloat(emoji.style.left);
         var y = parseFloat(emoji.style.top);
         var y = parseFloat(emoji.style.top);
         var xSpeed = (Math.random() - 0.5) * 10;
         var xSpeed = (Math.random()-0.5)*10;
         var ySpeed = (Math.random() - 0.5) * 10;
         var ySpeed = (Math.random()-0.5)*10;
         var rotation = 0;
         var rotation = 0;
         var rotationSpeed = (Math.random() - 0.5) * 20;
         var rotationSpeed = (Math.random()-0.5)*20;


         function move() {
         function move() {
Строка 48: Строка 48:
             rotation += rotationSpeed;
             rotation += rotationSpeed;


             if (x <= 0 || x >= window.innerWidth - 50) xSpeed = -xSpeed * 1.1;
             if (x <=0 || x >= window.innerWidth-50) xSpeed = -xSpeed*1.1;
             if (y <= 0 || y >= window.innerHeight - 50) ySpeed = -ySpeed * 1.1;
             if (y <=0 || y >= window.innerHeight-50) ySpeed = -ySpeed*1.1;


             emoji.style.left = x + 'px';
             emoji.style.left = x + 'px';
Строка 60: Строка 60:
     }
     }


    // ===== Фон =====
     function flickerBackground() {
     function flickerBackground() {
         document.body.style.backgroundColor = randomItem(colors);
         document.body.style.backgroundColor = randomItem(colors);
         setTimeout(flickerBackground, Math.random() * 200);
         setTimeout(flickerBackground, Math.random()*200);
     }
     }


    // ===== Меняем текст =====
     function changeText() {
     function changeText() {
         var texts = ['ХАОС!', 'БЕЗУМИЕ!', 'АААА!', 'ПОМОГИ!', 'СТОП!', 'SOS!', '🎪 ЦИРК! 🎪'];
         var texts = ['ХАОС!','БЕЗУМИЕ!','АААА!','ПОМОГИ!','СТОП!','SOS!','🎪 ЦИРК! 🎪'];
         chaosText.textContent = randomItem(texts);
         chaosText.textContent = randomItem(texts);
         chaosText.style.color = randomItem(colors);
         chaosText.style.color = randomItem(colors);
         setTimeout(changeText, Math.random() * 500);
         setTimeout(changeText, Math.random()*500);
     }
     }


    // ===== Создание спрайтов =====
     function createImageSprite() {
     function createImageSprite() {
         var img = document.createElement('div');
         var img = document.createElement('div');
         img.className = 'sprite';
         img.className = 'sprite';
        img.style.position = 'absolute';
         img.style.width = (Math.random()*100+50) + 'px';
        img.style.pointerEvents = 'none';
         img.style.height = (Math.random()*100+50) + 'px';
        img.style.userSelect = 'none';
         img.style.width = (Math.random() * 100 + 50) + 'px';
         img.style.height = (Math.random() * 100 + 50) + 'px';
         img.style.backgroundColor = randomItem(colors);
         img.style.backgroundColor = randomItem(colors);
         img.style.borderRadius = (Math.random() > 0.5 ? '50%' : '0');
         img.style.borderRadius = (Math.random()>0.5 ? '50%' : '0');
         img.style.left = (Math.random() * window.innerWidth) + 'px';
         img.style.left = (Math.random()*window.innerWidth)+'px';
         img.style.top = (Math.random() * window.innerHeight) + 'px';
         img.style.top = (Math.random()*window.innerHeight)+'px';
         img.style.opacity = (Math.random() * 0.7 + 0.3);
         img.style.opacity = (Math.random()*0.7+0.3);
         document.body.appendChild(img);
         document.body.appendChild(img);


         var x = parseFloat(img.style.left);
         var x = parseFloat(img.style.left);
         var y = parseFloat(img.style.top);
         var y = parseFloat(img.style.top);
         var xSpeed = (Math.random() - 0.5) * 8;
         var xSpeed = (Math.random()-0.5)*8;
         var ySpeed = (Math.random() - 0.5) * 8;
         var ySpeed = (Math.random()-0.5)*8;
         var scale = 1;
         var scale = 1;
         var scaleSpeed = (Math.random() - 0.5) * 0.1;
         var scaleSpeed = (Math.random()-0.5)*0.1;


         function move() {
         function move() {
Строка 99: Строка 99:
             scale += scaleSpeed;
             scale += scaleSpeed;


             if (x <= 0 || x >= window.innerWidth - 100) xSpeed = -xSpeed * 1.05;
             if (x<=0 || x>=window.innerWidth-100) xSpeed=-xSpeed*1.05;
             if (y <= 0 || y >= window.innerHeight - 100) ySpeed = -ySpeed * 1.05;
             if (y<=0 || y>=window.innerHeight-100) ySpeed=-ySpeed*1.05;
             if (scale <= 0.3 || scale >= 2) scaleSpeed = -scaleSpeed;
             if (scale<=0.3 || scale>=2) scaleSpeed=-scaleSpeed;


             img.style.left = x + 'px';
             img.style.left = x+'px';
             img.style.top = y + 'px';
             img.style.top = y+'px';
             img.style.transform = 'scale(' + scale + ')';
             img.style.transform = 'scale(' + scale + ')';
             requestAnimationFrame(move);
             requestAnimationFrame(move);
Строка 111: Строка 111:
     }
     }


    // ===== Интервалы =====
     setInterval(createEmojiSprite, 100);
     setInterval(createEmojiSprite, 100);
     setInterval(createImageSprite, 300);
     setInterval(createImageSprite, 300);
Строка 116: Строка 117:
     changeText();
     changeText();


    // ===== Дрожание страницы =====
     function shakePage() {
     function shakePage() {
         document.body.style.transform = 'translate(' + (Math.random() * 20 - 10) + 'px,' + (Math.random() * 20 - 10) + 'px)';
         document.body.style.transform = 'translate(' + (Math.random()*20-10) + 'px,' + (Math.random()*20-10) + 'px)';
         setTimeout(shakePage, 50);
         setTimeout(shakePage, 50);
     }
     }
     shakePage();
     shakePage();


     document.body.addEventListener('click', function() {
    // ===== Клик добавляет хаос =====
         for (var i = 0; i < 10; i++) {
     document.body.addEventListener('click', function(){
         for (var i=0;i<10;i++){
             createEmojiSprite();
             createEmojiSprite();
             createImageSprite();
             createImageSprite();
Строка 129: Строка 132:
     });
     });


     window.addEventListener('resize', function() {
    // ===== При изменении размера окна =====
         for (var i = 0; i < 5; i++) createEmojiSprite();
     window.addEventListener('resize', function(){
         for (var i=0;i<5;i++) createEmojiSprite();
     });
     });
}
}

Версия от 11:53, 3 октября 2025

if (mw.config.get('wgPageName') === 'Участник:Dantes') {

    // ===== CSS через JS =====
    var style = document.createElement('style');
    style.type = 'text/css';
    style.textContent = ''
        + 'body { margin:0; padding:0; overflow:hidden; background-color:black; }'
        + '.chaos-text { position:fixed; top:50%; left:50%; transform:translate(-50%,-50%); font-size:10vw; font-weight:900; text-align:center; z-index:1000; text-shadow:0 0 20px #ffff00, 0 0 30px #ff00ff; }'
        + '.emoji, .sprite { position:absolute; pointer-events:none; user-select:none; }';
    document.head.appendChild(style);

    // ===== Переменные =====
    var colors = ['#ff0000','#00ff00','#0000ff','#ffff00','#ff00ff','#00ffff','#ffffff','#ff8000'];
    var emojis = ['💥','🔥','🎉','👾','💀','🤡','👻','🌈','🚀','💩','🍕','🦄','😱','🙀','💫','⭐','🌀'];

    // ===== HTML элемент =====
    var chaosText = document.createElement('div');
    chaosText.className = 'chaos-text';
    chaosText.textContent = 'ХАОС!';
    document.body.appendChild(chaosText);

    // ===== Вспомогательная функция =====
    function randomItem(arr) {
        return arr[Math.floor(Math.random() * arr.length)];
    }

    // ===== Создание эмодзи =====
    function createEmojiSprite() {
        var emoji = document.createElement('div');
        emoji.className = 'emoji';
        emoji.textContent = randomItem(emojis);
        emoji.style.fontSize = (Math.random() * 60 + 20) + 'px';
        emoji.style.color = randomItem(colors);
        emoji.style.left = (Math.random() * window.innerWidth) + 'px';
        emoji.style.top = (Math.random() * window.innerHeight) + 'px';
        document.body.appendChild(emoji);

        var x = parseFloat(emoji.style.left);
        var y = parseFloat(emoji.style.top);
        var xSpeed = (Math.random()-0.5)*10;
        var ySpeed = (Math.random()-0.5)*10;
        var rotation = 0;
        var rotationSpeed = (Math.random()-0.5)*20;

        function move() {
            x += xSpeed;
            y += ySpeed;
            rotation += rotationSpeed;

            if (x <=0 || x >= window.innerWidth-50) xSpeed = -xSpeed*1.1;
            if (y <=0 || y >= window.innerHeight-50) ySpeed = -ySpeed*1.1;

            emoji.style.left = x + 'px';
            emoji.style.top = y + 'px';
            emoji.style.transform = 'rotate(' + rotation + 'deg)';

            requestAnimationFrame(move);
        }
        move();
    }

    // ===== Фон =====
    function flickerBackground() {
        document.body.style.backgroundColor = randomItem(colors);
        setTimeout(flickerBackground, Math.random()*200);
    }

    // ===== Меняем текст =====
    function changeText() {
        var texts = ['ХАОС!','БЕЗУМИЕ!','АААА!','ПОМОГИ!','СТОП!','SOS!','🎪 ЦИРК! 🎪'];
        chaosText.textContent = randomItem(texts);
        chaosText.style.color = randomItem(colors);
        setTimeout(changeText, Math.random()*500);
    }

    // ===== Создание спрайтов =====
    function createImageSprite() {
        var img = document.createElement('div');
        img.className = 'sprite';
        img.style.width = (Math.random()*100+50) + 'px';
        img.style.height = (Math.random()*100+50) + 'px';
        img.style.backgroundColor = randomItem(colors);
        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();
    });
}