MediaWiki:Common.js:修订间差异
来自Fuckrooms Wiki
无编辑摘要 |
Defaultuser6(留言 | 贡献) (暂时)禁用影响性能的飘落对象,优化后重新加回 |
||
| 第1行: | 第1行: | ||
(function(){ | /*(function(){ | ||
if (!document.getElementById('snow-style')) { | if (!document.getElementById('snow-style')) { | ||
const style = document.createElement('style'); | const style = document.createElement('style'); | ||
| 第61行: | 第61行: | ||
createSnowflake(); | createSnowflake(); | ||
} | } | ||
})(); | })();*/ | ||
importScript('MediaWiki:Importjs/'+ wgPageName + '.js'); | importScript('MediaWiki:Importjs/'+ wgPageName + '.js'); | ||
2025年4月25日 (五) 12:08的版本
/*(function(){
if (!document.getElementById('snow-style')) {
const style = document.createElement('style');
style.id = 'snow-style';
style.textContent = `
@keyframes snowFall {
0% { transform: translateY(-110px) rotate(0deg); }
100% { transform: translateY(calc(100vh + 130px)) rotate(9000deg); }
}
.snowflake {
position: fixed;
top: -130px;
z-index: 9999;
pointer-events: none;
user-select: none;
animation-timing-function: linear;
}
`;
document.head.appendChild(style);
}
function createSnowflake() {
const snowflake = document.createElement('div');
snowflake.className = 'snowflake';
const icons = ['🍀','☘️','🍃','🌿'];
snowflake.innerHTML = icons[Math.floor(Math.random() * 4)];
const size = Math.random() * 16 + 8;
const left = Math.random() * 100;
const duration = Math.random() * 8 + 8;
snowflake.style.cssText = `
font-size: ${size}px;
left: ${left}%;
animation: snowFall ${duration}s linear 1; // 移除delay参数
opacity: ${Math.random() * 0.5 + 0.5};
color: hsl(${Math.random() * 360}, 100%, 90%);
`;
snowflake.addEventListener('animationend', function() {
snowflake.remove();
});
document.body.appendChild(snowflake);
}
let interval = setInterval(createSnowflake, 250);
document.addEventListener('visibilitychange', function() {
if (document.hidden) {
clearInterval(interval);
} else {
interval = setInterval(createSnowflake, 250);
}
});
for (let i = 0; i < 10; i++) {
createSnowflake();
}
})();*/
importScript('MediaWiki:Importjs/'+ wgPageName + '.js');