User:PabloS/blast.js

From Valve Developer Community
< User:PabloS
Revision as of 14:24, 14 November 2024 by PabloS (talk | contribs) (Protected "User:PabloS/blast.js" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
Jump to navigation Jump to search

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
async function blast() {
        if (window.location.href.includes("Half-Life_2")) {
            const date = new Date();
    
            if (date.getFullYear() === 2024 && date.getMonth() === 10 && date.getDate() === 16) {
                for (let i = 1; i < 15; i++) {
                    confetti({
                        particleCount: 100,
                        startVelocity: 30,
                        spread: 360,
                        origin: {
                            x: Math.random(),
                            y: Math.random() - .2
                        },
                        disableForReducedMotion: true
                    });
            
                    await new Promise(r => setTimeout(r, 1000));
                }
            }
        }
    }