Spaces:
Running
Running
File size: 13,896 Bytes
e9a2348 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dad Joke Generator</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
.dad-hat {
position: absolute;
top: -20px;
left: 50%;
transform: translateX(-50%);
width: 100px;
height: 60px;
background-color: #f59e0b;
border-radius: 50% 50% 0 0;
z-index: 10;
}
.dad-hat::before {
content: '';
position: absolute;
bottom: -10px;
left: 0;
width: 100%;
height: 20px;
background-color: #92400e;
border-radius: 0 0 50% 50%;
}
.dad-hat::after {
content: '';
position: absolute;
top: 15px;
right: -15px;
width: 30px;
height: 30px;
background-color: #f59e0b;
border-radius: 50%;
transform: rotate(45deg);
}
.joke-container {
min-height: 200px;
transition: all 0.3s ease;
}
.mustache {
position: absolute;
bottom: -10px;
left: 50%;
transform: translateX(-50%);
width: 100px;
height: 30px;
background-color: #333;
border-radius: 0 0 50% 50%;
}
.mustache::before,
.mustache::after {
content: '';
position: absolute;
top: 0;
width: 40px;
height: 40px;
background-color: #333;
border-radius: 50%;
}
.mustache::before {
left: -30px;
}
.mustache::after {
right: -30px;
}
.dad-shadow {
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}
.joke-text {
font-family: 'Comic Sans MS', cursive, sans-serif;
}
.btn-pulse:hover {
animation: pulse 0.5s infinite;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
</style>
</head>
<body class="bg-gradient-to-b from-blue-50 to-blue-100 min-h-screen">
<div class="container mx-auto px-4 py-12">
<div class="max-w-2xl mx-auto text-center">
<!-- Dad Hat Title -->
<div class="relative mb-16">
<div class="dad-hat"></div>
<h1 class="text-4xl md:text-5xl font-bold text-amber-800 bg-white py-4 px-8 rounded-full shadow-lg relative z-0">
<span class="text-amber-600">Dad</span> Joke Generator
</h1>
</div>
<!-- Joke Display -->
<div class="bg-white rounded-2xl p-8 mb-10 joke-container dad-shadow relative overflow-hidden">
<div class="absolute -bottom-2 left-0 w-full flex justify-center">
<div class="mustache"></div>
</div>
<div class="min-h-40 flex items-center justify-center">
<p id="joke" class="text-2xl joke-text text-gray-800">Why don't eggs tell jokes? They'd crack each other up!</p>
</div>
<div class="absolute top-2 right-2">
<button id="copyBtn" class="text-gray-400 hover:text-amber-600 transition-colors">
<i class="fas fa-copy"></i>
</button>
</div>
</div>
<!-- Controls -->
<div class="flex flex-col sm:flex-row gap-4 justify-center">
<button id="newJokeBtn" class="bg-amber-500 hover:bg-amber-600 text-white font-bold py-3 px-6 rounded-full text-lg btn-pulse transition-colors flex items-center justify-center gap-2">
<i class="fas fa-redo"></i> New Joke
</button>
<button id="shareBtn" class="bg-blue-500 hover:bg-blue-600 text-white font-bold py-3 px-6 rounded-full text-lg transition-colors flex items-center justify-center gap-2">
<i class="fas fa-share-alt"></i> Share
</button>
</div>
<!-- Rating -->
<div class="mt-8">
<p class="text-gray-600 mb-2">How bad was this dad joke?</p>
<div class="flex justify-center gap-2">
<button class="rate-btn bg-red-100 hover:bg-red-200 text-red-600 px-4 py-2 rounded-full transition-colors" data-rating="1">
<i class="fas fa-grin-squint-tears"></i> So bad
</button>
<button class="rate-btn bg-yellow-100 hover:bg-yellow-200 text-yellow-600 px-4 py-2 rounded-full transition-colors" data-rating="2">
<i class="fas fa-grin-beam"></i> Classic
</button>
<button class="rate-btn bg-green-100 hover:bg-green-200 text-green-600 px-4 py-2 rounded-full transition-colors" data-rating="3">
<i class="fas fa-grin-tears"></i> Legendary
</button>
</div>
</div>
<!-- Dad Joke Counter -->
<div class="mt-12 bg-white rounded-full py-3 px-6 inline-block shadow-md">
<p class="text-gray-700">
<span id="jokeCount" class="font-bold text-amber-600">0</span> dad jokes generated today!
</p>
</div>
</div>
</div>
<script>
// Dad Jokes API
const dadJokes = [
"Why don't skeletons fight each other? They don't have the guts.",
"I'm reading a book about anti-gravity. It's impossible to put down!",
"Did you hear about the claustrophobic astronaut? He just needed a little space.",
"Why don't scientists trust atoms? Because they make up everything!",
"What do you call a fake noodle? An impasta!",
"How do you organize a space party? You planet!",
"Why did the scarecrow win an award? Because he was outstanding in his field!",
"I used to be a baker, but I couldn't make enough dough.",
"What's orange and sounds like a parrot? A carrot.",
"How do you make a tissue dance? Put a little boogie in it!",
"Why did the math book look sad? Because it had too many problems.",
"What do you call a bear with no teeth? A gummy bear!",
"I'm on a seafood diet. Every time I see food, I eat it.",
"Why can't you explain puns to kleptomaniacs? They always take things literally.",
"What's the best time to go to the dentist? Tooth-hurty!",
"How does a penguin build its house? Igloos it together.",
"Why don't eggs tell jokes? They'd crack each other up!",
"What do you call cheese that isn't yours? Nacho cheese!",
"Why couldn't the bicycle stand up by itself? It was two tired.",
"What did the grape say when it got stepped on? Nothing, it just let out a little wine.",
"Why don't some couples go to the gym? Because some relationships don't work out.",
"What do you call a fish wearing a bowtie? Sofishticated.",
"How do you catch a squirrel? Climb a tree and act like a nut!",
"I told my wife she was drawing her eyebrows too high. She looked surprised.",
"What's brown and sticky? A stick.",
"Why did the golfer bring two pairs of pants? In case he got a hole in one!",
"What do you call a parade of rabbits hopping backwards? A receding hare-line.",
"How many tickles does it take to make an octopus laugh? Ten-tickles.",
"I invented a new word: Plagiarism!",
"What's the difference between a poorly dressed man on a trampoline and a well-dressed man on a trampoline? Attire.",
"Why did the invisible man turn down the job offer? He couldn't see himself doing it.",
"What do you call a snowman with a six-pack? An abdominal snowman.",
"I used to play piano by ear, but now I use my hands.",
"Did you hear about the guy who invented the knock-knock joke? He won the 'no-bell' prize.",
"What did the janitor say when he jumped out of the closet? Supplies!",
"Why did the scarecrow win an award? Because he was outstanding in his field!",
"What do you call a dinosaur with an extensive vocabulary? A thesaurus.",
"I would tell you a chemistry joke, but I know I wouldn't get a reaction.",
"Why don't scientists trust atoms? Because they make up everything!",
"What did one wall say to the other wall? I'll meet you at the corner!"
];
// DOM Elements
const jokeElement = document.getElementById('joke');
const newJokeBtn = document.getElementById('newJokeBtn');
const copyBtn = document.getElementById('copyBtn');
const shareBtn = document.getElementById('shareBtn');
const rateButtons = document.querySelectorAll('.rate-btn');
const jokeCountElement = document.getElementById('jokeCount');
// Variables
let jokeCount = localStorage.getItem('jokeCount') || 0;
jokeCountElement.textContent = jokeCount;
// Functions
function getRandomJoke() {
const randomIndex = Math.floor(Math.random() * dadJokes.length);
return dadJokes[randomIndex];
}
function displayNewJoke() {
jokeElement.textContent = getRandomJoke();
jokeCount++;
jokeCountElement.textContent = jokeCount;
localStorage.setItem('jokeCount', jokeCount);
// Animate joke container
const jokeContainer = document.querySelector('.joke-container');
jokeContainer.style.transform = 'scale(0.95)';
setTimeout(() => {
jokeContainer.style.transform = 'scale(1)';
}, 300);
}
function copyJokeToClipboard() {
navigator.clipboard.writeText(jokeElement.textContent)
.then(() => {
copyBtn.innerHTML = '<i class="fas fa-check"></i>';
setTimeout(() => {
copyBtn.innerHTML = '<i class="fas fa-copy"></i>';
}, 2000);
})
.catch(err => {
console.error('Failed to copy text: ', err);
});
}
function shareJoke() {
if (navigator.share) {
navigator.share({
title: 'Dad Joke',
text: jokeElement.textContent,
url: window.location.href
})
.catch(err => {
console.error('Error sharing:', err);
});
} else {
// Fallback for browsers that don't support Web Share API
const shareUrl = `https://twitter.com/intent/tweet?text=${encodeURIComponent(jokeElement.textContent + " - Check out this Dad Joke Generator!")}`;
window.open(shareUrl, '_blank');
}
}
function rateJoke(rating) {
let message = '';
switch(rating) {
case '1':
message = 'Thanks for your honesty! We\'ll try harder next time.';
break;
case '2':
message = 'A classic dad joke! Right in the sweet spot.';
break;
case '3':
message = 'Legendary status achieved! This joke will go down in history.';
break;
}
// Create and show toast notification
const toast = document.createElement('div');
toast.className = `fixed bottom-4 left-1/2 transform -translate-x-1/2 bg-white px-6 py-3 rounded-full shadow-lg text-sm font-medium animate-bounce ${rating === '1' ? 'text-red-500' : rating === '2' ? 'text-yellow-500' : 'text-green-500'}`;
toast.textContent = message;
document.body.appendChild(toast);
setTimeout(() => {
toast.remove();
}, 3000);
}
// Event Listeners
newJokeBtn.addEventListener('click', displayNewJoke);
copyBtn.addEventListener('click', copyJokeToClipboard);
shareBtn.addEventListener('click', shareJoke);
rateButtons.forEach(button => {
button.addEventListener('click', () => {
rateJoke(button.dataset.rating);
});
});
// Initialize with a joke
displayNewJoke();
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=MarcusCorvus/dad-joke-generator" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |