Différences entre versions de « MediaWiki:Common.js »

De ɴon-ᴀ
Sauter à la navigation Sauter à la recherche
 
m
Ligne 1 : Ligne 1 :
 
/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */
 
/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */
  
alert("hello");
+
document.addEventListener('DOMContentLoaded', function () {
 +
      const snowflakes = ["", "❅", "❆"]; // Unicode snowflakes
 +
 
 +
      function createSnowflake() {
 +
        const snowflake = document.createElement('div');
 +
        snowflake.className = 'snowflake';
 +
        snowflake.innerHTML = snowflakes[Math.floor(Math.random() * snowflakes.length)];
 +
        snowflake.style.left = Math.random() * window.innerWidth + 'px';
 +
        snowflake.style.animationDuration = Math.random() * 3 + 2 + 's';
 +
        document.body.appendChild(snowflake);
 +
 
 +
        setTimeout(() => {
 +
          document.body.removeChild(snowflake);
 +
        }, 5000);
 +
      }
 +
 
 +
      function generateSnowflakes() {
 +
        setInterval(createSnowflake, 500); // Create a new snowflake every 500 milliseconds
 +
      }
 +
 
 +
      generateSnowflakes();
 +
    });

Version du 21 janvier 2024 à 16:11

/* Tout JavaScript ici sera chargé avec chaque page accédée par n’importe quel utilisateur. */

document.addEventListener('DOMContentLoaded', function () {
      const snowflakes = ["❄", "❅", "❆"]; // Unicode snowflakes

      function createSnowflake() {
        const snowflake = document.createElement('div');
        snowflake.className = 'snowflake';
        snowflake.innerHTML = snowflakes[Math.floor(Math.random() * snowflakes.length)];
        snowflake.style.left = Math.random() * window.innerWidth + 'px';
        snowflake.style.animationDuration = Math.random() * 3 + 2 + 's';
        document.body.appendChild(snowflake);

        setTimeout(() => {
          document.body.removeChild(snowflake);
        }, 5000);
      }

      function generateSnowflakes() {
        setInterval(createSnowflake, 500); // Create a new snowflake every 500 milliseconds
      }

      generateSnowflakes();
    });