MediaWiki:Common.js:修订间差异
来自Fuckrooms Wiki
无编辑摘要 |
无编辑摘要 |
||
| 第1行: | 第1行: | ||
(function(){ | (function(){ | ||
window.snowflakes = window.snowflakes || []; | window.snowflakes = window.snowflakes || []; | ||
function createSnow(){ | function createSnow(){ | ||
const chars = ['❄','❅','❆','✦']; | const chars = ['❄','❅','❆','✦']; | ||
| 第19行: | 第19行: | ||
} | } | ||
setInterval(spawn, 500); | setInterval(spawn, 500); | ||
setTimeout(() => { setInterval(spawn, 3000) }, 10000); | setTimeout(() => { setInterval(spawn, 3000) }, 10000); | ||
} | } | ||
if(!document.getElementById('snowStyle')){ | if(!document.getElementById('snowStyle')){ | ||
const style = document.createElement('style'); | const style = document.createElement('style'); | ||
| 第35行: | 第35行: | ||
} | } | ||
document.addEventListener('visibilitychange', () => { | document.addEventListener('visibilitychange', () => { | ||
if(!document.hidden && snowflakes.length < 20) createSnow(); | if(!document.hidden && snowflakes.length < 20) createSnow(); | ||
}); | }); | ||
createSnow(); | createSnow(); | ||
})(); | })(); | ||
2025年4月14日 (一) 05:43的版本
(function(){
window.snowflakes = window.snowflakes || [];
function createSnow(){
const chars = ['❄','❅','❆','✦'];
function spawn(){
const flake = document.createElement('div');
flake.style = `position:fixed;top:-30px;color:#fff;z-index:9999;
pointer-events:none;user-select:none;font-size:${Math.random()*15+10}px;
left:${Math.random()*100}%;opacity:${Math.random()*0.5+0.5};
animation:snowFall ${Math.random()*8+5}s linear infinite`;
flake.textContent = chars[Math.floor(Math.random()*chars.length)];
document.body.appendChild(flake);
snowflakes.push(flake);
}
setInterval(spawn, 500);
setTimeout(() => { setInterval(spawn, 3000) }, 10000);
}
if(!document.getElementById('snowStyle')){
const style = document.createElement('style');
style.id = 'snowStyle';
style.textContent = `@keyframes snowFall {
0%{transform:translateY(-30px) rotate(0deg)}
100%{transform:translateY(120vh) rotate(720deg)}
}`;
document.head.appendChild(style);
}
document.addEventListener('visibilitychange', () => {
if(!document.hidden && snowflakes.length < 20) createSnow();
});
createSnow();
})();