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

Страница интерфейса MediaWiki
Нет описания правки
Метка: отменено
Нет описания правки
 
(не показаны 23 промежуточные версии этого же участника)
Строка 1: Строка 1:
if (mw.config.get('wgPageName') === 'Участник:Dantes') {
(function(){
if(typeof mw==='undefined') return;


    var colors = ['#ff0000', '#00ff00', '#0000ff', '#ffff00', '#ff00ff', '#00ffff', '#ffffff', '#ff8000'];
var map={
    var emojis = ['💥', '🔥', '🎉', '👾', '💀', '🤡', '👻', '🌈', '🚀', '💩', '🍕', '🦄', '😱', '🙀', '💫', '⭐', '🌀'];
"Клише":"#ff4d4d",
"властью":"#4dff4d",
"ответственность":"#4d4dff",
"Стандартные Рабочие Процедуры":"#ff4dff",
"ядерный":"#ffa500",
"станции":"#4dffff",
"ГСБ":"#b84dff",
"диск":"#4dff88",
"СРП/КЗ":"#ffb6c1",
"банановая кожурка":"#ffff4d"
};


    var chaosText = document.createElement('div');
function esc(s){return s.replace(/[.*+?^${}()|[\]\\]/g,'\\$&');}
    chaosText.className = 'chaos-text';
    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);


    function randomItem(arr) {
function walk(node){
        return arr[Math.floor(Math.random() * arr.length)];
if(node.nodeType===3){
    }
var t=node.nodeValue, r=t;
 
for(var k in map){
    function createEmojiSprite() {
r=r.replace(new RegExp(esc(k),'g'),'<span style="color:'+map[k]+'">'+k+'</span>');
        var emoji = document.createElement('div');
}
        emoji.className = 'emoji';
if(r!==t){
        emoji.textContent = randomItem(emojis);
var s=document.createElement('span');
        emoji.style.position = 'absolute';
s.innerHTML=r;
        emoji.style.pointerEvents = 'none';
node.parentNode.replaceChild(s,node);
        emoji.style.userSelect = 'none';
}
        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.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 = 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() {
var nodes=document.querySelectorAll('.mw-parser-output p, .mw-parser-output li');
        for (var i = 0; i < 5; i++) createEmojiSprite();
for(var i=0;i<nodes.length;i++){
    });
var cn=nodes[i].childNodes;
for(var j=0;j<cn.length;j++) walk(cn[j]);
}
}
})();

Текущая версия от 11:16, 17 января 2026

(function(){
if(typeof mw==='undefined') return;

var map={
"Клише":"#ff4d4d",
"властью":"#4dff4d",
"ответственность":"#4d4dff",
"Стандартные Рабочие Процедуры":"#ff4dff",
"ядерный":"#ffa500",
"станции":"#4dffff",
"ГСБ":"#b84dff",
"диск":"#4dff88",
"СРП/КЗ":"#ffb6c1",
"банановая кожурка":"#ffff4d"
};

function esc(s){return s.replace(/[.*+?^${}()|[\]\\]/g,'\\$&');}

function walk(node){
if(node.nodeType===3){
var t=node.nodeValue, r=t;
for(var k in map){
r=r.replace(new RegExp(esc(k),'g'),'<span style="color:'+map[k]+'">'+k+'</span>');
}
if(r!==t){
var s=document.createElement('span');
s.innerHTML=r;
node.parentNode.replaceChild(s,node);
}
}
}

var nodes=document.querySelectorAll('.mw-parser-output p, .mw-parser-output li');
for(var i=0;i<nodes.length;i++){
var cn=nodes[i].childNodes;
for(var j=0;j<cn.length;j++) walk(cn[j]);
}
})();