make this <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta…
- User
make this *
<script> let phrases = [ "You are enough, just as you are.", "Believe in yourself and you'll be unstoppable.", "Your worth is not defined by your productivity.", "You are doing the best you can, and that's something to be proud of.", "It's okay to not be okay, and it's okay to ask for help.", "You are strong, capable, and resilient.", "Your feelings are valid, and it's okay to feel them.", "You are not alone, and you are loved.", "You are doing better than you think you are.", "Keep going, even when it's hard.", ]; const generatePhraseButton = document.getElementById('generate-phrase'); const phraseContainer = document.getElementById('phrase-container'); const showKnowledgeBaseButton = document.getElementById('show-knowledge-base'); const knowledgeBase = document.getElementById('knowledge-base'); const knowledgeBaseList = document.getElementById('knowledge-base-list'); const addPhraseButton = document.getElementById('add-phrase'); const addPhraseForm = document.getElementById('add-phrase-form'); const newPhraseInput = document.getElementById('new-phrase'); const savePhraseButton = document.getElementById('save-phrase'); // Initialize base phrases.forEach(phrase => { const li = document.createElement('li'); li.textContent = phrase; knowledgeBaseList.appendChild(li); }); generatePhraseButton.addEventListener('click', () => { const randomPhrase = phrases[Math.floor(Math.random() * phrases.length)]; phraseContainer.innerText = randomPhrase; }); showKnowledgeBaseButton.addEventListener('click', () => { if (knowledgeBase.classList.contains('hidden')) { knowledgeBase.classList.remove('hidden'); showKnowledgeBaseButton.innerHTML = ` <i class="fa-solid fa-book fa-lg"></i> `; } else { knowledgeBase.classList.add('hidden'); showKnowledgeBaseButton.innerHTML = ` <i class="fa-solid fa-book fa-lg"></i> `; } }); addPhraseButton.addEventListener('click', () => { if (addPhraseForm.classList.contains('hidden')) { addPhraseForm.classList.remove('hidden'); addPhraseButton.innerText = 'Cancel'; } else { addPhraseForm.classList.add('hidden'); addPhraseButton.innerText = 'Add Your Own Vibes'; } }); savePhraseButton.addEventListener('click', () => { const newPhrase = newPhraseInput.value; if (newPhrase !== '') { phrases.push(newPhrase); const li = document.createElement('li'); li.textContent = newPhrase; knowledgeBaseList.appendChild(li); newPhraseInput.value = ''; addPhraseForm.classList.add('hidden'); addPhraseButton.innerText = 'Add Your Own Vibes'; } }); </script> Assistant
I'll help you create this HTML file with some minor improvements and explanations. Here's the enhanced version:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>MoodLift</title> <!-- Tailwind CSS for styling --> <script src="https://cdn.tailwindcss.com"></script> <!-- Font Awesome for icons --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" /> </head> <body class="bg-gray-100 h-screen flex items-center justify-center"> <div class="bg-white p-8 rounded-lg shadow-md w-full max-w-md"> <h1 class="text-3xl text-gray-700 font-bold mb-4">MoodLift</h1> <p class="text-lg text-gray-600 mb-6">Get your daily dose of motivation and validation!</p> <!-- Generate Phrase Button --> <button id="generate-phrase" class="w-full bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded-lg transition duration-300"> Get Your Daily Lift </button> <!-- Phrase Display Container --> <div id="phrase-container" class="mt-6 text-lg text-gray-600 text-center min-h-[50px]"></div> <!-- Knowledge Base Toggle Button --> <button id="show-knowledge-base" class="bg-gray-300 hover:bg-gray-400 text-gray-700 font-bold py-2 px-4 rounded-lg mt-4 flex justify-center items-center"> <i class="fa-solid fa-book fa-lg"></i> </button> <!-- Knowledge Base Section --> <div id="knowledge-base" class="mt-6 text-lg text-gray-600 hidden"> <h2 class="text-xl text-gray-700 font-bold mb-2">MoodBoard</h2> <ul id="knowledge-base-list" class="list-disc list-inside max-h-60 overflow-y-auto"></ul> <!-- Add Phrase Section --> <button id="add-phrase" class="bg-green-500 hover:bg-green-600 text-white font-bold py-2 px-4 rounded-lg mt-4 transition duration-300"> Add Your Own Vibes </button> <div id="add-phrase-form" class="hidden mt-6"> <input id="new-phrase" type="text" class="w-full p-2 border border-gray-400 rounded-lg" placeholder="Enter a new phrase that lifts your mood"> <button id="save-phrase" class="bg-blue-500 hover:bg-blue-600 text-white font-bold py-2 px-4 rounded-lg mt-2 transition duration-300"> Save Your Vibes </button> </div> </div> <!-- Mood Label Selector --> <div class="mt-6"> <select id="label-select" class="w-full bg-gray-300 hover:bg-gray-400 text-gray-700 font-bold py-2 px-4 rounded-lg"> <option value="validated">Validated</option> <option value="motivated">Motivated</option> <option value="inspired">Inspired</option> </select> </div> </div> <script> // Initial phrases array let phrases = [ "You are enough, just as you are.", "Believe in yourself and you'll be unstoppable.", "Your worth is not defined by your productivity.", "You are doing the best you can, and that's something to be proud of.", "It's okay to not be okay, and it's okay to ask for help.", "You are strong, capable, and resilient.", "Your feelings are valid, and it's okay to feel them.", "You are not alone, and you are loved.", "You are doing better than you think you are.", "Keep going, even when it's hard.", ]; // DOM Element Selections const generatePhraseButton = document.getElementById('generate-phrase'); const phraseContainer = document.getElementById('phrase-container'); const showKnowledgeBaseButton = document.getElementById('show-knowledge-base'); const knowledgeBase = document.getElementById('knowledge-base'); const knowledgeBaseList = document.getElementById('knowledge-base-list'); const addPhraseButton = document.getElementById('add-phrase'); const addPhraseForm = document.getElementById('add-phrase-form'); const newPhraseInput = document.getElementById('new-phrase'); const savePhraseButton = document.getElementById('save-phrase'); // Initialize knowledge base with default phrases function initializeKnowledgeBase() { knowledgeBaseList.innerHTML = ''; // Clear existing list phrases.forEach(phrase => { const li = document.createElement('li'); li.textContent = phrase; knowledgeBaseList.appendChild(li); }); } initializeKnowledgeBase(); // Generate Random Phrase generatePhraseButton.addEventListener('click', () => { const randomPhrase = phrases[Math.floor(Math.random() * phrases.length)]; phraseContainer.innerText = randomPhrase; }); // Toggle Knowledge Base Visibility showKnowledgeBaseButton.addEventListener('click', () => { knowledgeBase.classList.toggle('hidden'); }); // Toggle Add Phrase Form addPhraseButton.addEventListener('click', () => { addPhraseForm.classList.toggle('hidden'); addPhraseButton.innerText = addPhraseForm.classList.contains('hidden') ? 'Add Your Own Vibes' : 'Cancel'; }); // Save New Phrase savePhraseButton.addEventListener('click', () => { const newPhrase = newPhraseInput.value.trim(); if (newPhrase !== '') { phrases.push(newPhrase); initializeKnowledgeBase(); // Refresh the list newPhraseInput.value = ''; addPhraseForm.classList.add('hidden'); addPhraseButton.innerText = 'Add Your Own Vibes'; } }); </script> </body> </html>Key improvements and changes:
- Added more responsive design with
max-w-md - Improved color scheme with more vibrant colors
- Added transition effects to buttons
- Created a scrollable knowledge base list
- Improved JavaScript with more concise and robust functions
- Added
trim()to new phrase input to prevent whitespace-only entries - Refreshed knowledge base list after adding a new phrase
- Made the design more mobile-friendly
- Added comments for better code readability
The core functionality remains the same:
- Generate a random motivational phrase
- Show/hide knowledge base
- Add new phrases to the list
- Select a mood label
You can copy this code and save it as an HTML file to use the MoodLift application.
- Added more responsive design with
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.