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

Страница интерфейса MediaWiki
Нет описания правки
Нет описания правки
 
(не показано 120 промежуточных версий этого же участника)
Строка 1: Строка 1:
body {
(function(){
  background-color: #121212;
var canvas=document.createElement('canvas');
  color: #e0e0e0;
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)
});
}
}
#chemistry-recipes {
  margin-top: 1em;
}
}
 
var raf=window.requestAnimationFrame||window.webkitRequestAnimationFrame||function(fn){setTimeout(fn,16);};
/* Общий стиль карточек */
function loop(){
.chem-recipe {
ctx.clearRect(0,0,w,h);
  border-radius: 10px;
ctx.beginPath();
  margin-bottom: 1em;
for(var i=0;i<flakes.length;i++){
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
var f=flakes[i];
  overflow: hidden;
f.x+=f.vx;
  background-color: #1e1e1e;
f.y+=f.vy;
  color: #e0e0e0;
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);
.chem-header {
  padding: 0.8em 1em;
  font-weight: bold;
  font-size: 1.2em;
  cursor: pointer;
  user-select: none;
  color: #fff;
}
}
 
ctx.fillStyle='rgba(255,255,255,0.9)';
/* Контент карточки */
ctx.fill();
.chem-content {
raf(loop);
  padding: 1em;
  background-color: #262626;
  display: none;
}
 
.chem-content ul {
  margin: 0.4em 0 0.8em 1.2em;
  padding-left: 1em;
}
 
.chem-content p {
  margin: 0.4em 0;
}
 
.chem-content hr {
  border: none;
  border-top: 1px solid #444;
  margin: 0.5em 0;
}
 
/* Индивидуальные цвета */
.chem-mannitol .chem-header {
  background-color: #6a5acd; /* фиолетовый */
}
 
.chem-chlorine .chem-header {
  background-color: #9acd32; /* жёлто-зелёный */
}
 
.chem-fluorine .chem-header {
  background-color: #ffcc00; /* бледно-жёлтый */
  color: #000;
}
 
.chem-iron .chem-header {
  background-color: #b0b0b0; /* стальной серый */
  color: #000;
}
}
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();
})();