// LOADER ANIMATION $(window).on("load", function () { $(".loader-wrapper").fadeOut("slow"); }) /* THIS CHECKS WHAT OS THE USER IS ON, This is a old variation so don't use this. // if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|BB|PlayBook|IEMobile|Windows Phone|Kindle|Silk|Opera Mini/i.test(navigator.userAgent)) { // location.href = './mobile/'; // } */ // CHECKS IF USER IS ON MOBILE if( screen.width <= 480 ) { location.href = '/mobile'; } // BACKGROUND SPARKLES // SCRIPT #1 // set up the base pattern var pattern = Trianglify({ height: window.innerHeight, // White: #fdfbfb, Salmon: #cc3300 width: window.innerWidth, x_colors: ['#040404', '#f9f9f9', '#fffff4', '#fbf7f5', '#d55454'], // Cappuccino: ['#854442', '#3c2f2f', '#fff4e6', '#be9b7b', '#4b3832'] y_colors: ['#f9f1f1', '#f9f9f9', '#fffff4', '#fbf7f5', '#f9f1f1'], // Random colour generator: "#"+((1<<24)*Math.random()|0).toString(16) variance: 10, seed: Number.parseInt(Math.floor(Math.random() * 100)), // TODO: Live seed transitioning. cell_size: 160 }); // // canvas // document.body.appendChild(pattern.canvas()) // svg document.body.appendChild(pattern.svg()) // // png // var png = document.createElement('img') // png.src = pattern.png() // document.body.appendChild(png) // SCRIPT #2 $('.title-wrapper').css('width', window.innerWidth); $('.title-wrapper').css('height', window.innerHeight); var time = 10, $paths = $('body').find('svg').find('path'), pathCollection = $paths.get(), count = $paths.length; console.log(count); pathCollection.sort(function () { return Math.random() * 10 > 5 ? 1 : -1; }); function showText() { var title = $('h1'), subtitle = $('h2'); title.removeClass('hidden'); setTimeout(function () { subtitle.removeClass('hidden'); }, 500); } setTimeout(function () { $.each(pathCollection, function (i, el) { var $path = $(this); setTimeout(function () { $path.css('opacity', '1'); }, time) time += 10; if (i + 1 === count) { setTimeout(function () { showText(); }, 2000); } }); }, 2000); // Honestly I have NO idea what this is but it was in the original site source code so I kept it :) (async () => { if (navigator.webdriver || document.visibilityState === 'prerender' || !location.hostname) { return; } document.querySelector('a[href="/cdn-cgi/l/email-protection"]').href = `\x6dailto:hi\x40${location.hostname}`; })(); // KONAMI CODE FOR ALTERNATE 90s SITE // a key map of allowed keys var allowedKeys = { 37: 'left', 38: 'up', 39: 'right', 40: 'down', 65: 'a', 66: 'b' }; // the 'official' Konami Code sequence var konamiCode = ['up', 'up', 'down', 'down', 'left', 'right', 'left', 'right', 'b', 'a']; // a variable to remember the 'position' the user has reached so far. var konamiCodePosition = 0; // add keydown event listener document.addEventListener('keydown', function (e) { // get the value of the key code from the key map var key = allowedKeys[e.keyCode]; // get the value of the required key from the konami code var requiredKey = konamiCode[konamiCodePosition]; // compare the key with the required key if (key == requiredKey) { // move to the next key in the konami code sequence konamiCodePosition++; // if the last key is reached, activate cheats if (konamiCodePosition == konamiCode.length) { activateCheats(); konamiCodePosition = 0; } } else { konamiCodePosition = 0; } }); function activateCheats() { var audio = new Audio('https://s3-eu-west-1.amazonaws.com/wdildnproject2/toasty.mp3'); audio.play(); window.location.href = "./konami"; } var TxtRotate = function (el, toRotate, period) { this.toRotate = toRotate; this.el = el; this.loopNum = 0; this.period = parseInt(period, 10) || 2000; this.txt = ''; this.tick(); this.isDeleting = false; }; TxtRotate.prototype.tick = function () { var i = this.loopNum % this.toRotate.length; var fullTxt = this.toRotate[i]; if (this.isDeleting) { this.txt = fullTxt.substring(0, this.txt.length - 1); } else { this.txt = fullTxt.substring(0, this.txt.length + 1); } this.el.innerHTML = '' + this.txt + ''; var that = this; var delta = 300 - Math.random() * 100; setTimeout(function () { that.tick(); }, delta); }; window.onload = function () { var elements = document.getElementsByClassName('txt-rotate'); for (var i = 0; i < elements.length; i++) { var toRotate = elements[i].getAttribute('data-rotate'); var period = elements[i].getAttribute('data-period'); if (toRotate) { new TxtRotate(elements[i], JSON.parse(toRotate), period); } } };