From 5aa2e6c0c6e4c73d93307e9f70803237006afb28 Mon Sep 17 00:00:00 2001 From: seth Date: Wed, 20 Dec 2023 20:27:18 -0500 Subject: go back to lume --- src/public/js/chrisApp.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/public/js/chrisApp.js (limited to 'src/public/js/chrisApp.js') diff --git a/src/public/js/chrisApp.js b/src/public/js/chrisApp.js new file mode 100644 index 0000000..eb78cfa --- /dev/null +++ b/src/public/js/chrisApp.js @@ -0,0 +1,30 @@ +const chrisURL = "/imgs/chris/"; + +function randomChris() { + const files = [ + "chis_very_fried.jpg", + "chris_medium_fried.jpg", + "chris_moshed.jpg", + "fried_publisher.jpg", + "help_me.png", + "nice_chris.png", + "nice_publisher.png", + "bkender_bauob.jpg", + "blurry_chris.jpg", + ]; + + // this chooses a random file from the array + const url = chrisURL + files[Math.floor(Math.random() * files.length)]; + + window.location.href = url; +} + +function findChris() { + const chris = document.getElementById("chris_gif"); + chris + ? chris.addEventListener("click", randomChris) + : console.warn("Couldn't load chris app!"); +} + +// avoiding a race condition here +setTimeout(findChris, 1000); -- cgit v1.2.3