MediaWiki:Common.js
来自Fuckrooms Wiki
注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5。
(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(); })();