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

Страница интерфейса MediaWiki
Нет описания правки
Метка: отменено
Нет описания правки
 
(не показано 17 промежуточных версий этого же участника)
Строка 1: Строка 1:
if (mw.config.get('wgPageName') === 'Участник:Dantes') {
(function(){
if (mw.config.get('wgPageName') === 'Название_Страницы') {
var canvas=document.createElement('canvas');
 
canvas.style.position='fixed';
    var colors = ['#ff0000', '#00ff00', '#0000ff', '#ffff00', '#ff00ff', '#00ffff', '#ffffff', '#ff8000'];
canvas.style.left='0';
    var emojis = ['💥', '🔥', '🎉', '👾', '💀', '🤡', '👻', '🌈', '🚀', '💩', '🍕', '🦄', '😱', '🙀', '💫', '⭐', '🌀'];
canvas.style.top='0';
 
canvas.style.width='100%';
    var chaosText = document.createElement('div');
canvas.style.height='100%';
    chaosText.className = 'chaos-text';
canvas.style.pointerEvents='none';
    chaosText.textContent = 'ХАОС!';
canvas.style.zIndex='9999';
    chaosText.style.position = 'fixed';
document.documentElement.appendChild(canvas);
    chaosText.style.top = '50%';
var ctx=canvas.getContext('2d');
    chaosText.style.left = '50%';
var w=0,h=0,flakes=[];
    chaosText.style.transform = 'translate(-50%, -50%)';
function resize(){w=canvas.width=window.innerWidth;h=canvas.height=window.innerHeight;initFlakes();}
    chaosText.style.fontSize = '10vw';
function rand(a,b){return Math.random()*(b-a)+a;}
    chaosText.style.fontWeight = '900';
function initFlakes(){
    chaosText.style.color = '#ff0000';
flakes=[];
    chaosText.style.textAlign = 'center';
var count=Math.max(30,Math.floor(w/30));
    chaosText.style.zIndex = '1000';
for(var i=0;i<count;i++){
    chaosText.style.textShadow = '0 0 20px #ffff00, 0 0 30px #ff00ff';
flakes.push({
    document.body.appendChild(chaosText);
x:rand(0,w),
 
y:rand(-h, h),
    function createEmojiSprite() {
r:rand(0.8,2.6),
        var emoji = document.createElement('div');
vx:rand(-0.3,0.3),
        emoji.className = 'emoji';
vy:rand(0.4,1.2),
        emoji.textContent = emojis[Math.floor(Math.random() * emojis.length)];
o:rand(0.3,0.9)
        emoji.style.position = 'absolute';
});
        emoji.style.pointerEvents = 'none';
        emoji.style.userSelect = 'none';
        emoji.style.fontSize = Math.random() * 60 + 20 + 'px';
        emoji.style.color = colors[Math.floor(Math.random() * colors.length)];
        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 = colors[Math.floor(Math.random() * colors.length)];
        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();
    });
}
}
}
}
var raf=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(fn){setTimeout(fn,16);};
function loop(){
ctx.clearRect(0,0,w,h);
ctx.beginPath();
for(var i=0;i<flakes.length;i++){
var f=flakes[i];
f.x+=f.vx;
f.y+=f.vy;
f.vx+=Math.sin((Date.now()+i*100)%6000/6000*Math.PI*2)*0.005;
if(f.y>h+10||f.x<-50||f.x>w+50){
f.x=rand(0,w);
f.y=-10;
f.vx=rand(-0.3,0.3);
f.vy=rand(0.4,1.2);
}
ctx.moveTo(f.x,f.y);
ctx.arc(f.x,f.y,f.r,0,Math.PI*2);
}
ctx.fillStyle='rgba(255,255,255,0.9)';
ctx.fill();
raf(loop);
}
window.addEventListener('resize',resize);
resize();
loop();
})();

Текущая версия от 23:41, 22 ноября 2025

(function(){
var canvas=document.createElement('canvas');
canvas.style.position='fixed';
canvas.style.left='0';
canvas.style.top='0';
canvas.style.width='100%';
canvas.style.height='100%';
canvas.style.pointerEvents='none';
canvas.style.zIndex='9999';
document.documentElement.appendChild(canvas);
var ctx=canvas.getContext('2d');
var w=0,h=0,flakes=[];
function resize(){w=canvas.width=window.innerWidth;h=canvas.height=window.innerHeight;initFlakes();}
function rand(a,b){return Math.random()*(b-a)+a;}
function initFlakes(){
flakes=[];
var count=Math.max(30,Math.floor(w/30));
for(var i=0;i<count;i++){
flakes.push({
x:rand(0,w),
y:rand(-h, h),
r:rand(0.8,2.6),
vx:rand(-0.3,0.3),
vy:rand(0.4,1.2),
o:rand(0.3,0.9)
});
}
}
var raf=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(fn){setTimeout(fn,16);};
function loop(){
ctx.clearRect(0,0,w,h);
ctx.beginPath();
for(var i=0;i<flakes.length;i++){
var f=flakes[i];
f.x+=f.vx;
f.y+=f.vy;
f.vx+=Math.sin((Date.now()+i*100)%6000/6000*Math.PI*2)*0.005;
if(f.y>h+10||f.x<-50||f.x>w+50){
f.x=rand(0,w);
f.y=-10;
f.vx=rand(-0.3,0.3);
f.vy=rand(0.4,1.2);
}
ctx.moveTo(f.x,f.y);
ctx.arc(f.x,f.y,f.r,0,Math.PI*2);
}
ctx.fillStyle='rgba(255,255,255,0.9)';
ctx.fill();
raf(loop);
}
window.addEventListener('resize',resize);
resize();
loop();
})();