MCPcopy Create free account
hub / github.com/pollinations/pollinations / createMemeCard

Function createMemeCard

apps/catgpt/script.js:307–334  ·  view source on GitHub ↗
(prompt, index, imageUrl)

Source from the content-addressed store, hash-verified

305// ── Cards ────────────────────────────────────────────────────────────────────
306
307function createMemeCard(prompt, index, imageUrl) {
308 const safeUrl = sanitizeUrl(imageUrl);
309 if (!safeUrl) return null;
310
311 const card = document.createElement("div");
312 card.className = "example-card";
313 card.style.animationDelay = `${index * 0.1}s`;
314
315 const img = document.createElement("img");
316 img.src = safeUrl;
317 img.alt = prompt;
318 img.loading = "lazy";
319 card.appendChild(img);
320
321 const p = document.createElement("p");
322 p.textContent = `"${prompt}"`;
323 card.appendChild(p);
324
325 card.addEventListener("click", () => {
326 dom.userInput.value = prompt;
327 updateGenerateButtonState();
328 scrollToGenerator();
329 dom.userInput.focus();
330 notify("Prompt loaded! Hit Generate 🎨");
331 });
332
333 return card;
334}
335
336function loadUserMemes() {
337 dom.yourMemesGrid.innerHTML = "";

Callers 2

loadUserMemesFunction · 0.85
loadExamplesFunction · 0.85

Calls 4

sanitizeUrlFunction · 0.85
scrollToGeneratorFunction · 0.85
notifyFunction · 0.85

Tested by

no test coverage detected