Fix chat joke speaker attribution and add more jokes

This commit is contained in:
clarth 2026-12-02 17:46:38 -05:00
parent ba9a3924d2
commit fbdfaf8cc0

View file

@ -31,33 +31,55 @@
var chat = document.querySelector('.mock-chat');
if (chat) {
var names = ['Sam', 'Ruth', 'Kai', 'Milo', 'Jules', 'Bea', 'Ollie', 'Finn', 'Pip', 'Nora'];
var names = ['Sam', 'Ruth', 'Kai', 'Milo', 'Jules', 'Bea', 'Ollie', 'Finn', 'Pip', 'Nora', 'Leo', 'Ada'];
// Each convo: [speakerIndex, message] x3. speakerIndex 0-2 maps to chosen names.
var convos = [
["Knock, knock!", "Who's there?", "Lettuce. Lettuce who? Lettuce in, it's cold out here!"],
["Knock, knock!", "Who's there?", "Cow says. Cow says who? No silly, cow says moo!"],
["Knock, knock!", "Who's there?", "Tank. Tank who? You're welcome!"],
["Knock, knock!", "Who's there?", "Alpaca. Alpaca who? Alpaca the snacks, you grab the map!"],
["Knock, knock!", "Who's there?", "Dishes. Dishes who? Dishes the police, open up!"],
["Knock, knock!", "Who's there?", "Cargo. Cargo who? Cargo beep beep, vroom vroom!"],
["Why did the scarecrow get promoted?", "No idea, why?", "He was outstanding in his field!"],
["I'm reading a book on anti-gravity.", "Oh yeah? How is it?", "Impossible to put down!"],
["What do you call a fake noodle?", "Hmm... I give up.", "An impasta!"],
["Why don't eggs tell jokes?", "Why not?", "They'd crack each other up!"],
["Did you hear about the claustrophobic astronaut?", "Oh no, what happened?", "He just needed a little space."],
["What do you call cheese that isn't yours?", "What?", "Nacho cheese!"],
["Why did the bicycle fall over?", "Why?", "It was two-tired!"],
["I used to play piano by ear.", "Really? That's impressive!", "Now I use my hands, it's much easier."],
["What did the ocean say to the beach?", "What did it say?", "Nothing, it just waved!"],
["Why can't you trust stairs?", "Tell me.", "They're always up to something."],
["What do you call a bear with no teeth?", "A what?", "A gummy bear!"],
["I'm afraid for the calendar.", "Why's that?", "Its days are numbered."],
["What do you call a fish with no eyes?", "I don't know...", "A fsh!"],
["Why did the math book look so sad?", "Poor thing, why?", "It had too many problems."],
["I told my computer I needed a break.", "What did it say?", "Nothing, it just went to sleep."],
["Anyone want to hear a construction joke?", "Sure!", "Never mind, I'm still working on it."],
["I made a belt out of watches.", "And?", "It was a waist of time."],
["Why do cows have hooves instead of feet?", "Why?", "Because they lactose!"],
["What do you call a dog that can do magic?", "What?", "A Labracadabrador!"]
// knock-knock (joker=0, responder=1, joker=0)
[[0,"Knock, knock!"], [1,"Who's there?"], [0,"Lettuce. Lettuce who? Lettuce in, it's cold out here!"]],
[[0,"Knock, knock!"], [1,"Who's there?"], [0,"Cow says. Cow says who? No silly, cow says moo!"]],
[[0,"Knock, knock!"], [1,"Who's there?"], [0,"Tank. Tank who? You're welcome!"]],
[[0,"Knock, knock!"], [1,"Who's there?"], [0,"Alpaca. Alpaca who? Alpaca the snacks, you grab the map!"]],
[[0,"Knock, knock!"], [1,"Who's there?"], [0,"Dishes. Dishes who? Dishes the police, open up!"]],
[[0,"Knock, knock!"], [1,"Who's there?"], [0,"Cargo. Cargo who? Cargo beep beep, vroom vroom!"]],
[[0,"Knock, knock!"], [1,"Who's there?"], [0,"Nobel. Nobel who? Nobel, that's why I knocked!"]],
[[0,"Knock, knock!"], [1,"Who's there?"], [0,"Butter. Butter who? Butter open the door, it's chilly!"]],
[[0,"Knock, knock!"], [1,"Who's there?"], [0,"Etch. Etch who? Bless you!"]],
[[0,"Knock, knock!"], [1,"Who's there?"], [0,"Ketchup. Ketchup who? Ketchup with me and I'll tell you!"]],
[[0,"Knock, knock!"], [1,"Who's there?"], [0,"Owls say. Owls say who? Yep, they sure do!"]],
[[0,"Knock, knock!"], [1,"Who's there?"], [0,"Annie. Annie who? Annie thing you can do, I can do better!"]],
// dad jokes / banter (2 people)
[[0,"Why did the scarecrow get promoted?"], [1,"No idea, why?"], [0,"He was outstanding in his field!"]],
[[0,"I'm reading a book on anti-gravity."], [1,"Oh yeah? How is it?"], [0,"Impossible to put down!"]],
[[0,"What do you call a fake noodle?"], [1,"Hmm... I give up."], [0,"An impasta!"]],
[[0,"Why don't eggs tell jokes?"], [1,"Why not?"], [0,"They'd crack each other up!"]],
[[0,"Did you hear about the claustrophobic astronaut?"], [1,"Oh no, what happened?"], [0,"He just needed a little space."]],
[[0,"What do you call cheese that isn't yours?"], [1,"What?"], [0,"Nacho cheese!"]],
[[0,"Why did the bicycle fall over?"], [1,"Why?"], [0,"It was two-tired!"]],
[[0,"What did the ocean say to the beach?"], [1,"What did it say?"], [0,"Nothing, it just waved!"]],
[[0,"Why can't you trust stairs?"], [1,"Tell me."], [0,"They're always up to something."]],
[[0,"What do you call a bear with no teeth?"], [1,"A what?"], [0,"A gummy bear!"]],
[[0,"I'm afraid for the calendar."], [1,"Why's that?"], [0,"Its days are numbered."]],
[[0,"What do you call a fish with no eyes?"], [1,"I don't know..."], [0,"A fsh!"]],
[[0,"Why did the math book look so sad?"], [1,"Poor thing, why?"], [0,"It had too many problems."]],
[[0,"I made a belt out of watches."], [1,"And...?"], [0,"It was a waist of time."]],
[[0,"Why do cows have hooves instead of feet?"], [1,"Why?"], [0,"Because they lactose!"]],
[[0,"What do you call a dog that can do magic?"], [1,"What?"], [0,"A Labracadabrador!"]],
[[0,"Why don't scientists trust atoms?"], [1,"Why?"], [0,"Because they make up everything!"]],
[[0,"What do you call a sleeping dinosaur?"], [1,"I dunno."], [0,"A dino-snore!"]],
[[0,"Why did the golfer bring two pairs of pants?"], [1,"Just in case...?"], [0,"In case he got a hole in one!"]],
[[0,"What do you call a pile of cats?"], [1,"What?"], [0,"A meowtain!"]],
[[0,"I used to be a baker."], [1,"Oh really?"], [0,"Yeah, but I couldn't make enough dough."]],
// 3-person chats
[[0,"What do you call a factory that makes okay products?"], [1,"I don't know, what?"], [2,"A satisfactory!"]],
[[0,"I just got a job at the orange juice factory."], [1,"Nice! How is it?"], [2,"I heard he got fired because he couldn't concentrate."]],
[[0,"Why did the cookie go to the doctor?"], [1,"Why?"], [2,"Because it was feeling crummy!"]],
[[0,"I'm on a seafood diet."], [1,"Oh, how's that going?"], [2,"He sees food and eats it. Every time."]],
[[0,"Did you hear about the restaurant on the moon?"], [1,"No, what about it?"], [2,"Great food, no atmosphere!"]],
[[0,"What do you call a can opener that doesn't work?"], [1,"Uhh..."], [2,"A can't opener!"]],
[[0,"I told my dog a joke about fetch."], [1,"Did he laugh?"], [2,"Nah, tough crowd. He just gave you a ruff look."]],
[[0,"Why do seagulls fly over the sea?"], [1,"Why?"], [2,"Because if they flew over the bay, they'd be bagels!"]],
[[0,"What do sprinters eat before a race?"], [1,"Bananas?"], [2,"Nothing, they fast!"]],
[[0,"I asked the librarian if the library had books on paranoia."], [1,"And?"], [2,"She whispered, 'They're right behind you...'"]]
];
function pick(arr) {
return arr[Math.floor(Math.random() * arr.length)];
@ -75,9 +97,10 @@
var avs = ['av-a', 'av-b', 'av-c'];
var html = '';
for (var k = 0; k < 3; k++) {
var speaker = convo[k][0];
html += '<div class="msg msg-' + (k + 1) + '">' +
'<span class="av ' + avs[k] + '"></span>' +
'<div><b>' + chosenNames[k] + '</b><p>' + convo[k] + '</p></div>' +
'<span class="av ' + avs[speaker] + '"></span>' +
'<div><b>' + chosenNames[speaker] + '</b><p>' + convo[k][1] + '</p></div>' +
'</div>';
}
html += '<div class="typing"><span></span><span></span><span></span></div>';