Project skyscraper / no man's sky arg

The js block @ L266 of the page source (I have commented to explain) performs a randomisation (Fisher-Yates) on them in the live wp-block for cosmetics:

<script>
function scrambleWord(el) {
    const original = el.dataset.word;      // Get original from data-word attr
    let letters = original.split('');       // Split into char array
    for (let i = letters.length - 1; i > 0; i--) {
        const j = Math.floor(Math.random() * (i + 1));
        [letters[i], letters[j]] = [letters[j], letters[i]];  // Swap
    }
    el.textContent = letters.join('');      // Replace displayed text
}

document.querySelectorAll('.scramble-text').forEach(el => {
    scrambleWord(el);                       // Scramble immediately
    setInterval(() => scrambleWord(el), 1000);  // Re-scramble every 1 sec
});
</script>

If there is intent, it’s in the original two instances (the meta description and the href text before cosmetics).

5 Likes