commit 7e96a655b500373fdec31ac0c1c050aaa9e80ae4
Author: root <root@hub.scroll.pub> Date: 2024-12-29 06:21:00 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..3fbeccd --- /dev/null +++ b/body.html @@ -0,0 +1,40 @@ +<header> + <nav> + <div class="logo">TaleSpinner</div> + <div class="nav-links"> + <button class="age-group" data-age="5-7">Ages 5-7</button> + <button class="age-group" data-age="8-10">Ages 8-10</button> + <button class="age-group" data-age="11-13">Ages 11-13</button> + </div> + </nav> +</header> + +<main> + <section class="story-generator"> + <h1>Create Your Magical Story</h1> + <div class="prompt-container"> + <label for="story-prompt">What would you like your story to be about?</label> + <input type="text" id="story-prompt" placeholder="Example: A friendly dragon who loves to bake cookies..."> + <button id="generate-story" class="primary-button">Create Story</button> + </div> + + <div class="story-display" hidden> + <div class="story-controls"> + <button id="play-pause" aria-label="Play/Pause narration"> + <span class="icon">▶️</span> + </button> + <button id="previous-page" aria-label="Previous page">◀</button> + <button id="next-page" aria-label="Next page">▶</button> + </div> + + <div class="story-content"> + <div class="illustration"></div> + <div class="story-text"></div> + </div> + </div> + </section> +</main> + +<footer> + <p>Made with love for young storytellers</p> +</footer> diff --git a/index.scroll b/index.scroll new file mode 100644 index 0000000..f9a49ed --- /dev/null +++ b/index.scroll @@ -0,0 +1,8 @@ +buildHtml +baseUrl https://talespinner.scroll.pub +metaTags +editButton /edit.html +title TaleSpinner - Magical Stories for Kids +style.css +body.html +script.js diff --git a/prompt.json b/prompt.json new file mode 100644 index 0000000..86a6c73 --- /dev/null +++ b/prompt.json @@ -0,0 +1,20 @@ +{ + "id": "msg_01494JJbdKt6Txfb2aXx7Zaw", + "type": "message", + "role": "assistant", + "model": "claude-3-5-sonnet-20241022", + "content": [ + { + "type": "text", + "text": "---domain---\ntalespinner.scroll.pub\n\n---index.scroll---\nbuildHtml\nbaseUrl https://talespinner.scroll.pub\nmetaTags\neditButton /edit.html\ntitle TaleSpinner - Magical Stories for Kids\nstyle.css\nbody.html\nscript.js\n\n---body.html---\n<header>\n <nav>\n <div class=\"logo\">TaleSpinner</div>\n <div class=\"nav-links\">\n <button class=\"age-group\" data-age=\"5-7\">Ages 5-7</button>\n <button class=\"age-group\" data-age=\"8-10\">Ages 8-10</button>\n <button class=\"age-group\" data-age=\"11-13\">Ages 11-13</button>\n </div>\n </nav>\n</header>\n\n<main>\n <section class=\"story-generator\">\n <h1>Create Your Magical Story</h1>\n <div class=\"prompt-container\">\n <label for=\"story-prompt\">What would you like your story to be about?</label>\n <input type=\"text\" id=\"story-prompt\" placeholder=\"Example: A friendly dragon who loves to bake cookies...\">\n <button id=\"generate-story\" class=\"primary-button\">Create Story</button>\n </div>\n \n <div class=\"story-display\" hidden>\n <div class=\"story-controls\">\n <button id=\"play-pause\" aria-label=\"Play/Pause narration\">\n <span class=\"icon\">▶️</span>\n </button>\n <button id=\"previous-page\" aria-label=\"Previous page\">◀</button>\n <button id=\"next-page\" aria-label=\"Next page\">▶</button>\n </div>\n \n <div class=\"story-content\">\n <div class=\"illustration\"></div>\n <div class=\"story-text\"></div>\n </div>\n </div>\n </section>\n</main>\n\n<footer>\n <p>Made with love for young storytellers</p>\n</footer>\n\n---style.css---\n:root {\n --primary-color: #6a4c93;\n --secondary-color: #ff8c42;\n --background-color: #f8f7ff;\n --text-color: #2d3436;\n --accent-color: #84fab0;\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: 'Segoe UI', system-ui, sans-serif;\n background-color: var(--background-color);\n color: var(--text-color);\n line-height: 1.6;\n}\n\nheader {\n background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));\n padding: 1rem;\n box-shadow: 0 2px 10px rgba(0,0,0,0.1);\n}\n\nnav {\n max-width: 1200px;\n margin: 0 auto;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n\n.logo {\n font-size: 2rem;\n font-weight: bold;\n color: white;\n text-shadow: 2px 2px 4px rgba(0,0,0,0.2);\n}\n\n.nav-links {\n display: flex;\n gap: 1rem;\n}\n\n.age-group {\n background: transparent;\n border: 2px solid white;\n color: white;\n padding: 0.5rem 1rem;\n border-radius: 20px;\n cursor: pointer;\n transition: all 0.3s ease;\n}\n\n.age-group:hover {\n background: white;\n color: var(--primary-color);\n}\n\nmain {\n max-width: 1000px;\n margin: 2rem auto;\n padding: 0 1rem;\n}\n\n.story-generator {\n background: white;\n border-radius: 20px;\n padding: 2rem;\n box-shadow: 0 4px 20px rgba(0,0,0,0.1);\n}\n\nh1 {\n text-align: center;\n color: var(--primary-color);\n margin-bottom: 2rem;\n font-size: 2.5rem;\n}\n\n.prompt-container {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n}\n\nlabel {\n font-size: 1.2rem;\n color: var(--text-color);\n}\n\ninput {\n padding: 1rem;\n border: 2px solid var(--primary-color);\n border-radius: 10px;\n font-size: 1.1rem;\n}\n\n.primary-button {\n background: var(--primary-color);\n color: white;\n border: none;\n padding: 1rem 2rem;\n border-radius: 10px;\n font-size: 1.2rem;\n cursor: pointer;\n transition: transform 0.3s ease;\n}\n\n.primary-button:hover {\n transform: translateY(-2px);\n background: var(--secondary-color);\n}\n\n.story-display {\n margin-top: 2rem;\n padding: 2rem;\n background: linear-gradient(45deg, #fff1eb, #ace0f9);\n border-radius: 15px;\n}\n\n.story-controls {\n display: flex;\n justify-content: center;\n gap: 1rem;\n margin-bottom: 1rem;\n}\n\n.story-controls button {\n background: white;\n border: none;\n padding: 0.5rem 1rem;\n border-radius: 50%;\n cursor: pointer;\n box-shadow: 0 2px 5px rgba(0,0,0,0.1);\n}\n\n.illustration {\n height: 300px;\n background: white;\n border-radius: 10px;\n margin-bottom: 1rem;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.story-text {\n background: white;\n padding: 1rem;\n border-radius: 10px;\n font-size: 1.2rem;\n line-height: 1.8;\n}\n\nfooter {\n text-align: center;\n padding: 2rem;\n background: var(--primary-color);\n color: white;\n}\n\n@media (max-width: 768px) {\n nav {\n flex-direction: column;\n gap: 1rem;\n }\n \n .nav-links {\n width: 100%;\n justify-content: center;\n }\n \n h1 {\n font-size: 2rem;\n }\n \n .story-display {\n padding: 1rem;\n }\n \n .illustration {\n height: 200px;\n }\n}\n\n---script.js---\ndocument.addEventListener('DOMContentLoaded', () => {\n const generateButton = document.getElementById('generate-story');\n const storyPrompt = document.getElementById('story-prompt');\n const storyDisplay = document.querySelector('.story-display');\n const playPauseButton = document.getElementById('play-pause');\n const prevButton = document.getElementById('previous-page');\n const nextButton = document.getElementById('next-page');\n \n let currentPage = 0;\n let isPlaying = false;\n let speech = null;\n \n const dummyStory = {\n pages: [\n {\n text: \"Once upon a time, in a magical forest...\",\n image: \"🌳\"\n },\n {\n text: \"There lived a wonderful creature who loved adventures...\",\n image: \"🦄\"\n },\n {\n text: \"And they lived happily ever after!\",\n image: \"✨\"\n }\n ]\n };\n \n generateButton.addEventListener('click', () => {\n if (!storyPrompt.value.trim()) {\n alert('Please enter a story prompt first!');\n return;\n }\n \n storyDisplay.hidden = false;\n currentPage = 0;\n updateStoryDisplay();\n \n // Smooth scroll to story\n storyDisplay.scrollIntoView({ behavior: 'smooth' });\n });\n \n function updateStoryDisplay() {\n const illustration = document.querySelector('.illustration');\n const storyText = document.querySelector('.story-text');\n \n illustration.textContent = dummyStory.pages[currentPage].image;\n storyText.textContent = dummyStory.pages[currentPage].text;\n \n prevButton.disabled = currentPage === 0;\n nextButton.disabled = currentPage === dummyStory.pages.length - 1;\n }\n \n playPauseButton.addEventListener('click', () => {\n if (isPlaying) {\n stopNarration();\n } else {\n startNarration();\n }\n });\n \n function startNarration() {\n if ('speechSynthesis' in window) {\n speech = new SpeechSynthesisUtterance(\n document.querySelector('.story-text').textContent\n );\n speech.rate = 0.9;\n speech.pitch = 1.1;\n window.speechSynthesis.speak(speech);\n isPlaying = true;\n playPauseButton.querySelector('.icon').textContent = '⏸️';\n }\n }\n \n function stopNarration() {\n window.speechSynthesis.cancel();\n isPlaying = false;\n playPauseButton.querySelector('.icon').textContent = '▶️';\n }\n \n prevButton.addEventListener('click', () => {\n if (currentPage > 0) {\n currentPage--;\n updateStoryDisplay();\n stopNarration();\n }\n });\n \n nextButton.addEventListener('click', () => {\n if (currentPage < dummyStory.pages.length - 1) {\n currentPage++;\n updateStoryDisplay();\n stopNarration();\n }\n });\n \n // Age group selection\n document.querySelectorAll('.age-group').forEach(button => {\n button.addEventListener('click', () => {\n document.querySelectorAll('.age-group').forEach(btn => \n btn.style.background = 'transparent'\n );\n button.style.background = 'white';\n button.style.color = 'var(--primary-color)';\n });\n });\n});\n\n---end---" + } + ], + "stop_reason": "end_turn", + "stop_sequence": null, + "usage": { + "input_tokens": 309, + "cache_creation_input_tokens": 0, + "cache_read_input_tokens": 0, + "output_tokens": 2708 + } +} \ No newline at end of file diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..a186844 --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# talespinner.scroll.pub +Website generated by Claude from prompt: Create a children's storybook app that allows kids of different age groups to autonomously generate fairy tales using prompts. The app will automatically generate text and illustrations while providing voiceover options. \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..e787e21 --- /dev/null +++ b/script.js @@ -0,0 +1,108 @@ +document.addEventListener('DOMContentLoaded', () => { + const generateButton = document.getElementById('generate-story'); + const storyPrompt = document.getElementById('story-prompt'); + const storyDisplay = document.querySelector('.story-display'); + const playPauseButton = document.getElementById('play-pause'); + const prevButton = document.getElementById('previous-page'); + const nextButton = document.getElementById('next-page'); + + let currentPage = 0; + let isPlaying = false; + let speech = null; + + const dummyStory = { + pages: [ + { + text: "Once upon a time, in a magical forest...", + image: "🌳" + }, + { + text: "There lived a wonderful creature who loved adventures...", + image: "🦄" + }, + { + text: "And they lived happily ever after!", + image: "✨" + } + ] + }; + + generateButton.addEventListener('click', () => { + if (!storyPrompt.value.trim()) { + alert('Please enter a story prompt first!'); + return; + } + + storyDisplay.hidden = false; + currentPage = 0; + updateStoryDisplay(); + + // Smooth scroll to story + storyDisplay.scrollIntoView({ behavior: 'smooth' }); + }); + + function updateStoryDisplay() { + const illustration = document.querySelector('.illustration'); + const storyText = document.querySelector('.story-text'); + + illustration.textContent = dummyStory.pages[currentPage].image; + storyText.textContent = dummyStory.pages[currentPage].text; + + prevButton.disabled = currentPage === 0; + nextButton.disabled = currentPage === dummyStory.pages.length - 1; + } + + playPauseButton.addEventListener('click', () => { + if (isPlaying) { + stopNarration(); + } else { + startNarration(); + } + }); + + function startNarration() { + if ('speechSynthesis' in window) { + speech = new SpeechSynthesisUtterance( + document.querySelector('.story-text').textContent + ); + speech.rate = 0.9; + speech.pitch = 1.1; + window.speechSynthesis.speak(speech); + isPlaying = true; + playPauseButton.querySelector('.icon').textContent = '⏸️'; + } + } + + function stopNarration() { + window.speechSynthesis.cancel(); + isPlaying = false; + playPauseButton.querySelector('.icon').textContent = '▶️'; + } + + prevButton.addEventListener('click', () => { + if (currentPage > 0) { + currentPage--; + updateStoryDisplay(); + stopNarration(); + } + }); + + nextButton.addEventListener('click', () => { + if (currentPage < dummyStory.pages.length - 1) { + currentPage++; + updateStoryDisplay(); + stopNarration(); + } + }); + + // Age group selection + document.querySelectorAll('.age-group').forEach(button => { + button.addEventListener('click', () => { + document.querySelectorAll('.age-group').forEach(btn => + btn.style.background = 'transparent' + ); + button.style.background = 'white'; + button.style.color = 'var(--primary-color)'; + }); + }); +}); diff --git a/style.css b/style.css new file mode 100644 index 0000000..10d38af --- /dev/null +++ b/style.css @@ -0,0 +1,187 @@ +:root { + --primary-color: #6a4c93; + --secondary-color: #ff8c42; + --background-color: #f8f7ff; + --text-color: #2d3436; + --accent-color: #84fab0; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: 'Segoe UI', system-ui, sans-serif; + background-color: var(--background-color); + color: var(--text-color); + line-height: 1.6; +} + +header { + background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); + padding: 1rem; + box-shadow: 0 2px 10px rgba(0,0,0,0.1); +} + +nav { + max-width: 1200px; + margin: 0 auto; + display: flex; + justify-content: space-between; + align-items: center; +} + +.logo { + font-size: 2rem; + font-weight: bold; + color: white; + text-shadow: 2px 2px 4px rgba(0,0,0,0.2); +} + +.nav-links { + display: flex; + gap: 1rem; +} + +.age-group { + background: transparent; + border: 2px solid white; + color: white; + padding: 0.5rem 1rem; + border-radius: 20px; + cursor: pointer; + transition: all 0.3s ease; +} + +.age-group:hover { + background: white; + color: var(--primary-color); +} + +main { + max-width: 1000px; + margin: 2rem auto; + padding: 0 1rem; +} + +.story-generator { + background: white; + border-radius: 20px; + padding: 2rem; + box-shadow: 0 4px 20px rgba(0,0,0,0.1); +} + +h1 { + text-align: center; + color: var(--primary-color); + margin-bottom: 2rem; + font-size: 2.5rem; +} + +.prompt-container { + display: flex; + flex-direction: column; + gap: 1rem; +} + +label { + font-size: 1.2rem; + color: var(--text-color); +} + +input { + padding: 1rem; + border: 2px solid var(--primary-color); + border-radius: 10px; + font-size: 1.1rem; +} + +.primary-button { + background: var(--primary-color); + color: white; + border: none; + padding: 1rem 2rem; + border-radius: 10px; + font-size: 1.2rem; + cursor: pointer; + transition: transform 0.3s ease; +} + +.primary-button:hover { + transform: translateY(-2px); + background: var(--secondary-color); +} + +.story-display { + margin-top: 2rem; + padding: 2rem; + background: linear-gradient(45deg, #fff1eb, #ace0f9); + border-radius: 15px; +} + +.story-controls { + display: flex; + justify-content: center; + gap: 1rem; + margin-bottom: 1rem; +} + +.story-controls button { + background: white; + border: none; + padding: 0.5rem 1rem; + border-radius: 50%; + cursor: pointer; + box-shadow: 0 2px 5px rgba(0,0,0,0.1); +} + +.illustration { + height: 300px; + background: white; + border-radius: 10px; + margin-bottom: 1rem; + display: flex; + align-items: center; + justify-content: center; +} + +.story-text { + background: white; + padding: 1rem; + border-radius: 10px; + font-size: 1.2rem; + line-height: 1.8; +} + +footer { + text-align: center; + padding: 2rem; + background: var(--primary-color); + color: white; +} + +@media (max-width: 768px) { + nav { + flex-direction: column; + gap: 1rem; + } + + .nav-links { + width: 100%; + justify-content: center; + } + + h1 { + font-size: 2rem; + } + + .story-display { + padding: 1rem; + } + + .illustration { + height: 200px; + } +}