175 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			175 lines
		
	
	
		
			6.0 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE html>
 | |
| <html lang="de">
 | |
| <head>
 | |
|     <meta charset="UTF-8">
 | |
|     <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | |
|     <title>Doge Meme Generator</title>
 | |
|     <meta property="og:title" content="Doge Meme Generator">
 | |
|     <meta property="og:description" content="Erstelle deine eigenen Doge Memes">
 | |
|     <meta property="og:type" content="website">
 | |
|     <meta property="og:url" content="https://tools.ponywave.de/dogify">
 | |
|     <script defer src="https://stats.ponywave.de/script" data-website-id="9ef713d2-adb9-4906-9df5-708d8a8b9131" data-tag="dogify"></script>
 | |
|     <script src="https://html2canvas.hertzen.com/dist/html2canvas.min.js"></script>
 | |
|     <style>
 | |
|         body {
 | |
|             font-family: Arial, sans-serif;
 | |
|             display: flex;
 | |
|             flex-direction: column;
 | |
|             align-items: center;
 | |
|             background-color: #f0f0f0;
 | |
|             padding: 20px;
 | |
|         }
 | |
|         #meme-container {
 | |
|             position: relative;
 | |
|             width: 640px;
 | |
|             height: 480px;
 | |
|             margin-bottom: 20px;
 | |
|             background-color: white;
 | |
|         }
 | |
|         #doge-image {
 | |
|             width: 100%;
 | |
|             height: 100%;
 | |
|             object-fit: cover;
 | |
|         }
 | |
|         .meme-text {
 | |
|             position: absolute;
 | |
|             text-align: center;
 | |
|             color: white;
 | |
|             font-size: 24px;
 | |
|             font-family: Comic Sans MS, cursive, sans-serif;
 | |
|             text-shadow: 2px 2px 4px #000000;
 | |
|             pointer-events: none;
 | |
|             max-width: 80%;
 | |
|             white-space: nowrap;
 | |
|             padding: 5px;
 | |
|         }
 | |
|         input[type="text"] {
 | |
|             width: 300px;
 | |
|             padding: 10px;
 | |
|             margin: 5px;
 | |
|             font-size: 16px;
 | |
|         }
 | |
|         button {
 | |
|             padding: 10px 20px;
 | |
|             margin: 5px;
 | |
|             cursor: pointer;
 | |
|             background-color: #4CAF50;
 | |
|             color: white;
 | |
|             border: none;
 | |
|             border-radius: 4px;
 | |
|         }
 | |
|         .info-box {
 | |
|             background: #f8f9fa;
 | |
|             border: 2px dashed #4CAF50;
 | |
|             border-radius: 8px;
 | |
|             padding: 15px;
 | |
|             margin: 20px 0;
 | |
|             max-width: 640px;
 | |
|             font-size: 14px;
 | |
|             color: #666;
 | |
|         }
 | |
|         
 | |
|         .info-box p {
 | |
|             margin: 8px 0;
 | |
|         }
 | |
|     </style>
 | |
| </head>
 | |
| <body>
 | |
|     <div id="meme-container">
 | |
|         <img id="doge-image" src="doge.jpg" alt="Doge Meme">
 | |
|     </div>
 | |
|     
 | |
|     <div class="info-box">
 | |
|         <p>🔹 Texte mit Komma trennen (z.B. "Hund, Katze, Maus")</p>
 | |
|         <p>🔹 Beim Hinzufügen werden automatisch Meme-Wörter ergänzt</p>
 | |
|         <p>🔹 Klicke "Meme speichern" zum Download</p>
 | |
|         <p>🔹 Textposition und Farbe werden zufällig generiert</p>
 | |
|     </div>
 | |
| 
 | |
|     <input type="text" id="text-input" placeholder="Deine Texte hier...">
 | |
|     <div>
 | |
|         <button id="add-text-button">Text hinzufügen</button>
 | |
|         <button id="save-button">Meme speichern</button>
 | |
|     </div>
 | |
| 
 | |
|     <script>
 | |
|         const memeWords = ["wow", "such meme", "chimken", "many fun"];
 | |
|         
 | |
|         function createTextElement(text) {
 | |
|             const memeContainer = document.getElementById('meme-container');
 | |
|             const textElement = document.createElement('div');
 | |
|             
 | |
|             textElement.className = 'meme-text';
 | |
|             textElement.textContent = text;
 | |
|             textElement.style.color = getRandomColor();
 | |
|             textElement.style.fontSize = `${Math.random() * 20 + 20}px`;
 | |
|             
 | |
|             const position = getRandomPosition(textElement);
 | |
|             textElement.style.top = `${position.top}px`;
 | |
|             textElement.style.left = `${position.left}px`;
 | |
|             
 | |
|             memeContainer.appendChild(textElement);
 | |
|         }
 | |
| 
 | |
|         function getRandomColor() {
 | |
|             return `hsl(${Math.random() * 360}, 100%, 50%)`;
 | |
|         }
 | |
| 
 | |
|         function getRandomPosition(element) {
 | |
|             const container = document.getElementById('meme-container');
 | |
|             
 | |
|             // Element muss erst im DOM sein um die Größe zu berechnen
 | |
|             container.appendChild(element);
 | |
|             
 | |
|             const maxTop = container.offsetHeight - element.offsetHeight - 10; // 10px Puffer
 | |
|             const maxLeft = container.offsetWidth - element.offsetWidth - 10;
 | |
|             
 | |
|             // Sicherstellen dass die Position nicht negativ wird
 | |
|             return {
 | |
|                 top: Math.max(10, Math.random() * maxTop),
 | |
|                 left: Math.max(10, Math.random() * maxLeft)
 | |
|             };
 | |
|         }
 | |
| 
 | |
|         // Event-Listener
 | |
|         document.getElementById('add-text-button').addEventListener('click', () => {
 | |
|             const userInput = document.getElementById('text-input').value;
 | |
|             
 | |
|             // Teile den Eingabetext bei Kommas und bereinige die Teile
 | |
|             const textParts = userInput.split(',')
 | |
|                 .map(part => part.trim())
 | |
|                 .filter(part => part.length > 0);
 | |
|     
 | |
|             // Füge jedes bereinigte Textteil hinzu
 | |
|             textParts.forEach(part => {
 | |
|                 createTextElement(part);
 | |
|             });
 | |
|     
 | |
|             // Füge zufälliges Meme-Wort hinzu (50% Chance)
 | |
|             if (Math.random() > 0.5 && textParts.length > 0) {
 | |
|                 const randomWord = memeWords[Math.floor(Math.random() * memeWords.length)];
 | |
|                 createTextElement(randomWord);
 | |
|             }
 | |
|     
 | |
|             document.getElementById('text-input').value = '';
 | |
|         });
 | |
| 
 | |
|         // Speicherfunktion
 | |
|         document.getElementById('save-button').addEventListener('click', () => {
 | |
|             html2canvas(document.querySelector("#meme-container")).then(canvas => {
 | |
|                 const link = document.createElement('a');
 | |
|                 link.download = 'doge-meme.png';
 | |
|                 link.href = canvas.toDataURL();
 | |
|                 link.click();
 | |
|             });
 | |
|         });
 | |
| 
 | |
|         // Initiale Meme-Wörter beim Laden
 | |
|         window.addEventListener('load', () => {
 | |
|             memeWords.forEach(word => {
 | |
|                 if (Math.random() > 0.3) createTextElement(word);
 | |
|             });
 | |
|         });
 | |
|     </script>
 | |
| </body>
 | |
| </html> |