diff --git a/script.js b/script.js index 23ea30a..0910f3a 100755 --- a/script.js +++ b/script.js @@ -28,4 +28,61 @@ card.style.setProperty('--my', (e.clientY - rect.top) + 'px'); }); }); + + var chat = document.querySelector('.mock-chat'); + if (chat) { + var names = ['Sam', 'Ruth', 'Kai', 'Milo', 'Jules', 'Bea', 'Ollie', 'Finn', 'Pip', 'Nora']; + var pool = [ + "why did the scarecrow get promoted? he was outstanding in his field", + "I told my computer I needed a break and it said 'no problem, I'll go to sleep'", + "anyone else name their Wi-Fi something dramatic? mine is 'Pretty Fly for a Wi-Fi'", + "I'm reading a book on anti-gravity. it's impossible to put down", + "why don't eggs tell jokes? they'd crack each other up", + "just tried to catch fog. I mist", + "my dad said I should do lunges to stay in shape. that was a big step forward", + "what do you call a fake noodle? an impasta", + "I used to play piano by ear, but now I use my hands", + "why did the bicycle fall over? it was two-tired", + "I asked the dog for tech support. he just said 'ruff'", + "I'm on a seafood diet. I see food and I eat it", + "the rotation of the earth really makes my day", + "why can't you trust stairs? they're always up to something", + "I made a belt out of watches. it was a waist of time", + "did you hear about the claustrophobic astronaut? he just needed a little space", + "I would tell you a construction joke, but I'm still working on it", + "what do you call cheese that isn't yours? nacho cheese", + "my plants are thriving. I think they finally root for me", + "why did the math book look sad? it had too many problems", + "I got a job at a bakery because I kneaded dough", + "singing in the shower is fun until you get soap in your mouth. then it's a soap opera", + "I don't trust atoms. they make up everything", + "what did the ocean say to the beach? nothing, it just waved", + "I told a chemistry joke but there was no reaction", + "just burned 2000 calories. I forgot the pizza in the oven", + "why do cows have hooves instead of feet? because they lactose", + "I'm afraid for the calendar. its days are numbered", + "what do you call a bear with no teeth? a gummy bear", + "parallel lines have so much in common... it's a shame they'll never meet" + ]; + function pick(arr, n) { + var copy = arr.slice(); + for (var i = copy.length - 1; i > 0; i--) { + var j = Math.floor(Math.random() * (i + 1)); + var t = copy[i]; copy[i] = copy[j]; copy[j] = t; + } + return copy.slice(0, n); + } + var chosenNames = pick(names, 3); + var chosenMsgs = pick(pool, 3); + var avs = ['av-a', 'av-b', 'av-c']; + var html = ''; + for (var k = 0; k < 3; k++) { + html += '
' + + '' + + '
' + chosenNames[k] + '

' + chosenMsgs[k] + '

' + + '
'; + } + html += '
'; + chat.innerHTML = html; + } })();