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

De ɴon-ᴀ
Sauter à la navigation Sauter à la recherche
m
m
 
(2 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
 +
/*
 
console.log("it's tiiiiiime");
 
console.log("it's tiiiiiime");
  
 
var snowflakes = ["❄", "❅", "❆"];
 
var snowflakes = ["❄", "❅", "❆"];
  
function createSnowflake() {
+
      function createSnowflake() {
  var snowflake = document.createElement('div');
+
        var snowflake = document.createElement('div');
  snowflake.className = 'snowflake';
+
        snowflake.className = 'snowflake';
  snowflake.innerHTML = snowflakes[Math.floor(Math.random() * snowflakes.length)];
+
        snowflake.innerHTML = snowflakes[Math.floor(Math.random() * snowflakes.length)];
  snowflake.style.left = Math.random() * (document.documentElement.clientWidth || document.body.clientWidth) + 'px';
+
        snowflake.style.left = Math.floor(Math.random() * (document.documentElement.clientWidth || document.body.clientWidth)) + 'px';
  snowflake.style.top = '0';
+
        snowflake.style.top = '0';
  
  // Trigger reflow to apply initial position before transitioning
+
        document.body.appendChild(snowflake);
  void snowflake.offsetWidth;
 
  
  snowflake.style.top = '100vh'; // Set the end position
+
        setTimeout(function () {
  document.body.appendChild(snowflake);
+
          document.body.removeChild(snowflake);
 +
        }, 5000);
 +
      }
  
  setTimeout(function () {
+
      function animateSnowflakes() {
      document.body.removeChild(snowflake);
+
        var snowflakes = document.getElementsByClassName('snowflake');
      }, 5000);
+
        var iterationCount = 0;
}
 
  
function generateSnowflakes() {
+
        function animate() {
  for (var i = 0; i < 20; i++) { // Create initial snowflakes
+
          for (var i = 0; i < snowflakes.length; i++) {
    createSnowflake();
+
            var snowflake = snowflakes[i];
  }
+
            snowflake.style.top = '0';
 +
            void snowflake.offsetWidth; // Trigger reflow
 +
            snowflake.style.top = '100vh'; // Set the end position
 +
          }
  
  setInterval(createSnowflake, 500); // Create a new snowflake every 500 milliseconds
+
          iterationCount++;
}
+
          if (iterationCount >= 20) {
 +
            clearInterval(animationInterval);
 +
          }
 +
        }
  
generateSnowflakes();
+
        var animationInterval = setInterval(animate, 5000); // Reset the animation every 5000 milliseconds
 +
      }
 +
 
 +
      function generateSnowflakes() {
 +
        for (var i = 0; i < 20; i++) { // Create initial snowflakes
 +
          createSnowflake();
 +
        }
 +
 
 +
        setInterval(createSnowflake, 500); // Create a new snowflake every 500 milliseconds
 +
        animateSnowflakes();
 +
      }
 +
 
 +
      generateSnowflakes();
 +
*/

Version actuelle datée du 6 mai 2024 à 12:44

/*
console.log("it's tiiiiiime");

var snowflakes = ["❄", "❅", "❆"];

      function createSnowflake() {
        var snowflake = document.createElement('div');
        snowflake.className = 'snowflake';
        snowflake.innerHTML = snowflakes[Math.floor(Math.random() * snowflakes.length)];
        snowflake.style.left = Math.floor(Math.random() * (document.documentElement.clientWidth || document.body.clientWidth)) + 'px';
        snowflake.style.top = '0';

        document.body.appendChild(snowflake);

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

      function animateSnowflakes() {
        var snowflakes = document.getElementsByClassName('snowflake');
        var iterationCount = 0;

        function animate() {
          for (var i = 0; i < snowflakes.length; i++) {
            var snowflake = snowflakes[i];
            snowflake.style.top = '0';
            void snowflake.offsetWidth; // Trigger reflow
            snowflake.style.top = '100vh'; // Set the end position
          }

          iterationCount++;
          if (iterationCount >= 20) {
            clearInterval(animationInterval);
          }
        }

        var animationInterval = setInterval(animate, 5000); // Reset the animation every 5000 milliseconds
      }

      function generateSnowflakes() {
        for (var i = 0; i < 20; i++) { // Create initial snowflakes
          createSnowflake();
        }

        setInterval(createSnowflake, 500); // Create a new snowflake every 500 milliseconds
        animateSnowflakes();
      }

      generateSnowflakes();
*/