MediaWiki:Common.js: Unterschied zwischen den Versionen

Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
Zeile 1.240: Zeile 1.240:
     initSnow();
     initSnow();
   });
   });
})();
/* === ADOS – Winter Schneefall (Variante B: weniger Schnee auf Mobil) === */
(function() {
  // Nutzer, die reduzierte Animation bevorzugen → kein Schnee
  var mq = window.matchMedia("(prefers-reduced-motion: reduce)");
  if (mq.matches) return;
  function initSnow() {
    var width = window.innerWidth;
    var isSmall = width < 600;          // Mobil-Check
    var container = document.createElement('div');
    container.id = 'ados-snow';
    container.style.position = 'fixed';
    container.style.top = '0';
    container.style.left = '0';
    container.style.width = '100%';
    container.style.height = '100%';
    container.style.pointerEvents = 'none';
    container.style.overflow = 'hidden';
    container.style.zIndex = '9999';
    document.body.appendChild(container);
    // Schneeflocken
    var flakeChars = ['❄', '✻', '✼', '✥', '✶'];
    // Mobil weniger Schneeflocken
    var flakeCount = isSmall ? 25 : 60;
    for (var i = 0; i < flakeCount; i++) {
      var flake = document.createElement('div');
      flake.textContent = flakeChars[Math.floor(Math.random() * flakeChars.length)];
      flake.style.position = 'absolute';
      flake.style.left = Math.random() * 100 + 'vw';
      flake.style.top = -(Math.random() * 20) + 'vh';
      flake.style.fontSize = (isSmall ? (10 + Math.random() * 14) : (14 + Math.random() * 20)) + 'px';
      flake.style.opacity = (0.4 + Math.random() * 0.6).toFixed(2);
      // Animation
      flake.style.animation =
        'adosSnowFall ' + (8 + Math.random() * 10) + 's linear infinite';
      // leichte Drift
      flake.style.animationDelay = (-Math.random() * 10) + 's';
      container.appendChild(flake);
    }
  }
  // Animation definieren
  var style = document.createElement('style');
  style.textContent = `
    @keyframes adosSnowFall {
      0%  { transform: translateY(-10vh) translateX(0); }
      100% { transform: translateY(110vh) translateX(15px); }
    }
  `;
  document.head.appendChild(style);
  // Starten
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', initSnow);
  } else {
    initSnow();
  }


})();
})();